Class: RailsAdmin::Config::Sections::Show
- Defined in:
- lib/rails_admin/config/sections/show.rb
Overview
Configuration of the show view for a new object
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#abstract_model, #bindings, #parent, #root
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parent) ⇒ Show
constructor
A new instance of Show.
Methods included from HasGroups
#fields_of_group, #group, #groups, #visible_groups
Methods included from HasFields
#exclude_fields, #field, #fields, #fields_of_type, #include_all_fields, #include_fields, #visible_fields
Methods inherited from Base
#has_option?, register_class_option, #register_deprecated_instance_option, register_deprecated_instance_option, register_instance_option, #register_instance_option, #with
Constructor Details
#initialize(parent) ⇒ Show
Returns a new instance of Show.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rails_admin/config/sections/show.rb', line 28 def initialize(parent) super(parent) # Populate @fields instance variable with model's properties @groups = [ RailsAdmin::Config::Fields::Group.new(self, :default) ] @groups.first.label do I18n.translate("admin.new.basic_info") end @fields = RailsAdmin::Config::Fields.factory(self) @fields.each do |f| if f.association? && f.type != :belongs_to_association f.group f.label.to_sym else f.group :default end if f.serial? || RailsAdmin::Config.default_hidden_fields.include?(f.name) f.hide end end end |
Class Method Details
.default_hidden_fields ⇒ Object
16 17 18 19 |
# File 'lib/rails_admin/config/sections/show.rb', line 16 def self.default_hidden_fields ActiveSupport::Deprecation.warn("'#{self.name}.default_hidden_fields' is deprecated, use 'RailsAdmin::Config.default_hidden_fields' instead", caller) RailsAdmin::Config.default_hidden_fields end |
.default_hidden_fields=(value) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/rails_admin/config/sections/show.rb', line 21 def self.default_hidden_fields=(value) ActiveSupport::Deprecation.warn("'#{self.name}.default_hidden_fields=' is deprecated, use 'RailsAdmin.config{|c| c.default_hidden_fields = #{value}}' instead", caller) RailsAdmin.config do |config| config.default_hidden_fields = value end end |