Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow a name to be defined to be display in search results. #38

Merged
merged 2 commits into from

3 participants

@markprovan

While the current implementation uses the class name in the search results. It would be good to be able to define our own custom names. This PR addresses that by allowing the user to define this in the model:

def friendly_search_name
  "Document"
end
@gwagener
Collaborator

Seems like a reasonable API. Since it's already using a helper there it seems like it would be better to add this logic to the helper.

@markprovan

@gwagener Agreed. Will make the relavent changes.

@parndt parndt merged commit d1d615d into refinery:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 12, 2013
  1. @markprovan
Commits on Apr 13, 2013
  1. @markprovan

    Extracted logic to helper

    markprovan authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 app/helpers/refinery/search_helper.rb
View
6 app/helpers/refinery/search_helper.rb
@@ -6,7 +6,11 @@ def result_title(result)
end
def result_type(result)
- result.class.to_s.titleize.split("/").last
+ if result.class.method_defined?(:friendly_search_name)
+ result.friendly_search_name
+ else
+ result.class.to_s.titleize.split("/").last
+ end
end
# this is where you register your result URLs based on the
Something went wrong with that request. Please try again.