Skip to content

Single Upload of Image Kind [WHIT-2857]#10998

Merged
patrickpatrickpatrick merged 2 commits into
mainfrom
single-upload-of-image-kind
Jan 21, 2026
Merged

Single Upload of Image Kind [WHIT-2857]#10998
patrickpatrickpatrick merged 2 commits into
mainfrom
single-upload-of-image-kind

Conversation

@patrickpatrickpatrick
Copy link
Copy Markdown
Contributor

@patrickpatrickpatrick patrickpatrickpatrick commented Jan 14, 2026

What

Support adding single upload of image kinds if specified in the schema for a configurable document.

Technical Details

  • change images_enabled to images object
    • images has enabled attribute to indicate if images are enabled for this document
    • images has permitted_image_kinds attribute to indicate what kinds of image are allowed to be uploaded
      • each image kind has a kind which corresponds to the permitted_uses key in image_kinds.yml and multiple to indicate if multiple uploads are allowed
  • reimplement the edition image partials to conditionally render elements based on image kind
    • display the image kind in the header if it is not of kind default
    • if image supports single upload, don't display form for uploading an image if an image is already uploaded
    • remove the radio button to select image kind (only applicable for landing pages)
  • if one image is uploaded then redirect to the edit view for that uploaded image

Visual Differences

Screenshot 2026-01-21 at 10 35 05 Screenshot 2026-01-21 at 10 35 22

(no visual changes to other document types apart from Landing Page Images which are deemed as not priority to maintain)

Why

Required feature for the configurable Topical Event pages.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the Whitehall Experience team. Please let us know in #govuk-whitehall-experience-tech when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

@patrickpatrickpatrick patrickpatrickpatrick force-pushed the single-upload-of-image-kind branch 17 times, most recently from 62a0df5 to 35d14d6 Compare January 19, 2026 10:41
@ryanb-gds ryanb-gds force-pushed the single-upload-of-image-kind branch from 35d14d6 to bde9caa Compare January 19, 2026 15:15
"kind": "govspeak_embed",
"multiple": true
}
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm loving this as an API 👍

@ryanb-gds ryanb-gds force-pushed the single-upload-of-image-kind branch from 1610c58 to 23953ca Compare January 19, 2026 17:00
@patrickpatrickpatrick patrickpatrickpatrick force-pushed the single-upload-of-image-kind branch 10 times, most recently from a4abfaa to 5480c15 Compare January 20, 2026 15:35
@patrickpatrickpatrick patrickpatrickpatrick force-pushed the single-upload-of-image-kind branch 2 times, most recently from 0a1e43e to d8de361 Compare January 21, 2026 10:31
@patrickpatrickpatrick patrickpatrickpatrick marked this pull request as ready for review January 21, 2026 10:39
Copy link
Copy Markdown
Contributor

@ryanb-gds ryanb-gds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few thoughts from me before somebody else does a proper review

Comment thread app/components/admin/edition_images/image_component.rb Outdated
Comment thread app/components/admin/edition_images/uploaded_images_component.rb Outdated
Comment thread app/controllers/admin/edition_images_controller.rb
end

def lead_image
block_content["image"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an assumption that probably won't make sense soon but I think it's ok for now

Comment thread features/standard-edition-images.feature Outdated
@patrickpatrickpatrick patrickpatrickpatrick force-pushed the single-upload-of-image-kind branch 3 times, most recently from e368a35 to 5a377fb Compare January 21, 2026 11:17
Copy link
Copy Markdown
Contributor

@ryanb-gds ryanb-gds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The `images_enabled` setting in configurable document schema has been
renamed to `images` and is now an object with attributes:

- `enabled` which sets if the document supports images being uploaded
- `permitted_image_kinds` which is a list of the image kinds that can
be uploaded to the document, if image uploading is `enabled` without
this attribute set then by default the document will support
embeddable images

and within `permitted_image_kinds` the image kinds take the format of
an object with the following attributes:

- `multiple` whether or not multiple images of that kind can be uploaded
- `kind` which correlates to the `permitted_image_uses` key within each
image kind
Rework the previous implementation of edition image partials to accept
an image kind as a parameter. If the image kind supports a single upload
then only show the upload form if no image has been uploaded. Otherwise
show the default (unchanged) edition images view.
@patrickpatrickpatrick patrickpatrickpatrick force-pushed the single-upload-of-image-kind branch from 5a377fb to 3c70fed Compare January 21, 2026 13:45
@patrickpatrickpatrick patrickpatrickpatrick merged commit 5cfda0d into main Jan 21, 2026
25 checks passed
@patrickpatrickpatrick patrickpatrickpatrick deleted the single-upload-of-image-kind branch January 21, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants