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.5.0 app/components/avo/filters_component.rb
avo-3.4.4 app/components/avo/filters_component.rb
avo-3.4.3 app/components/avo/filters_component.rb
avo-3.4.2 app/components/avo/filters_component.rb