midas-ul_form_builder 1.0.2 → 1.0.3
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/History.txt +6 -0
- data/lib/ul_form_builder.rb +1 -1
- data/lib/ul_form_builder/form_builders.rb +12 -2
- metadata +3 -3
data/History.txt
CHANGED
data/lib/ul_form_builder.rb
CHANGED
@@ -27,12 +27,22 @@ module UlFormBuilder
|
|
27
27
|
options.merge! :label => label unless options.has_key?( :label )
|
28
28
|
options.merge!( :class => 'frm-standard' ) unless options.has_key?( :class )
|
29
29
|
label = label( field, options[:label], :class => options.delete( :label_class ) )
|
30
|
-
|
30
|
+
|
31
|
+
field_errors = self.object.errors.on( field.to_sym )
|
32
|
+
|
33
|
+
if field_errors
|
34
|
+
msg = field_errors.is_a?( Array ) ? field_errors.join( ', ' ) : field_errors
|
35
|
+
hint = @template.content_tag( :span, msg, :class => 'note' )
|
36
|
+
elsif self.object.class.respond_to?( :human_attribute_hint )
|
31
37
|
hint = @template.content_tag( :span, self.object.class.human_attribute_hint( field.to_sym ), :class => 'note' )
|
32
38
|
else
|
33
39
|
hint = @template.content_tag( :span, (options[:hint] || ''), :class => 'note' )
|
34
40
|
end
|
35
|
-
|
41
|
+
|
42
|
+
classes = field_errors ? "highlight error" : ""
|
43
|
+
classes << " #{options[:li_class]}" unless options[:li_class].blank?
|
44
|
+
|
45
|
+
@template.content_tag( :li, label + super( field, options ) + hint, :class => classes ) #wrap with an li
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midas-ul_form_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C. Jason Harrelson (midas)
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.3.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rails
|