Skip to content

Commit

Permalink
links from Profile page show users collections and works
Browse files Browse the repository at this point in the history
  • Loading branch information
blancoj committed May 20, 2020
1 parent 90d03eb commit 2a5205e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions app/helpers/hyrax/hyrax_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,16 @@ def search_action_for_dashboard

# @param [ActionController::Parameters] params first argument for Blacklight::SearchState.new
# @param [Hash] facet
# @note Ignores all but the first facet. Probably a bug.
def search_state_with_facets(params, facet = {})
state = Blacklight::SearchState.new(params, CatalogController.blacklight_config)
state = Blacklight::SearchState.new([], CatalogController.blacklight_config)
return state.params if facet.none?
state.add_facet_params(facet.keys.first.to_s + "_sim", facet.values.first)

facet_type = state.add_facet_params(facet.keys.first.to_s + "_sim", facet.values.first)
facet_search = state.add_facet_params(params[:search_field] + "_ssim", params[:q].delete('"'))

query = Hash.new {}
query["f"] = facet_type["f"].merge(facet_search["f"])
query
end

def institution
Expand Down
5 changes: 3 additions & 2 deletions lib/generators/hyrax/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ def self.modified_field
config.add_facet_field "file_format_sim", limit: 5
config.add_facet_field "member_of_collection_ids_ssim", limit: 5, label: 'Collections', helper_method: :collection_title_by_id

# The generic_type isn't displayed on the facet list
# It's used to give a label to the filter that comes from the user profile
# The generic_type and depositor are not displayed on the facet list
# They are used to give a label to the filters that comes from the user profile
config.add_facet_field "generic_type_sim", if: false
config.add_facet_field "depositor_ssim", label: "Depositor", if: false

# Have BL send all facet field names to Solr, which has been the default
# previously. Simply remove these lines if you'd rather use Solr request
Expand Down

0 comments on commit 2a5205e

Please sign in to comment.