Class: ActiveAdmin::Views::Scopes

Inherits:
Component
  • Object
show all
Includes:
ScopeChain
Defined in:
lib/active_admin/views/components/scopes.rb

Overview

Renders a collection of ActiveAdmin::Scope objects as a simple list with a separator

Instance Method Summary collapse

Instance Method Details

#build(scopes, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_admin/views/components/scopes.rb', line 16

def build(scopes, options = {})
  super({ role: "toolbar" })
  add_class "scopes"
  prepare_async_counts(scopes, options)

  scopes.group_by(&:group).each do |group, group_scopes|
    div class: "index-button-group", role: "group", data: { "group": group_name(group) } do
      group_scopes.each do |scope|
        build_scope(scope, options) if display_scope?(scope)
      end

      nil
    end
  end
end

#tag_nameObject



12
13
14
# File 'lib/active_admin/views/components/scopes.rb', line 12

def tag_name
  "div"
end