Sha256: 2022363cfd29cd135d4257590fc0b5a5ec3acaf47f1df4de2023c437ce659b93

Contents?: true

Size: 739 Bytes

Versions: 24

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

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

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

  def render?
    @filters.present?
  end

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
avo-3.9.2 app/components/avo/filters_component.rb
avo-3.9.1 app/components/avo/filters_component.rb
avo-3.8.2 app/components/avo/filters_component.rb
avo-3.9.0 app/components/avo/filters_component.rb
avo-3.8.1 app/components/avo/filters_component.rb
avo-3.8.0 app/components/avo/filters_component.rb
avo-3.6.4 app/components/avo/filters_component.rb
avo-3.6.3 app/components/avo/filters_component.rb
avo-3.6.2 app/components/avo/filters_component.rb
avo-3.6.1 app/components/avo/filters_component.rb
avo-3.6.0 app/components/avo/filters_component.rb
avo-3.5.8 app/components/avo/filters_component.rb
avo-3.5.7 app/components/avo/filters_component.rb
avo-3.5.6 app/components/avo/filters_component.rb
avo-3.5.6.beta1 app/components/avo/filters_component.rb
avo-3.5.5 app/components/avo/filters_component.rb
avo-3.5.4 app/components/avo/filters_component.rb
avo-3.5.3 app/components/avo/filters_component.rb
avo-3.5.2 app/components/avo/filters_component.rb
avo-3.5.1 app/components/avo/filters_component.rb