Sha256: 8a7c399fb871c44fb219be8e3333418590be18879b0c09aa4eb60ec5a28221f6

Contents?: true

Size: 723 Bytes

Versions: 72

Compression:

Stored size: 723 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, filters: nil, reset_filter: true, keep_query_params: true)
    else
      helpers.resources_path(resource: @resource, filters: nil, reset_filter: true, keep_query_params: true)
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
avo-3.4.1 app/components/avo/filters_component.rb
avo-3.4.0 app/components/avo/filters_component.rb
avo-3.3.6 app/components/avo/filters_component.rb
avo-3.3.5 app/components/avo/filters_component.rb
avo-3.3.4 app/components/avo/filters_component.rb
avo-3.3.3 app/components/avo/filters_component.rb
avo-3.3.2 app/components/avo/filters_component.rb
avo-3.3.1 app/components/avo/filters_component.rb
avo-3.3.0 app/components/avo/filters_component.rb
avo-3.2.3 app/components/avo/filters_component.rb
avo-3.0.1.beta23 app/components/avo/filters_component.rb
avo-3.0.1.beta20 app/components/avo/filters_component.rb
avo-3.0.1.beta21 app/components/avo/filters_component.rb
avo-3.0.1.beta17 app/components/avo/filters_component.rb
avo-3.0.1.beta22 app/components/avo/filters_component.rb
avo-3.0.1.beta18 app/components/avo/filters_component.rb
avo-3.0.1.beta19 app/components/avo/filters_component.rb
avo-3.0.1.beta24 app/components/avo/filters_component.rb
avo-3.0.1.beta15 app/components/avo/filters_component.rb
avo-3.0.1.beta16 app/components/avo/filters_component.rb