Sha256: 482fcdaefa609d7abb28eba9f27c3b60b6195349988f1d975ea6cbde8c5188bb
Contents?: true
Size: 875 Bytes
Versions: 3
Compression:
Stored size: 875 Bytes
Contents
# frozen_string_literal: true require_relative "active_filter" module ActiveAdmin module Filters class Active attr_reader :filters, :resource, :scopes # 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) @scopes = search.instance_variable_get(:@scope_args) end def all_blank? filters.blank? && scopes.blank? end private def build_filters(conditions) conditions.map { |condition| ActiveFilter.new(resource, condition.dup) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-4.0.0.beta15 | lib/active_admin/filters/active.rb |
activeadmin-4.0.0.beta14 | lib/active_admin/filters/active.rb |
activeadmin-4.0.0.beta13 | lib/active_admin/filters/active.rb |