Sha256: 5b758b96d9063404c4bf934b53afc92ecc52efe9bfe7e10e3a1871123a5a0b1f

Contents?: true

Size: 855 Bytes

Versions: 50

Compression:

Stored size: 855 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".parameterize
    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
      I18n.t("active_admin.sidebars.#{name.to_s}", :default => name.to_s.titlecase)
    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

50 entries across 50 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.141 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/active_admin/sidebar_section.rb