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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a5fd01c234220ad2a9ebfce3febd09612fb2a73
4
- data.tar.gz: ff935a9ddaee7797c4cc2a3b4ebac75ee35326e7
3
+ metadata.gz: 321321a1ae10ad01a717ab40e831b8ae6a580f8c
4
+ data.tar.gz: c6d03303c59e7b15441fbc185e33f72a146f2222
5
5
  SHA512:
6
- metadata.gz: 3a70cb7fd1f901a2351e41928a8be078064e356b4044f220e56013d9b2482e57f624897616a8128fac5c03eb032a96adfb68d7e0b8503c39377b2d1e0b3f8008
7
- data.tar.gz: 5ebc76532fd7c003159ef4c4f79e310b004adf27b0571d638233c66de05f280ded7028b429345d419dd2816e52fa63631bfb0c268e846c6459fd0eba54d6de98
6
+ metadata.gz: 158f02e7da7fcbd2ae8e2e9a03006a077cfac2695cd6e5473fbae80de9545835025a7843844857d39f1ca1b649a6af0ded1b419c31f063e3bd0eff5f351fc9a1
7
+ data.tar.gz: 538cf9c3722ddaffd700a74635b2dc2ab92f4ec86bf3352507fe31f27d5bdb40d44b5d648bc6d26537cae91a8fe029ea03a2bd9b1d375bff576401e136e0aa1a
@@ -1,3 +1,3 @@
1
1
  module FormErrors
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -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
- def get_error_string(error_string, object)
25
- error_string || "#{ pluralize(object.errors.count, "error") } "\
26
- "prohibited this #{ object.class.name.underscore.humanize.downcase } "\
27
- "from being saved"
28
- end
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.1
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-08-25 00:00:00.000000000 Z
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.3
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: