Sha256: 69d1b96b30b718ab956b33a8f189996cdb31e141b1716d90de66064da5c7f1ba

Contents?: true

Size: 775 Bytes

Versions: 55

Compression:

Stored size: 775 Bytes

Contents

module ActiveAdmin
  module Views

    class Panel < ActiveAdmin::Component
      builder_method :panel

      def build(title, attributes = {})
        icon_name = attributes.delete(:icon)
        icn = icon_name ? icon(icon_name) : ""
        super(attributes)
        add_class "panel"
        @title = h3(icn + title.to_s)
        @contents = div(:class => "panel_contents")
      end

      def add_child(child)
        if @contents
          @contents << child
        else
          super
        end
      end

      # Override children? to only report children when the panel's
      # contents have been added to. This ensures that the panel
      # correcly appends string values, etc.
      def children?
        @contents.children?
      end

    end

  end
end

Version data entries

55 entries across 55 versions & 2 rubygems

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