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 12
def group(name, &block)
  group = parent.groups.detect { |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 20
def visible_groups
  parent.groups.collect { |f| f.section = self; f.with(bindings) }.select(&:visible?).select do |g| # rubocop:disable Style/Semicolon
    g.visible_fields.present?
  end
end