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

Render world locations #3337

Merged
merged 8 commits into from
Aug 7, 2023
Merged

Render world locations #3337

merged 8 commits into from
Aug 7, 2023

Conversation

jkempster34
Copy link
Contributor

@jkempster34 jkempster34 commented Jul 25, 2023

https://trello.com/c/ii6IgWnk

This is part of the work to move rendering away from Whitehall

Differences for the user compared to Whitehall

  1. The total number of results is now displayed at the top of the page to match the /government/organisations page.
  2. The "No world locations match that filter." message is removed because of the above.
  3. Search behaviour now matches the /government/organisations page. Previously a multi-word search such as "uk p" would match all locations that contained those letters in individual words, now they must be in order.
  4. The big number remains big when the viewport is mobile-sized. This is also the same as the /government/organisations page

Screenshots

PRODUCTION THIS PR
image image
image image
image image
image image

Commits

Add locales for world locations

This adds the necessary locales to render the /world page.

Add world location index to the README

The README contains a list of live examples. Now that the world index page is
soon to be rendered by Collections, we can add it in.

Rename organisation list filter module

We are going to make this module more generic, this renames it so that we can
see the changes more easily when it's modified.

Make organisation list filtering JavaScript more generic

Before this JavaScript was moved from Whitehall to Collections, it was shared
between the /world page and the /government/organisations page. However,
since being moved it has been made specific to the /government/organisations
page.

Now that we are also moving the /world page to Collections, we want to make
this module more generic so that it can be shared again.

This also removes data-filter-list as it is unused.

Render a basic world index page

Render a basic page for /world including the title and additional links.

Render world locations on the world index page

The world index page displays a list of world locations sorted by letter. These
are already sorted alphabetically in the content item, so we only need to group
them.

Render international delegations on the world index page

The world index page displays a list of international delegations. These
are already sorted alphabetically in the content item.

Add JavaScript filter to world index

The world index page contains a JavaScript based search. We want to use the
list-filter module for this.

As the world locations on the page are grouped into letters, we need to add the
concept of an inner-block that can be hidden when no results are present.

Searches checked

/government/organisations

  1. a
  2. ab
  3. Prime Minister's Office, 10 Downing Street
  4. number 10
  5. ago

/world

  1. a
  2. a
  3. ab
  4. bonaire-st-eustatius-saba
  5. Bonaire/St Eustatius/Saba
  6. uk p

⚠️ 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 collections-pr-3337 July 25, 2023 12:45 Inactive
@govuk-ci govuk-ci temporarily deployed to collections-pr-3337 July 25, 2023 12:47 Inactive
@govuk-ci govuk-ci temporarily deployed to collections-pr-3337 July 25, 2023 19:35 Inactive
@govuk-ci govuk-ci temporarily deployed to collections-pr-3337 July 25, 2023 19:51 Inactive
@govuk-ci govuk-ci temporarily deployed to collections-pr-3337 July 26, 2023 08:56 Inactive
Copy link
Member

@brucebolt brucebolt 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 to me (from a backend perspective). Just a small question on whether we can remove the JSON fixture file.

I'd suggest getting a frontend dev in the owning team to look at the JavaScript and CSS too.

spec/presenters/world_index_presenter_spec.rb Outdated Show resolved Hide resolved
@govuk-ci govuk-ci temporarily deployed to collections-pr-3337 July 26, 2023 10:39 Inactive
jkempster34 added a commit to alphagov/whitehall that referenced this pull request Jul 26, 2023
We have added the rendering of the world index page to Collections
(alphagov/collections#3337), and can now switch the rendering over.
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.

Thanks for taking the time to give such a great PR description. I've made a few comments on the Ruby code.

app/assets/javascripts/application.js Show resolved Hide resolved
app/presenters/world_index_presenter.rb Show resolved Hide resolved
app/controllers/world_controller.rb Show resolved Hide resolved
app/views/world/index.html.erb Outdated Show resolved Hide resolved
spec/features/world_index_spec.rb Outdated Show resolved Hide resolved
app/presenters/world_index_presenter.rb Show resolved Hide resolved
app/presenters/world_index_presenter.rb Show resolved Hide resolved
app/views/world/index.html.erb Outdated Show resolved Hide resolved
@jkempster34 jkempster34 force-pushed the render-world-locations branch 3 times, most recently from 1ec336f to b9e1810 Compare August 2, 2023 16:21
@jkempster34
Copy link
Contributor Author

Thanks for taking the time to give such a great PR description. I've made a few comments on the Ruby code.

Thanks for the thorough review 🙌 I've addressed most points, but left a few questions as well

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 great to me! I know @hannalaakso was wanting to review the javascript

@patrickpatrickpatrick
Copy link
Contributor

Javascript looks good to me, very nice consolidation of the search terms in the presenter meaning we can generalise the filter script.

This adds the necessary locales to render the `/world` page.
The README contains a list of live examples. Now that the world index page is
soon to be rendered by Collections, we can add it in.
We are going to make this module more generic, this renames it so that we can
see the changes more easily when it's modified.
Before this JavaScript was moved from Whitehall to Collections, it was shared
between the `/world` page and the `/government/organisations` page. However,
since being moved it has been made specific to the `/government/organisations`
page.

Now that we are also moving the `/world` page to Collections, we want to make
this module more generic so that it can be shared again.

This also removes `data-filter-list` as it is unused.
Render a basic page for `/world` including the title and additional links.
The world index page displays a list of world locations sorted by letter. These
are already sorted alphabetically in the content item, so we only need to group
them.
The world index page displays a list of international delegations. These
are already sorted alphabetically in the content item.
The world index page contains a JavaScript based search. We want to use the
`list-filter` module for this.

As the world locations on the page are grouped into letters, we need to add the
concept of an `inner-block` that can be hidden when no results are present.
@jkempster34 jkempster34 merged commit 79af691 into main Aug 7, 2023
9 checks passed
@jkempster34 jkempster34 deleted the render-world-locations branch August 7, 2023 12:47
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