Sha256: 02d49f9896487e9cca075f7a8bdcc9b3cebe736087708035ceed52cbcd7eb980

Contents?: true

Size: 890 Bytes

Versions: 17

Compression:

Stored size: 890 Bytes

Contents

# frozen_string_literal: true
module ActiveAdmin

  class SidebarSection
    include ActiveAdmin::OptionalDisplay

    attr_accessor :name, :options, :block

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

    # The id gets used for the div in the view
    def id
      "#{name.downcase.underscore}_sidebar_section".parameterize
    end

    # The title gets displayed within the section in the view
    def title
      I18n.t("active_admin.sidebars.#{name}", default: name.titlecase)
    end

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

    def custom_class
      options[:class]
    end

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

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activeadmin-3.2.5 lib/active_admin/sidebar_section.rb
activeadmin-3.2.4 lib/active_admin/sidebar_section.rb
activeadmin-3.2.3 lib/active_admin/sidebar_section.rb
activeadmin-3.2.2 lib/active_admin/sidebar_section.rb
activeadmin-3.2.1 lib/active_admin/sidebar_section.rb
activeadmin-3.2.0 lib/active_admin/sidebar_section.rb
activeadmin-3.1.0 lib/active_admin/sidebar_section.rb
activeadmin-3.0.0 lib/active_admin/sidebar_section.rb
activeadmin-2.14.0 lib/active_admin/sidebar_section.rb
activeadmin-2.13.1 lib/active_admin/sidebar_section.rb
activeadmin-2.13.0 lib/active_admin/sidebar_section.rb
activeadmin-2.12.0 lib/active_admin/sidebar_section.rb
activeadmin-2.11.2 lib/active_admin/sidebar_section.rb
activeadmin-2.11.1 lib/active_admin/sidebar_section.rb
activeadmin-2.11.0 lib/active_admin/sidebar_section.rb
activeadmin-2.10.1 lib/active_admin/sidebar_section.rb
activeadmin-2.10.0 lib/active_admin/sidebar_section.rb