gov_uk_date_fields 1.0.2 → 1.0.3

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: 07a163ea32d226a6d6701a4bae4e24b91e661e31
4
- data.tar.gz: eefab635e9be48c8f63879b0cc99cfdc5d80f6c8
3
+ metadata.gz: d76415df088fe52edcf253fcc668b728dc59cb9c
4
+ data.tar.gz: d70c36439edf22501a1d2ba151384c33d8988a79
5
5
  SHA512:
6
- metadata.gz: 84d0f929da7981409695faeb61f28ab3d54547c34253b7e16af6e917c83feb3ea3476ef2299264b6126082dd46278486bdea0a6741975deb0d1783376ed1038c
7
- data.tar.gz: ca9c139744901be51e91238f1b856f94b835bc422ca509f10972eac568c4e2beb6479750cf0fa5efb0476cd1edc47ae25c2d4d0876d47947b0ffca1ce72eca63
6
+ metadata.gz: f94c08662f9f987553f5dafb31384b1e4d23fe4263c632996bb7706cf4a9a4bc46484521270466f8612d318d36bd45a8a50453b28820dd1afef1ca77c1d86193
7
+ data.tar.gz: 1eb9dbc84c096d5cc2f8127ebd45a1e93dd26ee6e0eb95f7a01b51a780c062d91de4b019448be2b5f784e787fb2760a9d57c615568d5ffeb42fdc26937579371
@@ -42,7 +42,11 @@ module GovUkDateFields
42
42
  raw_output.html_safe
43
43
  end
44
44
 
45
- private
45
+ private
46
+
47
+ def error_for_attr?
48
+ @object.errors.keys.include?(@attribute)
49
+ end
46
50
 
47
51
  def fieldset_required?
48
52
  @fieldset_required
@@ -66,11 +70,10 @@ module GovUkDateFields
66
70
  end
67
71
 
68
72
  def generate_fieldset_tag
69
- if @fieldset_id.nil?
70
- "<fieldset>"
71
- else
72
- %Q|<fieldset id="#{@fieldset_id}">|
73
- end
73
+ result = "<fieldset"
74
+ result += %Q| id="#{@fieldset_id}"| unless @fieldset_id.nil?
75
+ result += %Q| class="error"| if error_for_attr?
76
+ result ++ ">"
74
77
  end
75
78
 
76
79
  def generate_end_fieldset
@@ -1,3 +1,3 @@
1
1
  module GovUkDateFields
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end