Sha256: e431efe1cf9eae5e46dfd0d8c53395254daf08dc6f3a82a823ca3ab78d270658

Contents?: true

Size: 731 Bytes

Versions: 7

Compression:

Stored size: 731 Bytes

Contents

require 'active_admin/helpers/optional_display'

module ActiveAdmin

  class Resource
    module Sidebars

      def initialize(*args)
        super
        add_default_sidebar_sections
      end

      def sidebar_sections
        @sidebar_sections ||= []
      end

      def clear_sidebar_sections!
        @sidebar_sections = []
      end

      def sidebar_sections_for(action)
        sidebar_sections.select{|section| section.display_on?(action) }
      end

      private

      def add_default_sidebar_sections
        self.sidebar_sections << ActiveAdmin::SidebarSection.new(:filters, :only => :index) do
          active_admin_filters_form_for assigns["search"], filters_config
        end
      end

    end
  end

end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
andrewroth_activeadmin-0.3.4 lib/active_admin/resource/sidebars.rb
activeadmin-0.3.4 lib/active_admin/resource/sidebars.rb
activeadmin-0.3.3 lib/active_admin/resource/sidebars.rb
activeadmin-0.3.2 lib/active_admin/resource/sidebars.rb
activeadmin-0.3.1 lib/active_admin/resource/sidebars.rb
activeadmin-0.3.0 lib/active_admin/resource/sidebars.rb
nsm-activeadmin-0.2.2 lib/active_admin/resource/sidebars.rb