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 case studies routes #4372

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

Move case studies routes #4372

wants to merge 11 commits into from

Conversation

georges1996
Copy link
Contributor

@georges1996 georges1996 commented Nov 4, 2024

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

This PR #4379 needs to be merged in and this will need to be rebased to fix the case studies which have translations e.g https://www.gov.uk/government/case-studies/doing-business-in-spain

What

Handle Case Studies documents in Frontend, in preparation for them being taken out of Government Frontend

Why

Ticket: https://trello.com/c/ybpXwp34/368-move-document-type-casestudy-from-government-frontend-to-frontend

How

By moving the routes and necessary code to get the pages rendering in the frontend application

Screenshots?

Frontend

Screenshot 2024-11-06 at 08 22 40 Screenshot 2024-11-06 at 08 23 02

Gov-Frontend

Screenshot 2024-11-06 at 08 22 34 Screenshot 2024-11-06 at 08 22 54

@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:26 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:28 Inactive
@georges1996 georges1996 changed the title Move case studies documents Move case studies routes Nov 4, 2024
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:38 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:42 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:54 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 20:59 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 21:01 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 21:10 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 21:13 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 21:19 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 4, 2024 21:28 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 07:11 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 07:16 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 07:23 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 12:27 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 12:51 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 13:04 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 5, 2024 13:15 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 6, 2024 08:30 Inactive
@govuk-ci govuk-ci had a problem deploying to govuk-frontend-app-pr-4372 November 6, 2024 08:36 Failure
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 6, 2024 08:46 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4372 November 6, 2024 14:36 Inactive
Comment on lines +27 to +44
def withdrawal_notice_title
"This #{withdrawal_notice_context.downcase} was withdrawn on #{withdrawal_notice_time}".html_safe
end

def withdrawal_notice_context
I18n.t("formats.#{schema_name}", count: 1, locale: :en)
end

def withdrawal_notice_time
ActionController::Base.helpers.tag.time(
english_display_date(withdrawal_notice["withdrawn_at"]),
datetime: withdrawal_notice["withdrawn_at"],
)
end

def english_display_date(timestamp, format = "%-d %B %Y")
I18n.l(Time.zone.parse(timestamp), format:, locale: :en) if timestamp
end
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit suspicious of these presentational items being in a model concern, might be better as helpers?

Copy link
Contributor

Choose a reason for hiding this comment

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

Travel Advice and Guides need to know the withdrawn state too, but I've tackled it a bit differently by splitting out the model and presentational concerns:

model concern: 0dfd811

generic presenter: 0590ed7

travel advice presenter: 53ee7c3

I'm not completely happy with the approach I've taken either, so I think it would be good to have a discussion about this.

@KludgeKML
Copy link
Contributor

Looking good, a few inline comments to take care of.

- To use the Withdrawable concern
- To expose first_published_at and first_public_at attributes
Using govuk-docker-run rake "consolidation:copy_translation[content_item.schema_name.case_study]"
we port over the case_study translations and change it to be under our new yaml structure

Audit trail:
- https://github.com/alphagov/government-frontend/tree/0aee348d51cebacd5344115f2ca02bdb17095249/config/locales
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.

4 participants