Sha256: f131276e7a1e026af50b2f1b2b456a776b39d5abd9a9515bed05b37c1c26a40e

Contents?: true

Size: 948 Bytes

Versions: 11

Compression:

Stored size: 948 Bytes

Contents

module Enjoy::RailsAdminGroupPatch
  class << self
    def enjoy_cms_group(config, fields = {})
      return unless fields

      if fields.is_a?(Array)
        fields.each do |_group|
          config.group _group[:name] do
            active (_group[:active] || false)
            _group[:fields].each_pair do |name, type|
              if type.nil?
                field name
              else
                if type.is_a?(Array)
                  field name, type[0], &type[1]
                else
                  field name, type
                end
              end
            end
          end
        end
      else
        fields.each_pair do |name, type|
          if type.nil?
            config.field name
          else
            if type.is_a?(Array)
              config.field name, type[0], &type[1]
            else
              config.field name, type
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.7.3 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.7.2 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.7.1 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.7 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.6.2 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.6.1 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.6 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.5 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.4 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.3.3 lib/enjoy/rails_admin_group_patch.rb