Fingertips-form-san 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|