Class: Spotlight::TagSelectorComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Spotlight::TagSelectorComponent
- Defined in:
- app/components/spotlight/tag_selector_component.rb
Overview
Displays a tag selection input This uses a plain text input that acts-as-taggable-on expects.
Instance Method Summary collapse
-
#initialize(field_name:, all_tags:, selected_tags_value: nil, form: nil) ⇒ TagSelectorComponent
constructor
selected_tags_value is a comma delimited string of tags.
- #search_icon_svg ⇒ Object
- #selected_tags ⇒ Object
Constructor Details
#initialize(field_name:, all_tags:, selected_tags_value: nil, form: nil) ⇒ TagSelectorComponent
selected_tags_value is a comma delimited string of tags
8 9 10 11 12 13 14 15 |
# File 'app/components/spotlight/tag_selector_component.rb', line 8 def initialize(field_name:, all_tags:, selected_tags_value: nil, form: nil) @form = form @field_name = field_name @selected_tags_value = || '' @all_tags = &.sort_by { |tag| (tag.respond_to?(:name) ? tag.name : tag).downcase } super end |
Instance Method Details
#search_icon_svg ⇒ Object
21 22 23 |
# File 'app/components/spotlight/tag_selector_component.rb', line 21 def search_icon_svg render Blacklight::Icons::SearchComponent.new end |
#selected_tags ⇒ Object
17 18 19 |
# File 'app/components/spotlight/tag_selector_component.rb', line 17 def .split(',').map(&:strip) end |