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

561 new document sub navigation page #8402

Merged
merged 5 commits into from
Oct 27, 2023

Conversation

RodneyJohnsonGDS
Copy link
Contributor

@RodneyJohnsonGDS RodneyJohnsonGDS commented Oct 23, 2023

Trello: 561 | Link New Document drop down in the sub navigation to new page with radio selection

This PR creates a new view which users will be directed to when they click on the "New document" link in the navigation bar.

Changes:

  • When a user makes a selection on the type of new document they would like to create they are redirected to the correct new document type.
  • When there are no radio buttons selected - they are shown an error and they remain on the New document page - this is to ensure we are not influencing their selection.
  • Tests coverage includes testing the users permission granting only certain users the ability to view this page, functionality re when a user selects a radio button / does not select a button the test ensures they are shown the correct new document page or an error respectively.
  • This PR also includes changes to the routes file and the necessary controller implementations

Screenshot below:

This screenshot is what the user sees when they first land on the landing page:

whitehall-admin dev gov uk_government_admin_new-document (3)


This screenshot is what the user sees when they select Next without selecting a radio button:

whitehall-admin dev gov uk_government_admin_new-document (4)

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

Follow these steps if you are doing a Rails upgrade.

…ely ensuring the New document page renders correctly with the respective radio button options, inset text as well as the next / cancel form buttons.
…e index action as well as the redirecting the user to the correct new document path after they have selected a particular radio button. We have also taken measures to ensure that only users with Preview design system permission will be able to access this page.
…new_document_options routes are implemented here.
@nnagewad
Copy link
Contributor

This looks great 👍🏽

@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 561-new-document-sub-navigation-page branch from fba0bbb to 5c9bb48 Compare October 24, 2023 10:23
…t. Here we are handling multiple radio buttons and ensuring the data is collected by the form correctly.
@farahTW farahTW force-pushed the 561-new-document-sub-navigation-page branch from 5c9bb48 to ffcd7fc Compare October 25, 2023 11:24
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_with url: admin_new_document_options_path do %>
<%= render "govuk_publishing_components/components/radio", {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where we have a bunch of radio controls we should also have a <legend> element inside the <fieldset> which is created as part of the Form radio button component. This could be flagged as an accessibility failure/warning. It can be set via the heading parameter in the component and should ideally use the page title as its value, removing the page title itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accessibility is important - well spotted! Done!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @RodneyJohnsonGDS - the <legend> change is perfect, ta! Only thing is that we still need the <% content_for :page_title, "New document" %> line that has been removed so that the page title appears in the browser tab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@farahTW farahTW left a comment

Choose a reason for hiding this comment

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

Hey @RodneyJohnsonGDS
After refactoring the test controller code wise it looks ok to me.
Just wondering if can squash all commits in to one that will look more neater as all files are related to one component.

selected_option = params.require(:new_document_options).to_sym
redirect_to redirect_options[selected_option]
else
redirect_to admin_new_document_path, alert: "Please select a new document option"
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than using the alert here we should be using the error component, which is more consistent with what we have done elsewhere and more closely follows the design.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback David! As discussed we will pick up how we handle errors across the codebase as a separate user story. For the time being, we'll keep implementation as is.

@davidtrussler
Copy link
Contributor

@RodneyJohnsonGDS I've left a couple of comments on here about refactoring the page title into a <legend> element and setting up error messages.

@davidtrussler
Copy link
Contributor

Hey @RodneyJohnsonGDS After refactoring the test controller code wise it looks ok to me. Just wondering if can squash all commits in to one that will look more neater as all files are related to one component.

I'd agree with squashing the commits. If we think about it as how it would be read in the context of the overall commit history I think a single commit that says this introduces a new page for selecting a new document would be easier to read and understand.

@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 561-new-document-sub-navigation-page branch from c502138 to 8f9566b Compare October 27, 2023 09:19
…ly improving the accessibility features of the index page as well as ensuring we have a test that handles the redirect of all the radio buttons.
@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 561-new-document-sub-navigation-page branch from 8f9566b to bd6ee86 Compare October 27, 2023 14:27
Copy link
Contributor

@davidtrussler davidtrussler left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@RodneyJohnsonGDS RodneyJohnsonGDS merged commit 7b6ca29 into main Oct 27, 2023
15 checks passed
@RodneyJohnsonGDS RodneyJohnsonGDS deleted the 561-new-document-sub-navigation-page branch October 27, 2023 15:51
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