Sha256: 5f8ed62f54e2390e4687168dd1f98bcbee4b5c7b30f987a57863ee3c67a4fa6d

Contents?: true

Size: 818 Bytes

Versions: 3

Compression:

Stored size: 818 Bytes

Contents

module ActiveAdmin
  class ResourceController < ::InheritedViews::Base

    module Sidebars
      extend ActiveSupport::Concern

      included do
        self.class_inheritable_accessor :sidebar_sections
        self.sidebar_sections = []
      end

      module ClassMethods
        def sidebar(name, options = {}, &block)
          self.sidebar_sections << ActiveAdmin::Sidebar::Section.new(name, options, &block)
        end

        def clear_sidebar_sections!
          self.sidebar_sections = []
        end

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

      protected

      def skip_sidebar!
        @skip_sidebar = true
      end

      def skip_sidebar?
        @skip_sidebar == true
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-0.2.2 lib/active_admin/resource_controller/sidebars.rb
activeadmin-0.2.1 lib/active_admin/resource_controller/sidebars.rb
activeadmin-0.2.0 lib/active_admin/resource_controller/sidebars.rb