Sha256: 9d6ea06442a4c4d3923e393ca0648d2a0e128ad07099875daea16db816d19286

Contents?: true

Size: 777 Bytes

Versions: 8

Compression:

Stored size: 777 Bytes

Contents

require 'rails_admin'
module RailsAdmin
  module Config
    module Fields

      class Group
        register_instance_option :weight do
          name.to_sym == :default ? -1_000_000 : 0
        end

        def visible_fields
          section.with(bindings).visible_fields.select { |f|
            f.group == self
          }.sort do |a, b|
            a.weight <=> b.weight
          end
        end
      end

    end
  end
end

module RailsAdmin
  module Config
    module HasGroups

      def visible_groups
        parent.groups.collect { |f|
          f.section = self
          f.with(bindings)
        }.select { |g|
          g.visible? and g.visible_fields.present?
        }.sort do |a, b|
          a.weight <=> b.weight
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hancock_cms-1.0.1 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-2.0.0.2 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-1.0.0.4 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-1.0.0.3 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-2.0.0.1 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-1.0.0.2 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-2.0.0 lib/hancock/rails_admin_ext/patches/group_patch.rb
hancock_cms-1.0.0 lib/hancock/rails_admin_ext/patches/group_patch.rb