-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Move case studies routes #4372
Conversation
4b79f76
to
5736b90
Compare
dbc0da6
to
f4d9f5d
Compare
aee5af8
to
6d4592f
Compare
6d4592f
to
40db71b
Compare
40db71b
to
a368c2c
Compare
e8d36b1
to
0d5579a
Compare
0d5579a
to
dc0a31b
Compare
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 |
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.
A bit suspicious of these presentational items being in a model concern, might be better as helpers?
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.
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.
Looking good, a few inline comments to take care of. |
9d14cb0
to
ec46482
Compare
ec46482
to
0a8d897
Compare
0a8d897
to
068dd98
Compare
068dd98
to
6607a9c
Compare
6607a9c
to
1c3cc17
Compare
Commit audit trail: - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/app/presenters/content_item/withdrawable.rb - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/test/presenters/content_item/withdrawable_test.rb
…e studies Commit audit trail: - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/app/presenters/content_item_presenter.rb - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/test/presenters/content_item_presenter_test.rb - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/app/helpers/application_helper.rb - https://github.com/alphagov/government-frontend/blob/a938e4bee78b794e4e5303a1bde1dfd05e94b287/test/helpers/application_helper_test.rb
- To use the Withdrawable concern - To expose first_published_at and first_public_at attributes
Commit audit trail: - https://github.com/alphagov/government-frontend/blob/0aee348d51cebacd5344115f2ca02bdb17095249/app/presenters/case_study_presenter.rb - https://github.com/alphagov/government-frontend/blob/0aee348d51cebacd5344115f2ca02bdb17095249/app/views/content_items/case_study.html.erb - https://github.com/alphagov/government-frontend/blob/0aee348d51cebacd5344115f2ca02bdb17095249/test/integration/case_study_test.rb - https://github.com/alphagov/government-frontend/blob/0aee348d51cebacd5344115f2ca02bdb17095249/test/presenters/case_study_presenter_test.rb - https://github.com/alphagov/government-frontend/blob/0aee348d51cebacd5344115f2ca02bdb17095249/config/routes.rb
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
1c3cc17
to
5d6ac80
Compare
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
Gov-Frontend