Bugzilla – Attachment 182383 Details for
Bug 39891
Use modal for report deletion confirmation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39891: Use modal for report deletion confirmation
Bug-39891-Use-modal-for-report-deletion-confirmati.patch (text/plain), 9.62 KB, created by
Owen Leonard
on 2025-05-13 15:10:29 UTC
(
hide
)
Description:
Bug 39891: Use modal for report deletion confirmation
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-05-13 15:10:29 UTC
Size:
9.62 KB
patch
obsolete
>From 9cc6193c829c914c84211507668240d3d22d4cdf Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 9 Apr 2025 11:10:21 +0000 >Subject: [PATCH] Bug 39891: Use modal for report deletion confirmation > >This patch adds a confirmation modal to be shown when the user clicks >Actions -> Delete from the saved reports page. > >To test, apply the patch and go to Reports -> Saved reports. > >- In the table of reports, pick one and click Actions -> Delete >- A modal window should appear showing information about the report, > including group, subgroup, author, and last run. > - Clicking "Delete" should result in the correct report being deleted. > - Clicking "Cancel," the "X" in the upper right corner of the modal, > or anywhere outside of the modal should close it. >- Test under a different group tab and from a subsequent page in the > DataTable. > >Sponsored-by: Athens County Public Libraries >--- > .../modules/reports/guided_reports_start.tt | 86 +++++++++++++++++-- > 1 file changed, 80 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index 4d4e5f5fbc4..5fc3eee99a0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -416,13 +416,15 @@ > [% IF ( CAN_user_reports_delete_reports ) %] > <li> > <a >- class="dropdown-item submit-form-link" >+ class="dropdown-item delete-report" > href="#" > data-id="[% savedreport.id | html %]" >- data-action="guided_reports.pl" >- data-method="post" >- data-op="cud-delete" >- data-confirmation-msg="[% t('Are you sure you want to delete this report?') | html %]" >+ data-title="[% savedreport.report_name | html %]" >+ data-group="[% savedreport.groupname | html %]" >+ data-subgroup="[% savedreport.subgroupname | html %]" >+ data-notes="[% savedreport.notes | html %]" >+ data-author="[% savedreport.borrowerfirstname | html %] [% savedreport.borrowersurname | html %]" >+ data-lastRun="[% savedreport.last_run | $KohaDates with_hours => 1 %]" > ><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</a > > > </li> >@@ -1695,6 +1697,55 @@ > </div> > <!-- /#runtime_parameters --> > >+[% IF ( savedreports ) %] >+ <div class="modal" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true"> >+ <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="id" id="delete_modal_id" value="" /> >+ <input type="hidden" name="op" value="cud-delete" /> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title" id="deleteModalLabel">Are you sure you want to delete this report?</h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >+ </div> >+ <div class="modal-body"> >+ <h2><div id="delete_modal_title"></div></h2> >+ <div class="rows"> >+ <ol> >+ <li> >+ <span class="label">Group:</span> >+ <span class="delete_modal_info" id="delete_modal_group"></span> >+ </li> >+ <li> >+ <span class="label">Subgroup:</span> >+ <span class="delete_modal_info" id="delete_modal_subgroup"></span> >+ </li> >+ <li> >+ <span class="label">Notes:</span> >+ <span class="delete_modal_info" id="delete_modal_notes"></span> >+ </li> >+ <li> >+ <span class="label">Author:</span> >+ <span class="delete_modal_info" id="delete_modal_author"></span> >+ </li> >+ <li> >+ <span class="label">Last run:</span> >+ <span class="delete_modal_info" id="delete_modal_lastrun"></span> >+ </li> >+ </ol> >+ </div> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-danger"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</button> >+ <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button> >+ </div> >+ </div> >+ </div> >+ </form> >+ </div> >+[% END %] >+ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/charts.js") | $raw %] > [% Asset.js("lib/d3c3/d3.min.js") | $raw %] >@@ -2200,6 +2251,29 @@ > } > }); > >+ $("body").on("click", ".delete-report", function(e){ >+ e.preventDefault(); >+ const report = $(this)[0].dataset; >+ for( const key in report ){ >+ if( report[key] ){ >+ if( key == "id" ){ >+ $("#delete_modal_id").val( report[key] ); >+ } else { >+ $("#delete_modal_" + key ).html( report[key] ).show(); >+ } >+ } else { >+ $("#delete_modal_" + key ).parent().hide(); >+ } >+ } >+ $("#delete_report_id").html("id"); >+ $('#deleteModal').modal('show'); >+ }); >+ >+ $("#deleteModal").on("hidden.bs.modal", function(){ >+ $("#delete_modal_id").val(""); >+ $(".delete_modal_info").html(""); >+ }); >+ > $("body").on("click", ".update_sql", function(e){ > e.preventDefault(); > var ltitle = $(this).text(); >@@ -2611,7 +2685,7 @@ > <a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + reportid + '&op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>\ > <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?op=duplicate&id=' + reportid + '"><i class="fa fa-copy" aria-hidden="true"></i> ' + _("Duplicate") + '</a>\ > <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + reportid + '"><i class="fa-solid fa-clock" aria-hidden="true"></i> ' + _("Schedule") + '</a>\ >- <a class="btn btn-default submit-form-link" href="#" data-id="' + reportid + '" data-action="guided_reports.pl" data-method="post" data-op="cud-delete" data-confirmation-msg="' + _("Are you sure you want to delete this report?") + '"><i class="fa fa-trash-can" aria-hidden="true"></i>' + _("Delete") + '</a>\ >+ <a class="btn btn-default submit-form-link" href="#" data-id="' + reportid + '" data-action="guided_reports.pl" data-method="post" data-op="cud-delete" data-confirmation-msg="' + _("Are you sure you want to delete this report?") + '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + _("Delete") + '</a>\ > <a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + reportid + '&op=run"><i class="fa fa-play" aria-hidden="true"></i> ' + _("Run report") + '</a>\ > <a href="#" id="preview-sql-modal-cancel" data-bs-dismiss="modal" class="btn btn-default"><i class="fa fa-times" aria-hidden="true"></i> ' + _("Close") + '</a>\ > </div>\ >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39891
: 182383