Sha256: f3a5f6baabe85ba08a674d8540f4f7f902ebc02d0a65601ff0fead52196fad87

Contents?: true

Size: 750 Bytes

Versions: 17

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true
require "active_admin/filters/active_filter"

module ActiveAdmin
  module Filters

    class Active
      attr_accessor :filters, :resource

      # Instantiate a `Active` object containing collection of current active filters

      # @param resource [ActiveAdmin::Resource] current resource
      # @param search [Ransack::Search] search object
      #
      # @see ActiveAdmin::ResourceController::DataAcces#apply_filtering
      def initialize(resource, search)
        @resource = resource
        @filters = build_filters(search.conditions)
      end

      private

      def build_filters(conditions)
        conditions.map { |condition| ActiveFilter.new(resource, condition.dup) }
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activeadmin-3.2.5 lib/active_admin/filters/active.rb
activeadmin-3.2.4 lib/active_admin/filters/active.rb
activeadmin-3.2.3 lib/active_admin/filters/active.rb
activeadmin-3.2.2 lib/active_admin/filters/active.rb
activeadmin-3.2.1 lib/active_admin/filters/active.rb
activeadmin-3.2.0 lib/active_admin/filters/active.rb
activeadmin-3.1.0 lib/active_admin/filters/active.rb
activeadmin-3.0.0 lib/active_admin/filters/active.rb
activeadmin-2.14.0 lib/active_admin/filters/active.rb
activeadmin-2.13.1 lib/active_admin/filters/active.rb
activeadmin-2.13.0 lib/active_admin/filters/active.rb
activeadmin-2.12.0 lib/active_admin/filters/active.rb
activeadmin-2.11.2 lib/active_admin/filters/active.rb
activeadmin-2.11.1 lib/active_admin/filters/active.rb
activeadmin-2.11.0 lib/active_admin/filters/active.rb
activeadmin-2.10.1 lib/active_admin/filters/active.rb
activeadmin-2.10.0 lib/active_admin/filters/active.rb