Bug 36207 - Update browser alerts to modals: OPAC tags
Summary: Update browser alerts to modals: OPAC tags
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 34478 26824
Blocks: 36166 36557
  Show dependency treegraph
 
Reported: 2024-02-29 18:30 UTC by Owen Leonard
Modified: 2024-07-25 11:15 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This changes the process for removing a tag from a title on a patron's tag list (OPAC > Your account > Tags). It now uses a confirmation dialog box instead of a JavaScript alert. It also makes some minor tweaks to the CSS to correct the style for "Remove tag" links.
Version(s) released in:
24.11.00,24.05.02
Circulation function:


Attachments
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC (15.75 KB, patch)
2024-03-20 18:20 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC (15.80 KB, patch)
2024-03-20 21:43 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC (15.54 KB, patch)
2024-05-06 11:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC (15.61 KB, patch)
2024-06-04 12:20 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36207: (RM follow-up) CSRF correction (2.24 KB, patch)
2024-06-11 15:16 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2024-02-29 18:30:37 UTC
I propose to update the OPAC user tags page so that JavaScript alerts are replaced by modal confirmation dialogs.
Comment 1 Owen Leonard 2024-03-20 18:20:47 UTC
Created attachment 163575 [details] [review]
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC

This patch changes the process of removing a tag from a title on the
user's tag list. It now uses a confirmation modal dialog instead of a
JavaScript alert.

The patch also makes some minor tweaks to CSS to correct style on
"remove" links.

To test, apply the patch and rebuild the OPAC CSS.

 - Log in to the OPAC as a user who has submitted multiple tags or tags
   on multiple items.
  - Open the "Tags" link in the sidebar of the user summary page.
  - Click the "Remove tag" link next to one of the titles in the table
    of the user's tags.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tag from this title?" It should show the
    title and the tag which will be removed.
  - Test both the "Yes, remove tag" and "No, do not remove tag" choices.

  - Check the box next to one of the tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove this item from the list?" It should show the title and
    the tag which will be removed.
  - Test boh the "Yes" and "No" choices.

  - Check the box next to multiple tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tags from these titles" It should show the
    titles of all the records you selected and the corresponding tags to be
    removed.
  - Test both the "Yes" and "No" choices.
Comment 2 Lucas Gass (lukeg) 2024-03-20 21:43:47 UTC
Created attachment 163578 [details] [review]
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC

This patch changes the process of removing a tag from a title on the
user's tag list. It now uses a confirmation modal dialog instead of a
JavaScript alert.

The patch also makes some minor tweaks to CSS to correct style on
"remove" links.

To test, apply the patch and rebuild the OPAC CSS.

 - Log in to the OPAC as a user who has submitted multiple tags or tags
   on multiple items.
  - Open the "Tags" link in the sidebar of the user summary page.
  - Click the "Remove tag" link next to one of the titles in the table
    of the user's tags.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tag from this title?" It should show the
    title and the tag which will be removed.
  - Test both the "Yes, remove tag" and "No, do not remove tag" choices.

  - Check the box next to one of the tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove this item from the list?" It should show the title and
    the tag which will be removed.
  - Test boh the "Yes" and "No" choices.

  - Check the box next to multiple tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tags from these titles" It should show the
    titles of all the records you selected and the corresponding tags to be
    removed.
  - Test both the "Yes" and "No" choices.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Marcel de Rooy 2024-04-12 08:48:56 UTC
-                        <form id="deletetags" method="post" action="opac-tags.pl">
-                            [% INCLUDE 'csrf-token.inc' %]

+                            <form method="post" action="opac-tags.pl">
+                                <table id="mytagst" class="table table-bordered table-striped">

You remove a CSRF token ?
Comment 4 Owen Leonard 2024-04-12 10:38:27 UTC
The actual deletion is now being done in a hidden form:

<form id="deletetags" name="deletetags" method="post" action="/cgi-bin/koha/opac-tags.pl">
    [% INCLUDE 'csrf-token.inc' %]
    <input type="hidden" name="op" value="cud-del" />
