Sha256: 54d9fab6fbefe2f41bf4612184e2b3be3e060570936e10cae481a43ba4ce815c

Contents?: true

Size: 995 Bytes

Versions: 21

Compression:

Stored size: 995 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)))
    end

    private

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

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/presenters/blacklight/clause_presenter.rb
blacklight-8.6.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.5.1 app/presenters/blacklight/clause_presenter.rb
blacklight-8.5.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.4.0 app/presenters/blacklight/clause_presenter.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/presenters/blacklight/clause_presenter.rb
blacklight-8.3.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.2.2 app/presenters/blacklight/clause_presenter.rb
blacklight-8.2.1 app/presenters/blacklight/clause_presenter.rb
blacklight-8.2.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.1.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.1 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta8 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta7 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta6 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta5 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta4 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta3 app/presenters/blacklight/clause_presenter.rb
blacklight-8.0.0.beta2 app/presenters/blacklight/clause_presenter.rb