-
Notifications
You must be signed in to change notification settings - Fork 194
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
UI to add a taxonomy topic email override to document collections #7950
Conversation
b9826df
to
74ff206
Compare
64a1a4d
to
4444b2b
Compare
4444b2b
to
cba2303
Compare
bce5500
to
9610fbb
Compare
9610fbb
to
001d361
Compare
1839e3d
to
5c87bcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I look at this code the more I wonder if there should be a model to represent the TopicTaxonomyEmailOverride
, backed by its own database table. I feel the logic is complex enough to justify it, even though the model would only have a few attributes. At the moment all of that logic is distributed across the controller, a presenter and some helpers, which makes it harder to reason about than it would be if it were all in one location. Also, it feels like we're arm-wrestling Rails a bit to make it do validation via flash messages, which to me is a good indication that we're missing a model. What do you think?
test/functional/admin/document_collection_email_subscriptions_controller_test.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having learned that this is intended to be a temporary measure whilst we migrate some specialist topics to document collections, happy for this to be merged
This adds a basic edit and view method.
This will only display when the user has the relevant permission.
- This commit contains a placeholder implementation of the taxonomy topic select, using hardcoded values. It will be replaced in a subsequent commit.
When setting an email override field, a user must select a topic, and check a confirmation box. If they do both of those things, they will be redirected to the document collection edit page. It will only be possible to set and email override on a draft document collection. This restriction will be added in subsequent commit.
Attempting to set an email override field on a document that has already been published will raise a validation error. Update the controller to handle this exception. This error is not shown to the user as a flash, because in the next commit, we make it impossible to access the document collection email subscription edit forms for published document collections.
When a document collection is published, we will not allow the email override field to be edited. Users clicking the email notifications tab for a published document collection will see a summary, instead of the form.
If editing a draft document collection that already has a taxonomy_topic_email value assigned, select the relevant radio button and topic from the drop down when the page loads. If a user doesn't sumbit all the required values, and presses save they are redirected back, and shown an error. We should still retain their previous selections if any were made.
5c87bcd
to
b5a0a78
Compare
- the select-with-search component already exists in this application, and supports grouped items i.e. multiple things in a single row of the select.
b5a0a78
to
88a6f9c
Compare
Contains work done by @BeckaL and @hannako
What
Add a new tab to the document collection edit view, to all publishers (with a special signon permission), to set a taxonomy_topic_email_override field on their document collection.
Example content item created from using this UI on integration to publish a collection:
Why
We (Homepage and Navigation Team) are retiring specialist topic pages i.e. we are redirecting all specialist topics to other pieces of content on GOV.UK and then removing support for specialist topics from the code base. One dept would like their specialist topics redirected to document collections, but they want the email signup button on those document collection pages to behave differently:
How
nil
, which on the frontend will result in the page getting a standard single page notification buttonlinks
.Related PR's upon which this work depends:
Future work
Once this feature has been used by the department to publish their collection pages, we will:
Trello
Follow these steps if you are doing a Rails upgrade.