</form>
Comment 5 David Nind 2024-05-04 20:47:45 UTC
The patch no longer applies (is a dependency for bug 36166):

git bz apply 36207

Bug 36207 - Convert browser alerts to modals: OPAC tags

163578 - Bug 36207: Use confirmation modal when removing tags from titles in the OPAC

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 36207: Use confirmation modal when removing tags from titles in the OPAC
Using index info to reconstruct a base tree...
M	koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
M	koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
Auto-merging koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
error: Failed to merge in the changes.
Patch failed at 0001 Bug 36207: Use confirmation modal when removing tags from titles in the OPAC
Comment 6 Owen Leonard 2024-05-06 11:09:30 UTC
Created attachment 166212 [details] [review]
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC

This patch changes the process of removing a tag from a title on the
user's tag list. It now uses a confirmation modal dialog instead of a
JavaScript alert.

The patch also makes some minor tweaks to CSS to correct style on
"remove" links.

To test, apply the patch and rebuild the OPAC CSS.

 - Log in to the OPAC as a user who has submitted multiple tags or tags
   on multiple items.
  - Open the "Tags" link in the sidebar of the user summary page.
  - Click the "Remove tag" link next to one of the titles in the table
    of the user's tags.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tag from this title?" It should show the
    title and the tag which will be removed.
  - Test both the "Yes, remove tag" and "No, do not remove tag" choices.

  - Check the box next to one of the tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove this item from the list?" It should show the title and
    the tag which will be removed.
  - Test boh the "Yes" and "No" choices.

  - Check the box next to multiple tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tags from these titles" It should show the
    titles of all the records you selected and the corresponding tags to be
    removed.
  - Test both the "Yes" and "No" choices.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 Martin Renvoize (ashimema) 2024-06-04 12:20:52 UTC
Created attachment 167394 [details] [review]
Bug 36207: Use confirmation modal when removing tags from titles in the OPAC

This patch changes the process of removing a tag from a title on the
user's tag list. It now uses a confirmation modal dialog instead of a
JavaScript alert.

The patch also makes some minor tweaks to CSS to correct style on
"remove" links.

To test, apply the patch and rebuild the OPAC CSS.

 - Log in to the OPAC as a user who has submitted multiple tags or tags
   on multiple items.
  - Open the "Tags" link in the sidebar of the user summary page.
  - Click the "Remove tag" link next to one of the titles in the table
    of the user's tags.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tag from this title?" It should show the
    title and the tag which will be removed.
  - Test both the "Yes, remove tag" and "No, do not remove tag" choices.

  - Check the box next to one of the tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove this item from the list?" It should show the title and
    the tag which will be removed.
  - Test boh the "Yes" and "No" choices.

  - Check the box next to multiple tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tags from these titles" It should show the
    titles of all the records you selected and the corresponding tags to be
    removed.
  - Test both the "Yes" and "No" choices.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize (ashimema) 2024-06-04 12:21:15 UTC
Nice improvement, works as described.

Passing QA
Comment 9 Martin Renvoize (ashimema) 2024-06-11 10:56:22 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 10 Martin Renvoize (ashimema) 2024-06-11 15:16:27 UTC
Created attachment 167639 [details] [review]
Bug 36207: (RM follow-up) CSRF correction

I think there was a rebase issue here where we split the form into two
forms instead of one.  This patch returns us to one form with two
different submit options (one for selected tags and one per tag) that
both trigger the confirmation modal before submitting to the controller.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2024-06-11 15:28:37 UTC
Follow-up confirmed working by Owen and now Pushed by Martin.
Comment 12 Lucas Gass (lukeg) 2024-07-10 16:50:17 UTC
Backported to 24.05.x for upcoming 24.05.02
Comment 13 Fridolin Somers 2024-07-17 14:03:19 UTC
Depends on Bug 34478 not in 23.11.x