Sha256: 3bcc27322b3422a6cce6d885783384190dfc9e8eb363631a2ed167cb2d0263c4

Contents?: true

Size: 854 Bytes

Versions: 24

Compression:

Stored size: 854 Bytes

Contents

require 'rails_admin/config/fields/group'

module RailsAdmin
  module Config
    module HasGroups
      # 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
      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

      # Reader for groups that are marked as visible
      def visible_groups
        parent.groups.collect { |f| f.section = self; f.with(bindings) }.select(&:visible?).select do |g| # rubocop:disable Semicolon
          g.visible_fields.present?
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
rails_admin-1.4.3 lib/rails_admin/config/has_groups.rb
rails_admin-2.0.0 lib/rails_admin/config/has_groups.rb
rails_admin-2.0.0.rc lib/rails_admin/config/has_groups.rb
rails_admin-2.0.0.beta lib/rails_admin/config/has_groups.rb
rails_admin-1.4.2 lib/rails_admin/config/has_groups.rb
rails_admin-1.4.1 lib/rails_admin/config/has_groups.rb
rails_admin-1.4.0 lib/rails_admin/config/has_groups.rb
rails_admin-1.3.0 lib/rails_admin/config/has_groups.rb
rails_admin-1.2.0 lib/rails_admin/config/has_groups.rb
rails_admin-1.1.1 lib/rails_admin/config/has_groups.rb
rails_admin-1.1.0 lib/rails_admin/config/has_groups.rb
rails_admin-1.0.0 lib/rails_admin/config/has_groups.rb
rails_admin-1.0.0.rc lib/rails_admin/config/has_groups.rb
rails_admin-0.8.1 lib/rails_admin/config/has_groups.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/config/has_groups.rb
rails_admin-0.7.0 lib/rails_admin/config/has_groups.rb
rails_admin-0.6.8 lib/rails_admin/config/has_groups.rb
rails_admin-0.6.7 lib/rails_admin/config/has_groups.rb
rails_admin-0.6.6 lib/rails_admin/config/has_groups.rb
rails_admin-0.6.5 lib/rails_admin/config/has_groups.rb