Sha256: 950fe7d7dbae33a636c41dc642f3b883004684ea5332c10d49a0ecafef00b8a7

Contents?: true

Size: 818 Bytes

Versions: 49

Compression:

Stored size: 818 Bytes

Contents

module ActiveAdmin
  module Views

    class Panel < ActiveAdmin::Component
      builder_method :panel

      def build(title, attributes = {})
        super(attributes)
        add_class "panel"
        @title = h3(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

      def header_action(*args)
        action = args[0]

        @title << div(class: 'header_action') do
          action
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 5 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/views/components/panel.rb
activeadmin-rails-1.7.0 lib/active_admin/views/components/panel.rb
activeadmin-rb-1.6.0 lib/active_admin/views/components/panel.rb
activeadmin-rb-1.5.2 lib/active_admin/views/components/panel.rb
activeadmin-2.8.0 lib/active_admin/views/components/panel.rb
activeadmin-rb-1.5.1 lib/active_admin/views/components/panel.rb
activeadmin-2.7.0 lib/active_admin/views/components/panel.rb
activeadmin-2.6.1 lib/active_admin/views/components/panel.rb
activeadmin-2.6.0 lib/active_admin/views/components/panel.rb
activeadmin-2.5.0 lib/active_admin/views/components/panel.rb
activeadmin-2.4.0 lib/active_admin/views/components/panel.rb
activeadmin-2.3.1 lib/active_admin/views/components/panel.rb
activeadmin-2.3.0 lib/active_admin/views/components/panel.rb
activeadmin-2.2.0 lib/active_admin/views/components/panel.rb
activeadmin-2.1.0 lib/active_admin/views/components/panel.rb
activeadmin-2.0.0 lib/active_admin/views/components/panel.rb
activeadmin-rb-1.5.0 lib/active_admin/views/components/panel.rb
activeadmin-2.0.0.rc2 lib/active_admin/views/components/panel.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/active_admin/views/components/panel.rb
activeadmin-2.0.0.rc1 lib/active_admin/views/components/panel.rb