Module: Refinery::SearchHelper
- Defined in:
- app/helpers/refinery/search_helper.rb
Instance Method Summary collapse
- #result_title(result) ⇒ Object
- #result_type(result) ⇒ Object
-
#result_url(result) ⇒ Object
this is where you register your result URLs based on the type of result we’re dealing with.
Instance Method Details
#result_title(result) ⇒ Object
4 5 6 |
# File 'app/helpers/refinery/search_helper.rb', line 4 def result_title(result) result.title.gsub /(#{Regexp.escape(params[:query])})/i, '<mark>\1</mark>' end |
#result_type(result) ⇒ Object
8 9 10 |
# File 'app/helpers/refinery/search_helper.rb', line 8 def result_type(result) result.class.to_s.titleize.gsub('Refinery/', '').gsub '/', '::' end |
#result_url(result) ⇒ Object
this is where you register your result URLs based on the type of result we’re dealing with
14 15 16 17 18 19 20 |
# File 'app/helpers/refinery/search_helper.rb', line 14 def result_url(result) if result.respond_to? :url refinery.url_for result.url else refinery.url_for send(Refinery.route_for_model(result.class, :admin => false), result) end end |