Last active
August 29, 2015 14:01
-
-
Save cbeer/fb97d657ff7a7bd12ee2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BlacklightConfigurationHelper | |
include Blacklight::ConfigurationHelperBehavior | |
def default_sort_field | |
if params.has_key? :q | |
active_sort_fields.select { |k,config| config.default_for_user_query }.first || super | |
else | |
super | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CatalogController | |
... | |
configure_blacklight do |config| | |
config.add_sort_field 'relevance', default_for_user_query: true | |
config.add_sort_field 'title', default: true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment