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 document to collection by slug #8254

Merged
merged 10 commits into from
Sep 28, 2023

Conversation

minhngocd
Copy link
Contributor

@minhngocd minhngocd commented Sep 14, 2023

Allowing users to add document to a document collection via searching by title or slug.

Screenshot 2023-09-25 at 14 15 46

If user does not select either of the radio buttons:
Screenshot 2023-09-25 at 14 16 06

So far only "Search by title or slug" works, and takes you to the search page:
Screenshot 2023-09-25 at 14 16 14

If you try to search for a blank search term, you get an alert:
Screenshot 2023-09-25 at 14 16 23

When there are no results:
Screenshot 2023-09-25 at 14 24 28

With results, you get an 'Add' button as discussed within the team, since the button posts data and creates the document within the collection group, hence it is not a link that redirects you to another page like other use cases:
Screenshot 2023-09-25 at 14 24 19

Finally, with an added document:
Screenshot 2023-09-25 at 14 24 46

https://trello.com/c/FmysJ5lP/528-allow-a-user-to-add-a-whitehall-document-from-a-title-or-a-slug

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

Follow these steps if you are doing a Rails upgrade.

@minhngocd minhngocd force-pushed the add-document-to-collection-by-slug branch 6 times, most recently from 1bbd674 to f6585bb Compare September 20, 2023 14:45
@minhngocd minhngocd force-pushed the add-document-to-collection-by-slug branch from b6d0cbd to 3bc9433 Compare September 25, 2023 13:07
@minhngocd minhngocd marked this pull request as ready for review September 25, 2023 13:07
@minhngocd minhngocd force-pushed the add-document-to-collection-by-slug branch 6 times, most recently from 38da916 to bdbdde4 Compare September 25, 2023 15:04
@nnagewad
Copy link
Contributor

Looks great from the screenshots. Be good to connect.

@nnagewad
Copy link
Contributor

Content update. Remove any mention of the term "slug"

  • First two screenshots in PR:

    • Search via title
    • Remove hint text
  • Screenshots 3 to 6 in PR:

    • Remove "or slug" in the label
  • If no results returned

    • "No results found. Search again using the full URL."
      • "full URL" will redirect user to Search via URL page

Attached image reflects content change.
Search via Title

…llections

New route, controller, and view for the new page without any content just yet. Put the content behind a preview design system flag.
Linked Add Document from Document Collection Group documents page so it takes you to search options
NOOP unless user selects option to search via title or slug.
Title or slug redirects to the sceen with a search bar.
Using the scope that is used by the edition filter in the documents search - :with_title_containing to search for live documents containing the query entered by user.
If query is empty then alert the user to enter a search query.
Link the Add button to the existing POST create_whitehall_member in the original document collection group membership controller.
This creates the membership link between the document and the collection group.
Redirect to the documents page if it is new design system.

The 'Add' button is a button rather than a link as discussed within the team and design because it is posting data, and Rails no longer supports links posting data via query params. We are collectively of the opinion that buttons should not be disguised as links, so instead of styling the button to look like a link, we should just use a secondary button.
If no radio button is selected, then set an alert
Deleting document groups and removing documents from groups need to be tracked
@davidtrussler davidtrussler force-pushed the add-document-to-collection-by-slug branch 3 times, most recently from 8d9f9cb to 592b756 Compare September 28, 2023 09:12
}

.govuk-table__cell,
.govuk-table__cell > * {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we set all elements within govuk-table__cell to be vertical-align: middle we won't need the same style to be applied to the govuk-button--secondary element, which may be a little bit more elegant.

@davidtrussler davidtrussler force-pushed the add-document-to-collection-by-slug branch from 592b756 to c2e0233 Compare September 28, 2023 11:49
@davidtrussler davidtrussler merged commit 8c7d8b0 into main Sep 28, 2023
9 checks passed
@davidtrussler davidtrussler deleted the add-document-to-collection-by-slug branch September 28, 2023 13:01
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