Sha256: 70524244ae3483f990c6ca044e61e39cdf44556c8e07df6f8f5f274472f36345

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

module Sufia
  module BlacklightOverride
    # 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.
      return "".html_safe if localized_params[:q].blank?

      render_constraint_element(constraint_query_label(localized_params),
                                localized_params[:q],
                                classes: ["query"],
                                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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sufia-7.0.0.beta4 app/helpers/sufia/blacklight_override.rb
sufia-7.0.0.beta3 app/helpers/sufia/blacklight_override.rb
sufia-7.0.0.beta2 app/helpers/sufia/blacklight_override.rb
sufia-7.0.0.beta1 app/helpers/sufia/blacklight_override.rb