Class: Blacklight::ClausePresenter
- Inherits:
-
Object
- Object
- Blacklight::ClausePresenter
- Defined in:
- app/presenters/blacklight/clause_presenter.rb
Instance Attribute Summary collapse
-
#field_config ⇒ Object
readonly
Returns the value of attribute field_config.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#search_state ⇒ Object
readonly
Returns the value of attribute search_state.
-
#user_parameters ⇒ Object
readonly
Returns the value of attribute user_parameters.
-
#view_context ⇒ Object
readonly
Returns the value of attribute view_context.
Instance Method Summary collapse
- #constraint_label ⇒ Object
- #field_label ⇒ Object
-
#initialize(key, user_parameters, field_config, view_context, search_state = view_context.search_state) ⇒ ClausePresenter
constructor
A new instance of ClausePresenter.
-
#label ⇒ String
Get the displayable version of a facet’s value.
- #remove_href(path = search_state) ⇒ Object
Constructor Details
#initialize(key, user_parameters, field_config, view_context, search_state = view_context.search_state) ⇒ ClausePresenter
Returns a new instance of ClausePresenter.
7 8 9 10 11 12 13 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 7 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 |
Instance Attribute Details
#field_config ⇒ Object (readonly)
Returns the value of attribute field_config.
5 6 7 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 5 def field_config @field_config end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 5 def key @key end |
#search_state ⇒ Object (readonly)
Returns the value of attribute search_state.
5 6 7 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 5 def search_state @search_state end |
#user_parameters ⇒ Object (readonly)
Returns the value of attribute user_parameters.
5 6 7 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 5 def user_parameters @user_parameters end |
#view_context ⇒ Object (readonly)
Returns the value of attribute view_context.
5 6 7 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 5 def view_context @view_context end |
Instance Method Details
#constraint_label ⇒ Object
27 28 29 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 27 def constraint_label label end |
#field_label ⇒ Object
15 16 17 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 15 def field_label field_config.display_label('search') end |
#label ⇒ String
Get the displayable version of a facet’s value
23 24 25 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 23 def label user_parameters[:query] end |
#remove_href(path = search_state) ⇒ Object
31 32 33 |
# File 'app/presenters/blacklight/clause_presenter.rb', line 31 def remove_href(path = search_state) view_context.search_action_path(path.reset_search(clause: path.clause_params.except(key))) end |