Class: Katalyst::Tables::Query::SuggestionComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Katalyst::Tables::Query::SuggestionComponent
- Includes:
- HtmlAttributes
- Defined in:
- app/components/katalyst/tables/query/suggestion_component.rb
Instance Method Summary collapse
- #default_html_attributes ⇒ Object
- #dom_id ⇒ Object
-
#initialize(suggestion:, index:) ⇒ SuggestionComponent
constructor
A new instance of SuggestionComponent.
Constructor Details
#initialize(suggestion:, index:) ⇒ SuggestionComponent
Returns a new instance of SuggestionComponent.
11 12 13 14 15 16 |
# File 'app/components/katalyst/tables/query/suggestion_component.rb', line 11 def initialize(suggestion:, index:, **) super(**) @suggestion = suggestion @index = index end |
Instance Method Details
#default_html_attributes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/components/katalyst/tables/query/suggestion_component.rb', line 22 def default_html_attributes { id: dom_id, class: ["suggestion", type.to_s], role: "option", data: { action: %w[ click->tables--query#selectSuggestion query:select->tables--query#selectSuggestion ], tables__query_value_param: value_param, }, } end |
#dom_id ⇒ Object
18 19 20 |
# File 'app/components/katalyst/tables/query/suggestion_component.rb', line 18 def dom_id "suggestion_#{@index}" end |