2009-12-08 15:16:46 +00:00
|
|
|
require 'simple_form/label'
|
2009-12-08 15:44:54 +00:00
|
|
|
require 'simple_form/input'
|
2009-12-08 15:16:46 +00:00
|
|
|
|
2009-11-18 23:50:43 +00:00
|
|
|
module SimpleForm
|
|
|
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
2009-12-08 15:16:46 +00:00
|
|
|
include SimpleForm::Label
|
2009-12-08 15:44:54 +00:00
|
|
|
include SimpleForm::Input
|
2009-11-19 21:26:16 +00:00
|
|
|
|
|
|
|
def input(attribute, options={})
|
2009-12-08 14:55:04 +00:00
|
|
|
@attribute, @options = attribute, options
|
2009-12-08 15:16:46 +00:00
|
|
|
@options.assert_valid_keys(:as, :label, :options, :html)
|
2009-12-08 13:48:31 +00:00
|
|
|
|
2009-12-08 14:55:04 +00:00
|
|
|
label = generate_label
|
|
|
|
input = generate_input
|
2009-12-08 13:48:31 +00:00
|
|
|
|
2009-12-08 14:55:04 +00:00
|
|
|
label << input
|
2009-11-19 21:26:16 +00:00
|
|
|
end
|
|
|
|
|
2009-11-18 23:50:43 +00:00
|
|
|
end
|
|
|
|
end
|