rails-angulate 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcb4962532ac0cafd799575cf926491cd8d56cb
|
4
|
+
data.tar.gz: b0c5a57ff8b21c43ed22de79aa96beabdd7d64a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8658c6365dff8c50b9f17a023a36ea78d6a46ec2ee5f93febb2dde04cd908ec992ab41e522f36d9a2123e7bb3dc6650dd15c49dd52977439db3790e079245af
|
7
|
+
data.tar.gz: 8dae40660d82128ad8db8fb7e8ea7bcf9e6ff62aa9e66570d51bc5214a40f3119dcbda67318df728ee5970e1db2c84c4fd40a2fae888886c8d5b346da101be42
|
@@ -8,7 +8,7 @@ module Rails
|
|
8
8
|
def render
|
9
9
|
# We can't use content_tag with a block (no self.output_buffer)
|
10
10
|
# so we pass in content
|
11
|
-
container(error_list_html) unless validators.empty?
|
11
|
+
container(error_list_html) unless validators.empty? && !has_optional_validators?
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -22,12 +22,32 @@ module Rails
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def error_list_html
|
25
|
-
|
25
|
+
html = ''
|
26
|
+
|
27
|
+
html << validators.map do |validator|
|
26
28
|
mapper = validator_mapper_for(validator)
|
27
29
|
mapper.error_messages.map do |error_type, msg|
|
28
30
|
content_tag :li, msg, 'ng-show' => "#{form_field_object_name}.$error.#{error_type}"
|
29
31
|
end.join
|
30
|
-
end.join
|
32
|
+
end.join
|
33
|
+
|
34
|
+
html << (extra_validators || '')
|
35
|
+
html.html_safe
|
36
|
+
end
|
37
|
+
|
38
|
+
def extra_validators
|
39
|
+
options.inject('') do |html, (k, v)|
|
40
|
+
k = k.to_s
|
41
|
+
html << if k.start_with?('$')
|
42
|
+
content_tag(:li, v, 'ng-show' => "#{form_field_object_name}.$error.#{k[1..-1]}")
|
43
|
+
else
|
44
|
+
''
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def has_optional_validators?
|
50
|
+
options.keys.any? { |k| k.to_s.start_with?('$') }
|
31
51
|
end
|
32
52
|
|
33
53
|
def container_attrs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-angulate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Bondi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|