Class: Blacklight::Response::ViewTypeButtonComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Blacklight::Response::ViewTypeButtonComponent
- Defined in:
- app/components/blacklight/response/view_type_button_component.rb
Overview
Render spellcheck results for a search query
Instance Method Summary collapse
- #icon ⇒ Object
-
#initialize(view:, key: nil, selected: false, search_state: nil, classes: 'btn btn-outline-secondary btn-icon') ⇒ ViewTypeButtonComponent
constructor
A new instance of ViewTypeButtonComponent.
- #label ⇒ Object
- #selected? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(view:, key: nil, selected: false, search_state: nil, classes: 'btn btn-outline-secondary btn-icon') ⇒ ViewTypeButtonComponent
Returns a new instance of ViewTypeButtonComponent.
9 10 11 12 13 14 15 |
# File 'app/components/blacklight/response/view_type_button_component.rb', line 9 def initialize(view:, key: nil, selected: false, search_state: nil, classes: 'btn btn-outline-secondary btn-icon') @view = view @key = key || view.key @selected = selected @classes = classes @search_state = search_state end |
Instance Method Details
#icon ⇒ Object
17 18 19 20 21 |
# File 'app/components/blacklight/response/view_type_button_component.rb', line 17 def icon Deprecation.silence(Blacklight::CatalogHelperBehavior) do helpers.render_view_type_group_icon(@view.icon || @key) end end |
#label ⇒ Object
23 24 25 26 27 |
# File 'app/components/blacklight/response/view_type_button_component.rb', line 23 def label Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do helpers.view_label(@key) end end |
#selected? ⇒ Boolean
33 34 35 |
# File 'app/components/blacklight/response/view_type_button_component.rb', line 33 def selected? @selected end |
#url ⇒ Object
29 30 31 |
# File 'app/components/blacklight/response/view_type_button_component.rb', line 29 def url helpers.url_for(@search_state.to_h.merge(view: @key)) end |