-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use rummager results for image_urls #1042
Conversation
alt: document_image["alt_text"], | ||
context: document_image["context"] | ||
def format_document_data(documents, data_category: nil) | ||
documents.each.with_index(1).map do |document, index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to double check the Ruby API documentation to confirm that 1
is an offset. Could we extract this to provide a little more context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -2,6 +2,8 @@ module Supergroups | |||
class NewsAndCommunications < Supergroup | |||
attr_reader :content | |||
|
|||
PLACEHOLDER_IMAGE = "https://assets.publishing.service.gov.uk/government/assets/placeholder.jpg".freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use Plek to make this environment specific?
PLACEHOLDER_IMAGE = URI::HTTPS.build(host: Plek.current.public_asset_host, path: '/government/assets/placeholder.jpg').freeze
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, thanks. 👍
df45108
to
78a44e0
Compare
We don't need this at present because the image is part of a link. The link text overrides the alt text in this instance so we're not reducing any accessibility. This allows us to use the recently added image_url search field.
This allows us to reuse small bits of functionality
This ensures that our analytics will be consistent between sections.
This eliminates up to three calls to content store for each page's navigation. To do this we need to add image_url to the fields that rummager returns. We then need a default image in case the content doesn't have an image (not all do).
We may want to add Welsh and other translations for these later.
78a44e0
to
74244e7
Compare
We're now only retrieving 3 items per section so we can delete a lot of code from the news_and_communications and services presenters and get them to return an array of results rather than hashes. This allows us to get them to behave a bit more like the other presenters.
74244e7
to
c3554a4
Compare
I've updated this and rebased after a couple of merges. It's worth sticking |
This eliminates up to three calls to content store for each page's navigation.
To do this we need to add image_url to the fields that rummager returns.
We can remove the alt text for images that are links because the link text is more relevant (and is preferred by browsers anyway).
We then need a default image in case the content doesn't have an image (not all do).
After rebasing on top of #1043 and #1032 it became clear that we can remove some things from the
news_and_communications
andservices
as they don't need to have content split intopromoted
andtagged
content any more as they only display it in one form now.I've therefore removed the
promoted
sections from these presenters which allows us to simplify some things and delete a bunch of code.https://government-frontend-pr-1042.herokuapp.com/apply-apprenticeship