Sha256: 78e494d7654b6d76c8a2a23e5894448e68aed2fc345014a46731b23d0430229b

Contents?: true

Size: 677 Bytes

Versions: 29

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

class Avo::FiltersComponent < ViewComponent::Base
  include Avo::ApplicationHelper

  def initialize(filters: [], resource: nil, applied_filters: [], parent_model: nil)
    @filters = filters
    @resource = resource
    @applied_filters = applied_filters
    @parent_model = parent_model
  end

  def render?
    @filters.present?
  end

  def reset_path
    # If come from a association page
    if @parent_model.present?
      helpers.related_resources_path(@parent_model, @parent_model, filters: nil, keep_query_params: true)
    else
      helpers.resources_path(resource: @resource, filters: nil, keep_query_params: true)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
avo-2.18.1 app/components/avo/filters_component.rb
avo-2.18.1.pre.1.eagerloaddirs app/components/avo/filters_component.rb
avo-2.18.0 app/components/avo/filters_component.rb
avo-2.17.1.pre.5.stackedlayout app/components/avo/filters_component.rb
avo-2.17.1.pre.4.issue.1342 app/components/avo/filters_component.rb
avo-2.17.1.pre.3 app/components/avo/filters_component.rb
avo-2.17.1.pre.2.customauthorizationclients app/components/avo/filters_component.rb
avo-2.17.1.pre.1.zeitwerk.eager.load.dir app/components/avo/filters_component.rb
avo-2.17.0 app/components/avo/filters_component.rb
avo-2.16.1.pre.1.nativefields app/components/avo/filters_component.rb
avo-2.16.0 app/components/avo/filters_component.rb
avo-2.15.3 app/components/avo/filters_component.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items app/components/avo/filters_component.rb
avo-2.15.2 app/components/avo/filters_component.rb
avo-2.15.2.pre.1 app/components/avo/filters_component.rb
avo-2.15.1 app/components/avo/filters_component.rb
avo-2.15.0 app/components/avo/filters_component.rb
avo-2.14.3.pre.7.polytranslations1 app/components/avo/filters_component.rb
avo-2.14.3.pre.6.nosprockets app/components/avo/filters_component.rb
avo-2.14.3.pre.5.nosprockets app/components/avo/filters_component.rb