Sha256: a3183351ddc6c71f89e877d87f50dbd4befad2b3bd1ead80df2de7d4d956efaf

Contents?: true

Size: 1000 Bytes

Versions: 13

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  class ClausePresenter
    attr_reader :key, :user_parameters, :field_config, :view_context, :search_state

    def initialize(key, user_parameters, field_config, view_context, search_state = view_context.search_state)
      @key = key
      @user_parameters = user_parameters
      @field_config = field_config
      @view_context = view_context
      @search_state = search_state
    end

    def field_label
      field_config.display_label('search')
    end

    ##
    # Get the displayable version of a facet's value
    #
    # @return [String]
    def label
      user_parameters[:query]
    end

    def constraint_label
      label
    end

    def remove_href(path = search_state)
      view_context.search_action_path(path.reset_search(clause: path.clause_params.except(key)).to_h)
    end

    private

    def facet_field_presenter
      @facet_field_presenter ||= view_context.facet_field_presenter(facet_config, {})
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.39.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.38.0 app/presenters/blacklight/clause_presenter.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/presenters/blacklight/clause_presenter.rb
blacklight-7.37.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.36.2 app/presenters/blacklight/clause_presenter.rb
blacklight-7.36.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.36.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.35.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.34.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.33.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.33.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.32.0 app/presenters/blacklight/clause_presenter.rb