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
363
364
365
|
# File 'lib/merb-helpers/form/builder.rb', line 363
def button(contents, attrs = {})
unbound_label(attrs) + super
end
|
#label(contents, attrs = {}) ⇒ Object
301
302
303
304
305
306
307
308
309
310
311
312
313
|
# File 'lib/merb-helpers/form/builder.rb', line 301
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
367
368
369
|
# File 'lib/merb-helpers/form/builder.rb', line 367
def submit(value, attrs = {})
unbound_label(attrs) + super
end
|
#unbound_check_box(attrs = {}) ⇒ Object
340
341
342
343
|
# File 'lib/merb-helpers/form/builder.rb', line 340
def unbound_check_box(attrs = {})
label_text = unbound_label(attrs)
super + label_text
end
|
#unbound_hidden_field(attrs = {}) ⇒ Object
345
346
347
348
|
# File 'lib/merb-helpers/form/builder.rb', line 345
def unbound_hidden_field(attrs = {})
attrs.delete(:label)
super
end
|
#unbound_label(attrs = {}) ⇒ Object
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
# File 'lib/merb-helpers/form/builder.rb', line 323
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
|
350
351
352
353
|
# File 'lib/merb-helpers/form/builder.rb', line 350
def unbound_radio_button(attrs = {})
label_text = unbound_label(attrs)
super + label_text
end
|
#unbound_select(attrs = {}) ⇒ Object
355
356
357
|
# File 'lib/merb-helpers/form/builder.rb', line 355
def unbound_select(attrs = {})
unbound_label(attrs) + super
end
|
#unbound_text_area(contents, attrs = {}) ⇒ Object
359
360
361
|
# File 'lib/merb-helpers/form/builder.rb', line 359
def unbound_text_area(contents, attrs = {})
unbound_label(attrs) + super
end
|