Sha256: 96ef0e600585edaa6fcce5f86482e1009b8c4d75914542c8dbb186e63a655c03

Contents?: true

Size: 949 Bytes

Versions: 29

Compression:

Stored size: 949 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 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

29 entries across 29 versions & 1 rubygems

Version Path
blacklight-7.26.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.26.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.25.3 app/presenters/blacklight/clause_presenter.rb
blacklight-7.25.2 app/presenters/blacklight/clause_presenter.rb
blacklight-7.25.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.25.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.24.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.23.0.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.23.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.22.2 app/presenters/blacklight/clause_presenter.rb
blacklight-7.22.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.22.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.21.2 app/presenters/blacklight/clause_presenter.rb
blacklight-7.21.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.21.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.20.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.20.0 app/presenters/blacklight/clause_presenter.rb
blacklight-7.19.2 app/presenters/blacklight/clause_presenter.rb
blacklight-7.19.1 app/presenters/blacklight/clause_presenter.rb
blacklight-7.19.0 app/presenters/blacklight/clause_presenter.rb