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 seperator

Instance Method Summary collapse

Instance Method Details

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



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

def build(scopes, options = {})
  super({ role: "toolbar" })
  add_class "scopes"
  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 call_method_or_exec_proc(scope.display_if_block)
      end

      nil
    end
  end
end

#tag_nameObject



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

def tag_name
  "div"
end