Fingertips-form-san 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/form_san.rb +11 -3
- metadata +1 -1
data/lib/form_san.rb
CHANGED
@@ -43,10 +43,18 @@ module FormSan
|
|
43
43
|
|
44
44
|
@template.content_tag(:div, :class => classes) do
|
45
45
|
@template.concat(@template.content_tag(:div, :class => 'label') do
|
46
|
-
|
46
|
+
label_text = args.first || attribute.to_s.humanize
|
47
|
+
label_text << ' <span>(optional)</span>' if options.delete(:optional)
|
48
|
+
@template.concat self.label(attribute, label_text)
|
47
49
|
end)
|
48
|
-
|
49
|
-
|
50
|
+
|
51
|
+
case input_type = options.delete(:type).to_s
|
52
|
+
when 'textarea'
|
53
|
+
@template.concat ActionView::Helpers::InstanceTag.new(@object_name, attribute, self, @object).to_text_area_tag(options)
|
54
|
+
else
|
55
|
+
@template.concat ActionView::Helpers::InstanceTag.new(@object_name, attribute, self, @object).to_input_field_tag(input_type, options)
|
56
|
+
end
|
57
|
+
|
50
58
|
@template.concat error_message(attribute)
|
51
59
|
@template.concat extra_content unless extra_content.blank?
|
52
60
|
@template.output_buffer # The block needs to return the current buffer
|