Files

Merb::Helpers::Form::Builder::Form

Public Instance Methods

button(contents, attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 363
363:     def button(contents, attrs = {})
364:       unbound_label(attrs) + super
365:     end
label(contents, attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 301
301:     def label(contents, attrs = {})
302:       if contents
303:         if contents.is_a?(Hash)
304:           label_attrs = contents
305:           contents = label_attrs.delete(:title)
306:         else
307:           label_attrs = attrs
308:         end
309:         tag(:label, contents, label_attrs)
310:       else
311:         ""
312:       end
313:     end
submit(value, attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 367
367:     def submit(value, attrs = {})
368:       unbound_label(attrs) + super
369:     end
unbound_check_box(attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 340
340:     def unbound_check_box(attrs = {})
341:       label_text = unbound_label(attrs)
342:       super + label_text
343:     end
unbound_hidden_field(attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 345
345:     def unbound_hidden_field(attrs = {})
346:       attrs.delete(:label)
347:       super
348:     end
unbound_label(attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 323
323:     def unbound_label(attrs = {})
324:       if attrs[:id]
325:         label_attrs = {:for => attrs[:id]}
326:       elsif attrs[:name]
327:         label_attrs = {:for => attrs[:name]}
328:       else
329:         label_attrs = {}
330:       end
331: 
332:       label_option = attrs.delete(:label)
333:       if label_option.is_a? Hash
334:         label(label_attrs.merge(label_option))
335:       else
336:         label(label_option, label_attrs)
337:       end
338:     end
unbound_radio_button(attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 350
350:     def unbound_radio_button(attrs = {})
351:       label_text = unbound_label(attrs)
352:       super + label_text
353:     end
unbound_select(attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 355
355:     def unbound_select(attrs = {})
356:       unbound_label(attrs) + super
357:     end
unbound_text_area(contents, attrs = {}) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 359
359:     def unbound_text_area(contents, attrs = {})
360:       unbound_label(attrs) + super
361:     end

Private Instance Methods

radio_group_item(method, attrs) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 393
393:     def radio_group_item(method, attrs)
394:       unless attrs[:id]
395:         attrs.merge!(:id => "#{@name}_#{method}_#{attrs[:value]}")
396:       end
397: 
398:       attrs.merge!(:label => attrs[:label] || attrs[:value])
399:       super
400:     end
update_bound_controls(method, attrs, type) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 373
373:     def update_bound_controls(method, attrs, type)
374:       attrs.merge!(:id => "#{@name}_#{method}") unless attrs[:id]
375:       super
376:     end
update_unbound_controls(attrs, type) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 378
378:     def update_unbound_controls(attrs, type)
379:       if attrs[:name] && !attrs[:id]
380:         attrs.merge!(:id => valid_xhtml_id(attrs[:name]))
381:       end
382:       case type
383:       when "text", "radio", "password", "hidden", "checkbox", "file"
384:         add_css_class(attrs, type)
385:       end
386:       super
387:     end
valid_xhtml_id(candidate) click to toggle source
     # File lib/merb-helpers/form/builder.rb, line 389
389:     def valid_xhtml_id(candidate)
390:       candidate.to_s.gsub(/(\[|\])/, '_')
391:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.