Class: Form::Field
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Form::Field
- Includes:
- Admin::Form::Field
- Defined in:
- app/models/form/field.rb
Instance Method Summary collapse
- #column_key ⇒ Object
- #default_label ⇒ Object
- #input_type ⇒ Object
- #label ⇒ Object
- #type_enum ⇒ Object
- #update_header ⇒ Object
Methods included from Admin::Form::Field
Instance Method Details
#column_key ⇒ Object
34 35 36 |
# File 'app/models/form/field.rb', line 34 def column_key :"column_#{position}" end |
#default_label ⇒ Object
42 43 44 |
# File 'app/models/form/field.rb', line 42 def default_label send("label_#{I18n.default_locale}") end |
#input_type ⇒ Object
46 47 48 |
# File 'app/models/form/field.rb', line 46 def input_type type.demodulize.underscore.to_sym end |
#label ⇒ Object
38 39 40 |
# File 'app/models/form/field.rb', line 38 def label send("label_#{I18n.locale}") end |
#type_enum ⇒ Object
50 51 52 |
# File 'app/models/form/field.rb', line 50 def type_enum TYPES end |
#update_header ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/models/form/field.rb', line 54 def update_header attributes = RailsAdminCMS::Config.custom_form_max_size.times.map do |i| [:"column_#{i}", ''] end.to_h fields.map do |field| attributes[field.column_key] = field.default_label end header.update! attributes end |