gov_uk_date_fields 1.0.3 → 1.0.4

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: d76415df088fe52edcf253fcc668b728dc59cb9c
4
- data.tar.gz: d70c36439edf22501a1d2ba151384c33d8988a79
3
+ metadata.gz: 2e002365d94c5556f99089cf351e5cba2fa5a3e2
4
+ data.tar.gz: c301e294c044baa1ca8cb3590658c8ff55149ddb
5
5
  SHA512:
6
- metadata.gz: f94c08662f9f987553f5dafb31384b1e4d23fe4263c632996bb7706cf4a9a4bc46484521270466f8612d318d36bd45a8a50453b28820dd1afef1ca77c1d86193
7
- data.tar.gz: 1eb9dbc84c096d5cc2f8127ebd45a1e93dd26ee6e0eb95f7a01b51a780c062d91de4b019448be2b5f784e787fb2760a9d57c615568d5ffeb42fdc26937579371
6
+ metadata.gz: 6469764932adab92067b30a383f84e21e526f2e83c451558f2e7b99cc17be50f1a97c3e1eacf8f3bf856e1974e344714cefd70228fdd09c435901fb892b23b1f
7
+ data.tar.gz: 0e6e7132eaadece9234e77210405f9dafb8a009ae54fc9ea00be6648cfab553c4a61112b882eb3062a5da41d5bf4271c2f8d273636f8b224d950063c6f899a33
@@ -65,6 +65,7 @@ module GovUkDateFields
65
65
  #{generate_fieldset_tag}
66
66
  #{generate_legend_tag}#{@options[:legend_text]}</legend>
67
67
  <div class="form-date">
68
+ #{generate_error_message}
68
69
  <p class="form-hint" id="#{@attribute}-hint">#{@form_hint_text}</p>
69
70
  |
70
71
  end
@@ -88,6 +89,17 @@ module GovUkDateFields
88
89
  end
89
90
  end
90
91
 
92
+ def generate_error_message
93
+ result = ''
94
+ if error_for_attr?
95
+ result = "<ul>"
96
+ @object.errors[@attribute].each do |message|
97
+ result += %Q|<li><span class="error-message">#{message}</span></li>|
98
+ end
99
+ result ++ "</ul>"
100
+ end
101
+ end
102
+
91
103
  def generate_day_value
92
104
  %Q|value="#{@day_value}"|
93
105
  end
@@ -1,3 +1,3 @@
1
1
  module GovUkDateFields
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -2,5 +2,4 @@ class Employee < ActiveRecord::Base
2
2
 
3
3
  acts_as_gov_uk_date :dob, :joined
4
4
 
5
-
6
5
  end