semantic_form_for 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,6 +56,24 @@ class SemanticFormFor::FormBuilder < ActionView::Helpers::FormBuilder
56
56
  end
57
57
  end
58
58
 
59
+ def errors(message = nil, &block)
60
+ if object.errors.any?
61
+ template.capture_haml do
62
+ template.haml_tag(:div, :class => 'errors') do
63
+ template.haml_tag(:p, message) unless message.blank?
64
+ template.haml_tag(:ul) do
65
+ self.object.errors.each do |attribute, message|
66
+ template.haml_tag :li, case block_given?
67
+ when true then yield(attribute, message)
68
+ else [ attribute, message ].join(' ')
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+
59
77
  private
60
78
 
61
79
  def _object_name
@@ -1,3 +1,3 @@
1
1
  module SemanticFormFor
2
- VERSION = '0.0.3'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephen Touset
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-29 00:00:00 -04:00
17
+ date: 2010-11-01 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency