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

Add 'How Government Works' page #2710

Merged
merged 6 commits into from
Mar 14, 2023
Merged

Add 'How Government Works' page #2710

merged 6 commits into from
Mar 14, 2023

Conversation

brucebolt
Copy link
Member

@brucebolt brucebolt commented Mar 9, 2023

This adds the How Government Works page, which is currently rendered by Whitehall.

Whitehall Government Frontend
Screenshot of heading rendered by Whitehall Screenshot of heading rendered by Government Frontend
Screenshot of ministers section rendered by Whitehall Screenshot of ministers section rendered by Government Frontend

Trello card

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

Follow these steps if you are doing a Rails upgrade.

@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 9, 2023 14:47 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 9, 2023 14:48 Inactive
@brucebolt brucebolt force-pushed the add-how-gov-works branch from 59b993b to 84cded9 Compare March 9, 2023 14:55
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 9, 2023 15:02 Inactive
@brucebolt brucebolt force-pushed the add-how-gov-works branch from 84cded9 to e2c27fa Compare March 9, 2023 15:10
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 9, 2023 15:17 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 13, 2023 10:15 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 13, 2023 11:36 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 13, 2023 12:13 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 13, 2023 13:39 Inactive
@brucebolt brucebolt marked this pull request as ready for review March 13, 2023 13:53
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 13, 2023 14:00 Inactive
@JonathanHallam
Copy link
Contributor

Can't leave a comment in the right place! The images could be moved into the "buildings" folder, would mean we could rename the how gov works folder to people. I'm not sure I care that much tbh but it does seem a little odd to have a no.10 pic in a folder other than buildings

Copy link
Contributor

@JonathanHallam JonathanHallam left a comment

Choose a reason for hiding this comment

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

Looking good, thanks :) Could you add a couple of images to the PR description please for the sake of comparison

@brucebolt
Copy link
Member Author

Can't leave a comment in the right place! The images could be moved into the "buildings" folder, would mean we could rename the how gov works folder to people. I'm not sure I care that much tbh but it does seem a little odd to have a no.10 pic in a folder other than buildings

Yeah, I think the whole images directory needs reviewing. I didn't want to put these into buildings are they are nested under history, which isn't really what this page is about.

Looking good, thanks :) Could you add a couple of images to the PR description please for the sake of comparison

Done

Copy link
Contributor

@hannako hannako left a comment

Choose a reason for hiding this comment

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

Looks good Bruce. Just a few minor comments.

config/initializers/inflections.rb Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
app/views/content_items/how_government_works.html.erb Outdated Show resolved Hide resolved
We use the `classify` method to work out the presenter name from the
schema name [1]. By default, Rails singularizes names when turning them
into a class.

This led to us incorrectly looking for the `HowGovernmentWorkPresenter`.

Adding an inflection to tell Rails that this string is the same where
singlular or plural, therefore leading to the correct presenter name
being used.

1: https://github.com/alphagov/government-frontend/blob/e0c26e4d7685994e1def3a19751acc7e49c97ab5/app/services/presenter_builder.rb#L41
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 14, 2023 15:42 Inactive
This will be used to get the relevant pieces of information from the
content item for this page.
These images are included in the page, so need to be added here.

The photograph of Churchill was already present in this repo as it is
already included in another page.
This code has been lifted and shifted almost verbatim from Whitehall
[1].

The only changes that have been made are:
- replacing the Whitehall variable names with those used by Government
  Frontend
- add links where we don't have the helper method available that are
  present in Whitehall
- add missing alt text to images
- replacing a hardcoded '300+' for agencies and other public bodies with
  a dynamic number that rounds down to the hundred (e.g. 480 would be
  400+)
- fixed a typo ("Agencies other public bodies" to "Agencies and other
  public bodies")

Text has not been added to the locale files, since this page is mostly
hardcoded content that is unlikely to be translated.

1: https://github.com/alphagov/whitehall/blob/1838b2e1aaf081165e8664cb9ee31941ac0acb3a/app/views/home/how_government_works.html.erb
The code ported from Whitehall was implementing it's own version of the
big number component, so replacing to use the component instead.
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2710 March 14, 2023 15:59 Inactive
@brucebolt brucebolt merged commit 07368c0 into main Mar 14, 2023
@brucebolt brucebolt deleted the add-how-gov-works branch March 14, 2023 16:45
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