Class: Oversee::Field
- Defined in:
- app/components/oversee/field.rb
Defined Under Namespace
Classes: Display, Form, Input, Label, Set, Value
Instance Attribute Summary collapse
-
#datatype ⇒ Object
readonly
Returns the value of attribute datatype.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #__FORM__ ⇒ Object
- #__INPUT__ ⇒ Object
-
#__LABEL__ ⇒ Object
Sub-components.
- #__SET__ ⇒ Object
- #__VALUE__ ⇒ Object
- #field_form_id ⇒ Object
-
#field_id ⇒ Object
Helpers & Decorators.
- #field_name ⇒ Object
-
#initialize(resource: nil, key: nil, value: nil, datatype: nil, **options) ⇒ Field
constructor
A new instance of Field.
- #resource_class_name ⇒ Object
- #view_template ⇒ Object
Constructor Details
#initialize(resource: nil, key: nil, value: nil, datatype: nil, **options) ⇒ Field
Returns a new instance of Field.
7 8 9 10 11 12 13 |
# File 'app/components/oversee/field.rb', line 7 def initialize(resource: nil, key: nil, value: nil, datatype: nil, **) @resource = resource @key = key @value = value @datatype = datatype @options = end |
Instance Attribute Details
#datatype ⇒ Object (readonly)
Returns the value of attribute datatype.
5 6 7 |
# File 'app/components/oversee/field.rb', line 5 def datatype @datatype end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'app/components/oversee/field.rb', line 3 def key @key end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
2 3 4 |
# File 'app/components/oversee/field.rb', line 2 def resource @resource end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'app/components/oversee/field.rb', line 4 def value @value end |
Instance Method Details
#__FORM__ ⇒ Object
23 |
# File 'app/components/oversee/field.rb', line 23 def __FORM__ = Oversee::Field::Form.new(resource:, key:, value:, datatype:, **@options) |
#__INPUT__ ⇒ Object
22 |
# File 'app/components/oversee/field.rb', line 22 def __INPUT__ = Oversee::Field::Input.new(resource:, key:, value:, datatype:, **@options) |
#__LABEL__ ⇒ Object
Sub-components
20 |
# File 'app/components/oversee/field.rb', line 20 def __LABEL__ = Oversee::Field::Label.new(resource:, key:, value:, datatype:, **@options) |
#__SET__ ⇒ Object
24 |
# File 'app/components/oversee/field.rb', line 24 def __SET__ = Oversee::Field::Set.new(resource:, key:, value:, datatype:, **@options) |
#__VALUE__ ⇒ Object
21 |
# File 'app/components/oversee/field.rb', line 21 def __VALUE__ = Oversee::Field::Value.new(resource:, key:, value:, datatype:, **@options) |
#field_form_id ⇒ Object
35 36 37 |
# File 'app/components/oversee/field.rb', line 35 def field_form_id @form_id ||= dom_id(resource, "#{key}_form") end |
#field_id ⇒ Object
Helpers & Decorators
27 28 29 |
# File 'app/components/oversee/field.rb', line 27 def field_id @field_id ||= "resource_#{key}" end |
#field_name ⇒ Object
31 32 33 |
# File 'app/components/oversee/field.rb', line 31 def field_name @field_name ||= "resource[#{key}]" end |
#resource_class_name ⇒ Object
39 40 41 |
# File 'app/components/oversee/field.rb', line 39 def resource_class_name @resource_class_name ||= @resource.class.name end |
#view_template ⇒ Object
15 16 17 |
# File 'app/components/oversee/field.rb', line 15 def view_template plain "Oversee::Field" end |