Class: SnFilterable::MainComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- SnFilterable::MainComponent
- Includes:
- Turbo::FramesHelper, Turbo::StreamsHelper
- Defined in:
- app/components/sn_filterable/main_component.rb
Overview
Renders the filtering interface
## Filters’ info An array of hashes in the following Hash format:
- multi: [Boolean]; Determines if this filter supports multiple simultaneous subfilters. If true, the filter must be declared in the [Filterable]'s [ARRAY_FILTER_SCOPES]
- title: [String]; The title to display on the filtering interface
- filter_name: [String]; The filter's parameter name, see [Filterable]'s documentation
- filters: [Array<Hash>]; An array of the available preset sub filters
- name: [String]; The name of the sub filter to display in the interface
- value: [String]; The value of the sub filter
Instance Method Summary collapse
-
#initialize(frame_id:, filtered:, filters:, url: nil, search_filter_name: nil, show_sidebar: true, update_url_on_submit: true, extra_params: {}) ⇒ MainComponent
constructor
A new instance of MainComponent.
- #search_field ⇒ Object
Constructor Details
#initialize(frame_id:, filtered:, filters:, url: nil, search_filter_name: nil, show_sidebar: true, update_url_on_submit: true, extra_params: {}) ⇒ MainComponent
Returns a new instance of MainComponent.
28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/sn_filterable/main_component.rb', line 28 def initialize(frame_id:, filtered:, filters:, url: nil, search_filter_name: nil, show_sidebar: true, update_url_on_submit: true, extra_params: {}) @frame_id = frame_id @filtered = filtered @filters = filters @url = url @search_filter_name = search_filter_name @show_sidebar = @update_url_on_submit = update_url_on_submit @extra_params = extra_params end |
Instance Method Details
#search_field ⇒ Object
39 40 41 |
# File 'app/components/sn_filterable/main_component.rb', line 39 def search_field SnFilterable::SearchComponent.new(filtered: @filtered, filter_name: @search_filter_name) end |