Class: Avo::FiltersComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Avo::FiltersComponent
- Includes:
- ApplicationHelper
- Defined in:
- app/components/avo/filters_component.rb
Instance Method Summary collapse
-
#initialize(filters: [], resource: nil, applied_filters: [], parent_model: nil) ⇒ FiltersComponent
constructor
A new instance of FiltersComponent.
- #render? ⇒ Boolean
- #reset_path ⇒ Object
Methods included from ApplicationHelper
#a_button, #a_link, #button_classes, #empty_state, #get_model_class, #input_classes, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg
Constructor Details
#initialize(filters: [], resource: nil, applied_filters: [], parent_model: nil) ⇒ FiltersComponent
Returns a new instance of FiltersComponent.
6 7 8 9 10 11 |
# File 'app/components/avo/filters_component.rb', line 6 def initialize(filters: [], resource: nil, applied_filters: [], parent_model: nil) @filters = filters @resource = resource @applied_filters = applied_filters @parent_model = parent_model end |
Instance Method Details
#render? ⇒ Boolean
13 14 15 |
# File 'app/components/avo/filters_component.rb', line 13 def render? @filters.present? end |
#reset_path ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/components/avo/filters_component.rb', line 17 def reset_path # If come from a association page if @parent_model.present? helpers.(@parent_model, @parent_model, filters: nil, keep_query_params: true) else helpers.resources_path(resource: @resource, filters: nil, keep_query_params: true) end end |