Sha256: 17072fa9ff96e2eb5b71b638880d37a5e18af7d7b0acd9cb711f26dc24aa1340

Contents?: true

Size: 860 Bytes

Versions: 13

Compression:

Stored size: 860 Bytes

Contents

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

13 entries across 13 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/active_admin/sidebar_section.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/active_admin/sidebar_section.rb
activeadmin-2.9.0 lib/active_admin/sidebar_section.rb
activeadmin-2.8.1 lib/active_admin/sidebar_section.rb
activeadmin-2.8.0 lib/active_admin/sidebar_section.rb
activeadmin-2.7.0 lib/active_admin/sidebar_section.rb
activeadmin-2.6.1 lib/active_admin/sidebar_section.rb
activeadmin-2.6.0 lib/active_admin/sidebar_section.rb
activeadmin-2.5.0 lib/active_admin/sidebar_section.rb
activeadmin-2.4.0 lib/active_admin/sidebar_section.rb
activeadmin-2.3.1 lib/active_admin/sidebar_section.rb
activeadmin-2.3.0 lib/active_admin/sidebar_section.rb
activeadmin-2.2.0 lib/active_admin/sidebar_section.rb