Skip to content

Commit 3434765

Browse files
Merge pull request #11358 from alphagov/image-workflow-related
Add `title` to `ImageUsage` [WHIT-3298]
2 parents 81a8195 + 44bf1b4 commit 3434765

14 files changed

Lines changed: 40 additions & 12 deletions

File tree

app/components/admin/edition_images/image_card_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%= render "govuk_publishing_components/components/summary_card", {
22
id: "uploaded_#{image_usage.key}_image_card",
3-
title: image_usage.label&.titleize || image_usage.key.titleize,
43
summary_card_actions: summary_card_actions,
4+
title: image_usage.title.upcase_first,
55
rows: [
66
{
77
key: "Image",

app/components/admin/edition_images/image_upload_component.html.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<%
22
image_kind = image_usage.kinds.first
3+
image_usage_title = image_usage.title.downcase
34

4-
hint_text = ["A #{image_kind.display_name} image must be at least <strong>#{image_kind.valid_width}x#{image_kind.valid_height}</strong>."]
5+
hint_text = ["#{image_usage_title.articleize.upcase_first} must be at least <strong>#{image_kind.valid_width}x#{image_kind.valid_height}</strong>."]
56
unless image_usage.multiple
6-
hint_text << " If you are uploading more than one image, <a class=\"govuk-link\" href=\"https://www.gov.uk/guidance/how-to-publish-on-gov-uk/images-and-videos\">read the image guidance</a> on using unique file names."
7+
hint_text << " If you are uploading more than one #{image_usage_title}, <a class=\"govuk-link\" href=\"https://www.gov.uk/guidance/how-to-publish-on-gov-uk/images-and-videos\">read the image guidance</a> on using unique file names."
78
end
89
%>
910

app/components/admin/edition_images/lead_image_card_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<%= render "govuk_publishing_components/components/summary_card", {
88
id: "uploaded_#{image_usage.key}_image_card",
9-
title: image_usage.label&.titleize || image_usage.key.titleize,
9+
title: image_usage.title.upcase_first,
1010
summary_card_actions: summary_card_actions,
1111
rows: [
1212
{

app/models/configurable_document_types/case_study.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
"caption_enabled": true
100100
},
101101
"lead": {
102-
"label": "lead",
103102
"kinds": ["default"],
104103
"multiple": false,
105104
"caption_enabled": true

app/models/configurable_document_types/government_response.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"caption_enabled": true
116116
},
117117
"lead": {
118-
"label": "lead",
119118
"kinds": ["default"],
120119
"multiple": false,
121120
"caption_enabled": true

app/models/configurable_document_types/news_story.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"caption_enabled": true
116116
},
117117
"lead": {
118-
"label": "lead",
119118
"kinds": ["default"],
120119
"multiple": false,
121120
"caption_enabled": true

app/models/configurable_document_types/press_release.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"caption_enabled": true
116116
},
117117
"lead": {
118-
"label": "lead",
119118
"kinds": ["default"],
120119
"multiple": false,
121120
"caption_enabled": true

app/models/configurable_document_types/topical_event.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
"enabled": true,
182182
"usages": {
183183
"header": {
184-
"label": "header image",
185184
"kinds": ["topical_event_header"],
186185
"multiple": false,
187186
"caption_enabled": true

app/models/configurable_document_types/world_news_story.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
"caption_enabled": true
101101
},
102102
"lead": {
103-
"label": "lead",
104103
"kinds": ["default"],
105104
"multiple": false,
106105
"caption_enabled": true

app/models/image_usage.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ def embeddable?
2121
def lead?
2222
key == "lead"
2323
end
24+
25+
def title
26+
return "image" if embeddable?
27+
28+
label || "#{key} image"
29+
end
2430
end

0 commit comments

Comments
 (0)