form_errors 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/form_errors/version.rb +1 -1
- data/lib/form_errors/view_helpers.rb +23 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 321321a1ae10ad01a717ab40e831b8ae6a580f8c
|
4
|
+
data.tar.gz: c6d03303c59e7b15441fbc185e33f72a146f2222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158f02e7da7fcbd2ae8e2e9a03006a077cfac2695cd6e5473fbae80de9545835025a7843844857d39f1ca1b649a6af0ded1b419c31f063e3bd0eff5f351fc9a1
|
7
|
+
data.tar.gz: 538cf9c3722ddaffd700a74635b2dc2ab92f4ec86bf3352507fe31f27d5bdb40d44b5d648bc6d26537cae91a8fe029ea03a2bd9b1d375bff576401e136e0aa1a
|
data/lib/form_errors/version.rb
CHANGED
@@ -19,12 +19,30 @@ module FormErrors
|
|
19
19
|
.html_safe
|
20
20
|
end
|
21
21
|
|
22
|
+
def bass_display_errors(object, error_string = nil, html = {})
|
23
|
+
return unless object && object.errors.any?
|
24
|
+
|
25
|
+
<<-HTML
|
26
|
+
<div class="bold p2 white bg-red">
|
27
|
+
<h2 class="#{ html[:error_string_class] }">
|
28
|
+
#{ get_error_string(error_string, object) }
|
29
|
+
</h2>
|
30
|
+
<ul class="#{ html[:error_list_class] }">
|
31
|
+
#{ object.errors.full_messages.map do |msg|
|
32
|
+
"<li class=\"#{ html[:error_list_item_class] }\">#{ msg }</li>"
|
33
|
+
end.join }
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
HTML
|
37
|
+
.html_safe
|
38
|
+
end
|
39
|
+
|
22
40
|
private
|
23
41
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
42
|
+
def get_error_string(error_string, object)
|
43
|
+
error_string || "#{ pluralize(object.errors.count, "error") } "\
|
44
|
+
"prohibited this #{ object.class.name.underscore.humanize.downcase } "\
|
45
|
+
"from being saved"
|
46
|
+
end
|
29
47
|
end
|
30
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Otander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,9 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.4.
|
79
|
+
rubygems_version: 2.4.5.1
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Clean up form error reporting in Rails with a nice little view helper.
|
83
83
|
test_files: []
|
84
|
-
has_rdoc:
|