Sha256: 0e0569cce2dd731d09f334815e921e792d0814491e39d119800bbc3d901c114a

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

module ActiveAdmin
  class ResourceController < ::InheritedResources::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

2 entries across 2 versions & 1 rubygems

Version Path
saulolso-activeadmin-0.2.2.1 lib/active_admin/resource_controller/sidebars.rb
saulolso-activeadmin-0.2.2 lib/active_admin/resource_controller/sidebars.rb