@@ -44,37 +44,39 @@ def consent_status_tag(consent)
44
44
vaccine_method =
45
45
if consent . vaccine_methods . present? &&
46
46
consent . programme . has_multiple_vaccine_methods?
47
- tag . span (
48
- Vaccine . human_enum_name ( :method , consent . vaccine_methods . first ) ,
49
- class : "nhsuk-u-secondary-text-colour"
50
- )
47
+ Vaccine . human_enum_name ( :method , consent . vaccine_methods . first )
51
48
end
52
49
53
50
# We can’t use the colour param as NHS.UK frontend uses different colour
54
51
# names (aqua-green) than those supported by GOV.UK Frontend (turquoise)
55
- if consent . invalidated?
56
- safe_join (
57
- [
58
- govuk_tag ( text : tag . s ( text ) , classes : "nhsuk-tag--#{ colour } " ) ,
59
- vaccine_method ,
60
- tag . span ( "Invalid" , class : "nhsuk-u-secondary-text-colour" )
61
- ] . compact
62
- )
63
- elsif consent . withdrawn?
64
- safe_join (
65
- [
66
- govuk_tag ( text : tag . s ( text ) , classes : "nhsuk-tag--#{ colour } " ) ,
67
- vaccine_method ,
68
- tag . span ( "Withdrawn" , class : "nhsuk-u-secondary-text-colour" )
69
- ] . compact
70
- )
52
+ if consent . invalidated? || consent . withdrawn?
53
+ primary_tag =
54
+ govuk_tag ( text : tag . s ( text ) , classes : "nhsuk-tag--#{ colour } " )
55
+
56
+ secondary_text =
57
+ tag . span ( class : "nhsuk-u-secondary-text-colour" ) do
58
+ safe_join (
59
+ [
60
+ ( tag . s ( vaccine_method ) if vaccine_method ) ,
61
+ if consent . invalidated?
62
+ tag . span ( "Invalid" )
63
+ else
64
+ tag . span ( "Withdrawn" )
65
+ end
66
+ ] . compact ,
67
+ " "
68
+ )
69
+ end
70
+
71
+ safe_join ( [ primary_tag , secondary_text ] )
71
72
else
72
- safe_join (
73
- [
74
- govuk_tag ( text :, classes : "nhsuk-tag--#{ colour } " ) ,
75
- vaccine_method
76
- ] . compact
77
- )
73
+ primary_tag = govuk_tag ( text :, classes : "nhsuk-tag--#{ colour } " )
74
+ secondary_text =
75
+ if vaccine_method
76
+ tag . span ( vaccine_method , class : "nhsuk-u-secondary-text-colour" )
77
+ end
78
+
79
+ safe_join ( [ primary_tag , secondary_text ] . compact )
78
80
end
79
81
end
80
82
end
0 commit comments