Sha256: 5045fee51aa21a4592e88d896ce5222a0184eed4ad62fa178b42da7d66e8489e

Contents?: true

Size: 1.08 KB

Versions: 30

Compression:

Stored size: 1.08 KB

Contents

module Refine::FilterApplicationController 
	# Optional module to get started quickly.You can send in the current controller's instance variable if you'd like to update the collection here
  # The current scope can be used to modify the query


  def apply_filter(filter_class, initial_query: nil)
    if filter_class.present?
      @stable_id = params[:stable_id]
      @refine_filter_builder = Refine::Filters::Builder.new(
        stable_id: @stable_id,
        filter_class: filter_class.name,
        initial_query: initial_query)
      @refine_filter = @refine_filter_builder.refine_filter
    end
  end

  # Use this on pages that use the new inline filter
  def apply_inline_filter(filter_class, initial_query: nil)
    stable_id = params[:stable_id]

    if stable_id.present?
      @refine_filter = Refine::Rails.configuration.stabilizer_classes[:url].new.from_stable_id(id: stable_id, initial_query: initial_query)
    else
      @refine_filter = filter_class.new([], initial_query)
    end
    @refine_client_id = SecureRandom.uuid
    @refine_stable_id = @refine_filter.to_stable_id
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
refine-rails-2.12.0 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.12 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.11 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.10 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.9 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.8 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.6 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.5 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.4 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.3 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.2 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.1 app/controllers/refine/filter_application_controller.rb
refine-rails-2.11.0 app/controllers/refine/filter_application_controller.rb
refine-rails-2.10.1 app/controllers/refine/filter_application_controller.rb
refine-rails-2.10.0 app/controllers/refine/filter_application_controller.rb
refine-rails-2.9.14 app/controllers/refine/filter_application_controller.rb
refine-rails-2.9.13 app/controllers/refine/filter_application_controller.rb
refine-rails-2.9.12 app/controllers/refine/filter_application_controller.rb
refine-rails-2.9.11 app/controllers/refine/filter_application_controller.rb
refine-rails-2.9.10 app/controllers/refine/filter_application_controller.rb