Sha256: 469abd331240d6355f28615f972f35fee383f26f9597d57270f3f1b0eda25c40

Contents?: true

Size: 951 Bytes

Versions: 5

Compression:

Stored size: 951 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.blank?
                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

5 entries across 5 versions & 1 rubygems

Version Path
enjoy_cms-0.4.0.3 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.4.0.2 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.4.0.1 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.4.0 lib/enjoy/rails_admin_ext/group_patch.rb
enjoy_cms-0.4.0.beta3 lib/enjoy/rails_admin_ext/group_patch.rb