Skip to content

Commit

Permalink
Pass url options through to blacklight url helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed May 1, 2017
1 parent 9886e28 commit c46a07d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/concerns/blacklight/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def search_action_url options = {}

def search_action_path *args
if args.first.is_a? Hash
args.first[:only_path] = true
args.first[:only_path] = true if args.first[:only_path].nil?
end

search_action_url(*args)
Expand All @@ -101,7 +101,7 @@ def search_facet_url options = {}

def search_facet_path(options = {})
Deprecation.silence(Blacklight::Controller) do
search_facet_url(options.merge(only_path: true))
search_facet_url(options.reverse_merge(only_path: true))
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/blacklight/facets_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ def render_facet_value(facet_field, item, options = {})
# @param [Blacklight::Solr::Response::Facets::FacetField] facet_field
# @param [String] item
# @return [String]
def path_for_facet(facet_field, item)
def path_for_facet(facet_field, item, path_options = {})
facet_config = facet_configuration_for_field(facet_field)
if facet_config.url_method
send(facet_config.url_method, facet_field, item)
else
search_action_path(search_state.add_facet_params_and_redirect(facet_field, item))
search_action_path(search_state.add_facet_params_and_redirect(facet_field, item).merge(path_options))
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/catalog/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ json.included do
json.hits item['hits']
end
json.links do
json.self path_for_facet(facet['name'], item['value'])
json.self path_for_facet(facet['name'], item['value'], only_path: false)
end
end
end
end
json.links do
json.self search_facet_url(id: facet['name'])
json.self search_facet_path(id: facet['name'], only_path: false)
end
end

Expand Down

0 comments on commit c46a07d

Please sign in to comment.