Sha256: f48f65ddf83038828c617ca9026648a787bd3990dc1625ddc012c0aabcc2a40e

Contents?: true

Size: 961 Bytes

Versions: 14

Compression:

Stored size: 961 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.tr(' ', '_')}_sidebar"
    end

    def custom_class
      options[:class]
    end

    def priority
      options[:priority] || 10
    end
  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
yousty-activeadmin-1.0.17.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.16.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.15.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.14.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.13.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.12.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.11.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.10.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.9.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.8.pre lib/active_admin/sidebar_section.rb
activeadmin-1.0.0.pre1 lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.7.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.6.pre lib/active_admin/sidebar_section.rb
yousty-activeadmin-1.0.5.pre lib/active_admin/sidebar_section.rb