Class: Merb::Helpers::Form::Builder::Form
- Inherits:
-
Base
- Object
- Base
- Merb::Helpers::Form::Builder::Form
show all
- Defined in:
- lib/merb-helpers/form/builder.rb
Instance Method Summary
collapse
Methods inherited from Base
#bound_check_box, #bound_radio_button, #bound_radio_group, #bound_select, #bound_text_area, #fieldset, #form, #initialize, #unbound_radio_group
Methods included from Tag
#close_tag, #open_tag, #self_closing_tag, #tag
Instance Method Details
361
362
363
|
# File 'lib/merb-helpers/form/builder.rb', line 361
def button(contents, attrs = {})
unbound_label(attrs) + super
end
|
#label(contents, attrs = {}) ⇒ Object
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/merb-helpers/form/builder.rb', line 299
def label(contents, attrs = {})
if contents
if contents.is_a?(Hash)
label_attrs = contents
contents = label_attrs.delete(:title)
else
label_attrs = attrs
end
tag(:label, contents, label_attrs)
else
""
end
end
|
#submit(value, attrs = {}) ⇒ Object
365
366
367
|
# File 'lib/merb-helpers/form/builder.rb', line 365
def submit(value, attrs = {})
unbound_label(attrs) + super
end
|
#unbound_check_box(attrs = {}) ⇒ Object
338
339
340
341
|
# File 'lib/merb-helpers/form/builder.rb', line 338
def unbound_check_box(attrs = {})
label_text = unbound_label(attrs)
super + label_text
end
|
#unbound_hidden_field(attrs = {}) ⇒ Object
343
344
345
346
|
# File 'lib/merb-helpers/form/builder.rb', line 343
def unbound_hidden_field(attrs = {})
attrs.delete(:label)
super
end
|
#unbound_label(attrs = {}) ⇒ Object
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
# File 'lib/merb-helpers/form/builder.rb', line 321
def unbound_label(attrs = {})
if attrs[:id]
label_attrs = {:for => attrs[:id]}
elsif attrs[:name]
label_attrs = {:for => attrs[:name]}
else
label_attrs = {}
end
label_option = attrs.delete(:label)
if label_option.is_a? Hash
label(label_attrs.merge(label_option))
else
label(label_option, label_attrs)
end
end
|
348
349
350
351
|
# File 'lib/merb-helpers/form/builder.rb', line 348
def unbound_radio_button(attrs = {})
label_text = unbound_label(attrs)
super + label_text
end
|
#unbound_select(attrs = {}) ⇒ Object
353
354
355
|
# File 'lib/merb-helpers/form/builder.rb', line 353
def unbound_select(attrs = {})
unbound_label(attrs) + super
end
|
#unbound_text_area(contents, attrs = {}) ⇒ Object
357
358
359
|
# File 'lib/merb-helpers/form/builder.rb', line 357
def unbound_text_area(contents, attrs = {})
unbound_label(attrs) + super
end
|