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

Display content lists on publications irrespective off h2 count #3361

Conversation

CodeSonia
Copy link
Contributor

@CodeSonia CodeSonia commented Oct 11, 2024

What

Trello card

This PR addresses the issue regarding the visibility of content lists. Previously, content lists were hidden if there were fewer than 2 H2s, resulting in empty spaces that negatively impacted the visual layout of publications that use Content Lists.

Key changes include:

  • Updated show_contents_list? method:

    • The method in contents_list.rb has been revised to ensure that content lists are displayed whenever items are present. This simplifies the logic by removing the previous conditions.
  • Revised integration tests:

    • Integration tests that call upon Contents Lists have been updated to remove unnecessary checks of rendering a content list item based on number of items. The tests now check that a content list appears if any items are present, which aligns with the updated logic.
  • Refactored document collection tests:

    • Added and amended test cases in document collections to reflect the adjusted behaviour. The focus shifts to check whether document collection groups contain any documents, rather than the number of H2s in other document types. The key thing here is what is considered as a content item that differs from the content list presenter, as it has been tailored for document collections.
Before After Preview link
image image https://government-frontend-pr-3361.herokuapp.com/government/publications/dvsa-earned-recognition-it-or-software-you-need/vehicle-operator-it-systems-and-software-that-work-with-dvsa-earned-recognition

@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 11, 2024 09:51 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 11, 2024 10:58 Inactive
@hannako hannako force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from bb4e984 to 872a756 Compare October 14, 2024 13:26
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 14, 2024 13:26 Inactive
@hannako hannako force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 872a756 to 006201a Compare October 14, 2024 13:28
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 14, 2024 13:28 Inactive
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.

Happy to pair on this Sonia! But thought I'd type it out so you can work through it in your own time if you prefer.

app/presenters/content_item/contents_list.rb Show resolved Hide resolved
test/integration/specialist_document_test.rb Show resolved Hide resolved
test/integration/working_group_test.rb Show resolved Hide resolved
test/presenters/content_item/contents_list_test.rb Outdated Show resolved Hide resolved
@CodeSonia
Copy link
Contributor Author

Happy to pair on this Sonia! But thought I'd type it out so you can work through it in your own time if you prefer.

Thanks Jess, this is great! I'll have a look and make a start 👀

@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 006201a to 0a9bcb4 Compare October 16, 2024 10:17
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 16, 2024 10:17 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 16, 2024 10:18 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 16, 2024 15:31 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 561ec2b to a392585 Compare October 16, 2024 15:43
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 16, 2024 15:43 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from a392585 to 533077a Compare October 16, 2024 16:05
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 16, 2024 16:05 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 18, 2024 10:13 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from e1a2c6c to 5922a2e Compare October 18, 2024 10:59
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 18, 2024 11:00 Inactive
@hannako hannako force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 5922a2e to 569e28c Compare October 18, 2024 11:28
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 18, 2024 11:28 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 569e28c to 755e4e5 Compare October 24, 2024 11:29
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 24, 2024 11:29 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 755e4e5 to 569e28c Compare October 24, 2024 11:32
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 24, 2024 11:32 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 569e28c to 7c42a6f Compare October 24, 2024 11:34
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 24, 2024 11:34 Inactive
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 24, 2024 13:26 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 43d6cfd to 1e8bc9b Compare October 30, 2024 16:44
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 October 30, 2024 16:44 Inactive
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 1e8bc9b to fd47185 Compare November 4, 2024 15:11
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 November 4, 2024 15:13 Inactive
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.

Thank you Sonia! I've requested a few tiny tweaks to the tests descriptions but then I think we'll good to merge 😅

Please could you update the PR description with the review app working to show you've fixed the original bug, and some before and after shots.

I will draft a refactor card to follow up this work, as there's some complicated code that I think is only being used for working groups

test/integration/document_collection_test.rb Outdated Show resolved Hide resolved
test/integration/document_collection_test.rb Outdated Show resolved Hide resolved
test/integration/document_collection_test.rb Show resolved Hide resolved
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from fd47185 to 6e29ad4 Compare November 4, 2024 16:13
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 November 4, 2024 16:13 Inactive
@CodeSonia
Copy link
Contributor Author

Thank you Sonia! I've requested a few tiny tweaks to the tests descriptions but then I think we'll good to merge 😅

Please could you update the PR description with the review app working to show you've fixed the original bug, and some before and after shots.

I will draft a refactor card to follow up this work, as there's some complicated code that I think is only being used for working groups

Thank you Sonia! I've requested a few tiny tweaks to the tests descriptions but then I think we'll good to merge 😅

Please could you update the PR description with the review app working to show you've fixed the original bug, and some before and after shots.

I will draft a refactor card to follow up this work, as there's some complicated code that I think is only being used for working groups

Yayy perfect! I'll get the PR ready now!

Ooo good spot for the working groups one

- Updated the show_contents_list? method in contents_list.rb to ensure that the contents are displayed whenever items are present. This simplifies the logic by removing the condition that checked for more than two items.

- Revised the integration tests related to the content list, removing unnecessary tests that required three or more items to render, as these are no longer relevant. Tests now ensure check whether a content list appears if any items are present, rather than based on the number of items.

- Refactored the document collection tests to better reflect their behaviour, focusing on the number of document collection groups that contain documents as the behaviour is adjusted for document collections.
@CodeSonia CodeSonia force-pushed the display-content-lists-on-publications-irrespective-off-h2-count branch from 6e29ad4 to 0887aee Compare November 4, 2024 16:39
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3361 November 4, 2024 16:40 Inactive
@CodeSonia CodeSonia marked this pull request as ready for review November 4, 2024 17:12
@CodeSonia CodeSonia merged commit 0aee348 into main Nov 5, 2024
11 checks passed
@CodeSonia CodeSonia deleted the display-content-lists-on-publications-irrespective-off-h2-count branch November 5, 2024 13:44
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.

3 participants