Class: Dima::Html::AbstractForm
- Includes:
- Init
- Defined in:
- lib/dima/html/form.rb
Overview
Abstract form.
Instance Attribute Summary collapse
-
#collapsed ⇒ Object
Whether the form is collapsed?.
-
#help ⇒ Object
Help text for this form.
-
#icon ⇒ Object
Title icon.
-
#method ⇒ Object
Form method.
-
#submit ⇒ Object
Submit button text.
-
#title ⇒ Object
Title for this form.
Instance Method Summary collapse
-
#actions ⇒ Object
Get form’s actions.
- #html ⇒ Object
- #to_n ⇒ Object
Methods included from Init
Methods inherited from Element
Instance Attribute Details
#collapsed ⇒ Object
Whether the form is collapsed?
16 17 18 |
# File 'lib/dima/html/form.rb', line 16 def collapsed @collapsed end |
#help ⇒ Object
Help text for this form.
14 15 16 |
# File 'lib/dima/html/form.rb', line 14 def help @help end |
#icon ⇒ Object
Title icon.
12 13 14 |
# File 'lib/dima/html/form.rb', line 12 def icon @icon end |
#method ⇒ Object
Form method.
20 21 22 |
# File 'lib/dima/html/form.rb', line 20 def method @method end |
#submit ⇒ Object
Submit button text.
18 19 20 |
# File 'lib/dima/html/form.rb', line 18 def submit @submit end |
#title ⇒ Object
Title for this form.
10 11 12 |
# File 'lib/dima/html/form.rb', line 10 def title @title end |
Instance Method Details
#actions ⇒ Object
Get form’s actions.
23 24 25 |
# File 'lib/dima/html/form.rb', line 23 def actions @actions ||= [] end |
#html ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/dima/html/form.rb', line 27 def html if defined?(Rails) to_n.html.html_safe else to_n.html end end |
#to_n ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/dima/html/form.rb', line 35 def to_n node = Node.new(tag: 'div', attributes: { id: self.id, class: 'dim-form' }) node << generate_title content = Node.new(tag: 'div', attributes: { class: 'dim-form-content' }) content[:style] = 'display: none;' if self.collapsed content << generate_content node << content node end |