form_errors 0.0.1 → 1.0.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: e7755c59d4cfab35a062714900bcebac57e2d575
4
- data.tar.gz: d44605615a5c91e7f6eaef36f46e84840c72139c
3
+ metadata.gz: d5a6eb2baccd0c589befc6fb69b6a0a116b50d89
4
+ data.tar.gz: c854e8f60b28a5c3c04677c511871598be5f3fb1
5
5
  SHA512:
6
- metadata.gz: a4f7db81e1d3b5460130073c58743b4b326d0b58b33012012ee941bac64d3b04d3f200eb6291a4010f2e782fd247de02e1a0b52e8555c1fc2374a92f0c604a15
7
- data.tar.gz: f765ac6c33a50c81a7c96243e5beb8c282adb36f561bb573c973ca4fe7edfc40f757b8994c5fd54c7a3af2ac8ea1b703b728003f3f43f1596c3e58e564ebbde1
6
+ metadata.gz: 4fa0b65fa6b571b826689eeb55add741afa6d02a9ce664febceb080d31ed2e900ce56533ec27940c388adefb8698c466fb1f8401b8838c6f01f1fcd0db9257e5
7
+ data.tar.gz: 65bc8f7b869ba024c56a1b60053b057743bcaa28ad68c7c282e76c6f230abdcc4ca46c4d1578c50f70e884be64dc0294ce4aea79d313912feb2c1b7bb956ff5c
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 TODO: Write your name
1
+ Copyright (c) 2014-2015 John Otander
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # FormErrors
1
+ # Form Errors
2
2
 
3
3
  Clean up form error reporting in Rails with a nice little view helper.
4
4
 
@@ -6,15 +6,21 @@ Clean up form error reporting in Rails with a nice little view helper.
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'form_errors'
9
+ ```ruby
10
+ gem 'form_errors'
11
+ ```
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ ```
16
+ $ bundle
17
+ ```
14
18
 
15
19
  Or install it yourself as:
16
20
 
17
- $ gem install form_errors
21
+ ```
22
+ $ gem install form_errors
23
+ ```
18
24
 
19
25
  ## Usage
20
26
 
@@ -51,6 +57,14 @@ The helper applies the `alert`, `alert-danger`, and `alert-dismissable` classes
51
57
  </div>
52
58
  ```
53
59
 
60
+ The `h2` message defaults to:
61
+
62
+ ```ruby
63
+ "#{ pluralize(object.errors.count, "error") } "\
64
+ "prohibited this #{ object.class.name.underscore.humanize.downcase } "\
65
+ "from being saved"
66
+ ```
67
+
54
68
  ## Contributing
55
69
 
56
70
  1. Fork it ( http://github.com/johnotander/form_errors/fork )
@@ -1,3 +1,3 @@
1
1
  module FormErrors
2
- VERSION = "0.0.1"
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,17 +1,17 @@
1
1
  module FormErrors
2
2
  module ViewHelpers
3
- def display_errors(object, error_string = nil)
3
+ def display_errors(object, error_string = nil, html = {})
4
4
  return unless object && object.errors.any?
5
5
 
6
6
  <<-HTML
7
7
  <div class="alert alert-danger alert-dismissable">
8
8
  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
9
- <h2>
9
+ <h2 class="#{ html.error_string_class }">
10
10
  #{ get_error_string(error_string, object) }
11
11
  </h2>
12
- <ul>
12
+ <ul class="#{ html.error_list_class }">
13
13
  #{ object.errors.full_messages.map do |msg|
14
- "<li>#{ msg }</li>"
14
+ "<li class=\"#{ html.error_list_item_class }\">#{ msg }</li>"
15
15
  end.join }
16
16
  </ul>
17
17
  </div>
@@ -23,8 +23,8 @@ module FormErrors
23
23
 
24
24
  def get_error_string(error_string, object)
25
25
  error_string || "#{ pluralize(object.errors.count, "error") } "\
26
- "prohibited this #{ object.class.name.underscore.humanize.downcase }"\
27
- " from being saved"
26
+ "prohibited this #{ object.class.name.underscore.humanize.downcase } "\
27
+ "from being saved"
28
28
  end
29
29
  end
30
30
  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: 0.0.1
4
+ version: 1.0.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: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,8 +76,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.2.2
79
+ rubygems_version: 2.4.3
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: