Class: Terrazzo::Page::Form
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Attributes inherited from Base
Instance Method Summary collapse
- #attributes(action = nil) ⇒ Object
- #grouped_attributes(action = nil) ⇒ Object
-
#initialize(dashboard, resource) ⇒ Form
constructor
A new instance of Form.
Constructor Details
#initialize(dashboard, resource) ⇒ Form
Returns a new instance of Form.
6 7 8 9 |
# File 'lib/terrazzo/page/form.rb', line 6 def initialize(dashboard, resource) super(dashboard, resource.class) @resource = resource end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/terrazzo/page/form.rb', line 4 def resource @resource end |
Instance Method Details
#attributes(action = nil) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/terrazzo/page/form.rb', line 16 def attributes(action = nil) attrs = dashboard.form_attributes(action) dashboard.flatten_attributes(attrs).map do |attr| dashboard.attribute_type_for(attr).new(attr, nil, :form, resource: resource) end end |
#grouped_attributes(action = nil) ⇒ Object
11 12 13 14 |
# File 'lib/terrazzo/page/form.rb', line 11 def grouped_attributes(action = nil) attrs = dashboard.form_attributes(action) normalize_groups(attrs, :form) end |