Class: Dima::Html::ComplexField
- Defined in:
- lib/dima/html/field.rb
Overview
Complex field.
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
Attributes inherited from Field
#after, #align, #before, #edit, #form, #has_errors, #hint, #label, #required, #tooltip, #url
Instance Method Summary collapse
-
#<<(v) ⇒ Object
Initialize this field from a model.
- #>>(v) ⇒ Object
- #empty? ⇒ Boolean
-
#fields ⇒ Object
fields for this component.
- #main_content_node ⇒ Object
Methods inherited from Field
#after_node, #before_node, #edit?, #empty_node, #label_node, #options, #to_n, #url_node, #val, #val=, #validate, #value_node
Methods included from Init
Methods inherited from Element
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model.
200 201 202 |
# File 'lib/dima/html/field.rb', line 200 def model @model end |
Instance Method Details
#<<(v) ⇒ Object
Initialize this field from a model.
208 209 210 211 212 213 |
# File 'lib/dima/html/field.rb', line 208 def << (v) self.model = v fields.each do |f| f << v end end |
#>>(v) ⇒ Object
215 216 217 |
# File 'lib/dima/html/field.rb', line 215 def >> (v) fields.each { |f| f >> v } end |
#empty? ⇒ Boolean
219 220 221 222 223 224 |
# File 'lib/dima/html/field.rb', line 219 def empty? fields.each do |f| return false unless f.empty? end true end |
#fields ⇒ Object
fields for this component.
203 204 205 |
# File 'lib/dima/html/field.rb', line 203 def fields @fields ||= [] end |
#main_content_node ⇒ Object
226 227 228 229 230 231 232 233 |
# File 'lib/dima/html/field.rb', line 226 def main_content_node cmplx = Node.new(tag: 'div', attributes: { class: 'dim-complex' }) fields.each do |f| f.edit = self.edit cmplx << f.main_content_node unless f.empty? end cmplx end |