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.
Files changed (2) hide show
  1. data/lib/form_san.rb +11 -3
  2. 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
- @template.concat self.label(attribute, *args)
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
- @template.concat ActionView::Helpers::InstanceTag.new(@object_name,
49
- attribute, self, @object).to_input_field_tag(options.delete(:type), options)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Fingertips-form-san
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra