Skip to content
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

Move speech document #4573

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Move speech document #4573

wants to merge 16 commits into from

Conversation

sairamya93
Copy link
Contributor

@sairamya93 sairamya93 commented Jan 9, 2025

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

What

To handle the rendering of Speech document type from government_frontend to frontend as part of [RFC 175]

Why

https://trello.com/c/IKDY5W9u/371-move-document-type-speech-from-government-frontend-to-frontend

How

To add a scoped route for, a controller, a model and a view. Here we split up the methods in the original file into presenter, model and its related concerns, with the minimum functionality required to get Speech document working.

Screenshots?

Frontend

Screenshot 2025-01-09 at 10 39 43
Screenshot 2025-01-09 at 10 40 22
Screenshot 2025-01-09 at 10 40 53

Government-Frontend

Screenshot 2025-01-09 at 10 44 31
Screenshot 2025-01-09 at 10 44 56
Screenshot 2025-01-09 at 10 45 59

Metadata

Screenshot 2025-01-22 at 15 02 21

@sairamya93 sairamya93 marked this pull request as draft January 9, 2025 11:25
@sairamya93 sairamya93 force-pushed the move-speech-document branch from 876a571 to 01f9f7e Compare January 9, 2025 14:50
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4573 January 9, 2025 14:51 Inactive
@sairamya93 sairamya93 force-pushed the move-speech-document branch from 01f9f7e to ce2b218 Compare January 9, 2025 16:13
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4573 January 9, 2025 16:14 Inactive
@sairamya93 sairamya93 force-pushed the move-speech-document branch from ce2b218 to c08cd5b Compare January 9, 2025 17:59
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4573 January 9, 2025 18:00 Inactive
@sairamya93 sairamya93 marked this pull request as ready for review January 10, 2025 08:50
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

This is looking great! 🎉 I've added some inline comments, but they're really all quite minor.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't not realise that the document_type and schema for a speech don't necessarily map: https://github.com/alphagov/publishing-api/blob/main/content_schemas/dist/formats/speech/frontend/schema.json#L34-L42

It also explains the need for the oral_statement key. 🤯

I think it's worth explaining this in the commit message.

Copy link
Contributor

Choose a reason for hiding this comment

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

leenagupte
leenagupte previously approved these changes Feb 20, 2025
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

This looks great Ramya!
Thanks for making all of the requested changes.
The commit history and the audit trail are great and easy to follow too. 🥇

@leenagupte leenagupte dismissed their stale review February 20, 2025 15:45

Sorry Ramya! I forgot to mention that you need to add emphasised organisations as one of the contributors.

As you can see from the speech schema it is possible to have emphasised organisations for a speech, and the old linkable presenter would have added them if they exist, so they need to be added here too.

- Added Speech model that includes the related concerns for Speech along with the tests
- Modified Speech model to include the methods to retrieve the important-metadata information that were copied over from Speech Presenter in government-frontend
- Added Speech Presenter and tests to handle the delivery_type of the speech
Commit audit trail - https://github.com/alphagov/government-frontend/blob/122ae292fa540059ee165a94f8129d873c5205d5/app/presenters/speech_presenter.rb
Audit trail for presenter tests - https://github.com/alphagov/government-frontend/blob/122ae292fa540059ee165a94f8129d873c5205d5/test/presenters/speech_presenter_test.rb
- Modified any_updates? method with guard clause
- Added a missing test in Updatable concern

Add missing test for updatable concern
Copied over the View from government-frontend and made appropriate changes
Commit audit trail - https://github.com/alphagov/government-frontend/blob/3c8d12788047ec9ebd5c7f044f4e3f3fce0480ca/app/views/content_items/speech.html.erb

- Updated the context and context_locale to reflect the correct translations
- Modified code to render publisher_metadata
- Modified withdrawn notice code in view
- Modified code to render important-metadata
- Audit trail for important-metadata change: alphagov/government-frontend@b1da197
- Updated the component with /heading appropriate parameters instead of title component
- Removed the check for important_metadata
- Modified code to have important-metadata directly in View instead of in the presenter
 - All the locale keys for Speech are copied over from government-frontend
 - Ran the command : rake "consolidation:copy_translation[speech,formats.speech]"
Audit trail: https://github.com/alphagov/government-frontend/blob/ed44dc0a2dc1cc14174f99bdf6f1ed57f2bfc77a/config/locales
- Ran the command: consolidation:copy_translation[content_item.schema_name.written_statement,formats.written_statement]
Audit trail: https://github.com/alphagov/government-frontend/tree/ed44dc0a2dc1cc14174f99bdf6f1ed57f2bfc77a/config/locales
- To handle the pluralization for Speech in all the locales
Run the command: rake "consolidation:copy_translation[content_item.schema_name.speech,formats.speech]"

Commit audit trail: https://github.com/alphagov/government-frontend/tree/122ae292fa540059ee165a94f8129d873c5205d5/config/locales
- Ran the command: rake "consolidation:copy_translation[content_item.schema_name.oral_statement,formats.oral_statement]"
Audit trail: https://github.com/alphagov/government-frontend/tree/ed44dc0a2dc1cc14174f99bdf6f1ed57f2bfc77a/config/locales
Ran the command : govuk-docker-run rake "consolidation:copy_translation[content_item.schema_name.authored_article,formats.authored_article]"

Audit trail: https://github.com/alphagov/government-frontend/blob/8799336fd3c96dac7c7e53cce3cd8a522beb17da/config/locales/en.yml#L101-L103
Speech document type comprises of all the below:
- speech
- authored_article
- written_statement
- oral_statement
Reference document: https://github.com/alphagov/publishing-api/blob/648bddda06ad1afaeeebe2dc5f6f97da214d14ef/content_schemas/dist/formats/speech/frontend/schema.json#L34-L42
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

Thanks for adding organisations_with_emphasis and people to the contributors. 🎉

There a couple of inline comments.

include Political
include Updatable

def contributors
(organisations_ordered_by_emphasis + [speaker].flatten + [speaker_without_profile].flatten).compact
(organisations_ordered_by_emphasis + people + [speaker].flatten + [speaker_without_profile].flatten).compact.uniq { |contributor| contributor["content_id"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

`{ |contributor| contributor["content_id"] }

What is this block supposed to do?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is speaker or speaker_without_profile an array? If they are, then they don't need to be made into an array by wrapping them in []. If they aren't arrays, then flatten isn't required because the array will only contain one item.

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.

5 participants