Sha256: 266a9c72d2159aff073f05b3dab79a112a068efd4c6f88f950d88faad38510b7

Contents?: true

Size: 904 Bytes

Versions: 16

Compression:

Stored size: 904 Bytes

Contents

module ActiveAdmin

  class SidebarSection
    include ActiveAdmin::OptionalDisplay

    attr_accessor :name, :options, :block

    def initialize(name, options = {}, &block)
      @name, @options, @block = name, options, block
      normalize_display_options!
    end

    # The id gets used for the div in the view
    def id
      name.to_s.downcase.underscore + '_sidebar_section'
    end

    def icon?
      options[:icon]
    end

    def icon
      options[:icon] if icon?
    end

    # The title gets displayed within the section in the view
    def title
      begin
        I18n.t!("active_admin.sidebars.#{name.to_s}")
      rescue I18n::MissingTranslationData
        name.to_s.titlecase
      end
    end

    # If a block is not passed in, the name of the partial to render
    def partial_name
      options[:partial] || "#{name.to_s.downcase.gsub(' ', '_')}_sidebar"
    end
  end

end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
activeadmin-0.4.4 lib/active_admin/sidebar_section.rb
activeadmin-0.4.3 lib/active_admin/sidebar_section.rb
activeadmin-0.4.2 lib/active_admin/sidebar_section.rb
activeadmin-0.4.1 lib/active_admin/sidebar_section.rb
activeadmin-0.4.0 lib/active_admin/sidebar_section.rb
andrewroth_activeadmin-0.3.4.4 lib/active_admin/sidebar_section.rb
andrewroth_activeadmin-0.3.4.3 lib/active_admin/sidebar_section.rb
andrewroth_activeadmin-0.3.4.2 lib/active_admin/sidebar_section.rb
andrewroth_activeadmin-0.3.4.1 lib/active_admin/sidebar_section.rb
andrewroth_activeadmin-0.3.4 lib/active_admin/sidebar_section.rb
activeadmin-0.3.4 lib/active_admin/sidebar_section.rb
activeadmin-0.3.3 lib/active_admin/sidebar_section.rb
activeadmin-0.3.2 lib/active_admin/sidebar_section.rb
activeadmin-0.3.1 lib/active_admin/sidebar_section.rb
activeadmin-0.3.0 lib/active_admin/sidebar_section.rb
nsm-activeadmin-0.2.2 lib/active_admin/sidebar_section.rb