app/helpers/sufia/blacklight_override.rb in sufia-6.7.0 vs app/helpers/sufia/blacklight_override.rb in sufia-7.0.0.beta1

- old
+ new

@@ -1,26 +1,30 @@ module Sufia module BlacklightOverride - def render_bookmarks_control? - false - end - - def url_for_document(doc, _options = {}) - if doc.is_a?(SolrDocument) && doc.hydra_model == 'Collection' - [collections, doc] - else - [sufia, doc] - end - end - + # TODO: we can remove this override when we can depend on https://github.com/projecthydra-labs/curation_concerns/pull/711 def render_constraints_query(localized_params = params) # So simple don't need a view template, we can just do it here. - scope = localized_params.delete(:route_set) || self return "".html_safe if localized_params[:q].blank? render_constraint_element(constraint_query_label(localized_params), localized_params[:q], classes: ["query"], - remove: scope.url_for(localized_params.merge(q: nil, action: 'index'))) + remove: remove_constraint_url(localized_params)) + end + + # TODO: we can remove this override when we can depend on https://github.com/projecthydra-labs/curation_concerns/pull/711 + def remove_constraint_url(localized_params) + scope = localized_params.delete(:route_set) || self + options = localized_params.merge(q: nil, action: 'index') + .except(*fields_to_exclude_from_constraint_element) + options.permit! + scope.url_for(options) + end + + # This overrides curation_concerns so we aren't removing any fields. + # @return [Array<Symbol>] a list of fields to remove on the render_constraint_element + # You can override this if you have different fields to remove + def fields_to_exclude_from_constraint_element + [] end end end