module RailsAdmin::Config::HasGroups

Public Instance Methods

group(name, &block) click to toggle source

Accessor for a group

If group with given name does not yet exist it will be created. If a block is passed it will be evaluated in the context of the group

# File lib/rails_admin/config/has_groups.rb, line 10
def group(name, &block)
  group = parent.groups.find {|g| name == g.name }
  group ||= (parent.groups << RailsAdmin::Config::Fields::Group.new(self, name)).last
  group.tap{|g| g.section = self}.instance_eval &block if block
  group
end
visible_groups() click to toggle source

Reader for groups that are marked as visible

# File lib/rails_admin/config/has_groups.rb, line 18
def visible_groups
  parent.groups.map {|f| f.section = self; f.with(bindings) }.select(&:visible?).select{|g| g.visible_fields.present?}
end