semantic_form_for 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,7 @@ class SemanticFormFor::FormBuilder < ActionView::Helpers::FormBuilder
33
33
  options = args.extract_options!
34
34
  text = args.shift
35
35
  error = self.object.errors[attribute].try(:join, ', ')
36
+ labeled = text.present? or text.nil?
36
37
 
37
38
  classes = [ input ]
38
39
  classes << 'error' if error.present?
@@ -44,13 +45,15 @@ class SemanticFormFor::FormBuilder < ActionView::Helpers::FormBuilder
44
45
  template.haml_concat super(attribute, options)
45
46
  when :check_box then
46
47
  template.haml_concat super(attribute, options)
47
- template.haml_concat self.label(attribute, text)
48
+ template.haml_concat self.label(attribute, text) if labeled
48
49
  template.haml_tag :span, error if error.present?
49
50
  else
50
- template.haml_concat self.label(attribute, text)
51
+ template.haml_concat self.label(attribute, text) if labeled
51
52
  template.haml_tag :span, error if error.present?
52
53
  template.haml_concat super(attribute, options)
53
54
  end
55
+
56
+ block.call if block
54
57
  end
55
58
  end
56
59
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticFormFor
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: semantic_form_for
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.1
5
+ version: 0.4.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Stephen Touset