Class: Forma::Tab
Overview
This is a tab.
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #action(url, h = {}) ⇒ Object
-
#add_field(f) ⇒ Object
Adding field to this tab.
-
#col1 {|@col1| ... } ⇒ Object
Returns the first column of this tab.
-
#col2 {|@col2| ... } ⇒ Object
Returns the second column of this tab.
-
#initialize(h = {}) ⇒ Tab
constructor
A new instance of Tab.
Methods included from FieldHelper
#boolean_field, #combo_field, #complex_field, #date_field, #email_field, #image_field, #map_field, #number_field, #password_field, #select_field, #subform, #text_field
Constructor Details
#initialize(h = {}) ⇒ Tab
210 211 212 213 214 215 216 217 |
# File 'lib/forma/form.rb', line 210 def initialize(h = {}) h = h.symbolize_keys @title = h[:title] @icon = h[:icon] @col1 = h[:col1] @col2 = h[:col2] @actions = h[:actions] || [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
208 209 210 |
# File 'lib/forma/form.rb', line 208 def actions @actions end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
208 209 210 |
# File 'lib/forma/form.rb', line 208 def icon @icon end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
208 209 210 |
# File 'lib/forma/form.rb', line 208 def title @title end |
Instance Method Details
#action(url, h = {}) ⇒ Object
238 239 240 241 |
# File 'lib/forma/form.rb', line 238 def action(url, h={}) h[:url] = url @actions << Action.new(h) end |
#add_field(f) ⇒ Object
Adding field to this tab.
220 221 222 |
# File 'lib/forma/form.rb', line 220 def add_field(f) col1.add_field(f) end |
#col1 {|@col1| ... } ⇒ Object
Returns the first column of this tab.
225 226 227 228 229 |
# File 'lib/forma/form.rb', line 225 def col1 @col1 = Col.new if @col1.blank? yield @col1 if block_given? @col1 end |
#col2 {|@col2| ... } ⇒ Object
Returns the second column of this tab.
232 233 234 235 236 |
# File 'lib/forma/form.rb', line 232 def col2 @col2 = Col.new if @col2.blank? yield @col2 if block_given? @col2 end |