Bugzilla – Attachment 103709 Details for
Bug 25281
Use modal confirmation when deleting a list in the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25281: Use modal confirmation when deleting a list in the OPAC
Bug-25281-Use-modal-confirmation-when-deleting-a-l.patch (text/plain), 8.88 KB, created by
Lucas Gass (lukeg)
on 2020-04-24 22:54:58 UTC
(
hide
)
Description:
Bug 25281: Use modal confirmation when deleting a list in the OPAC
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-04-24 22:54:58 UTC
Size:
8.88 KB
patch
obsolete
>From 7bca509ebe4128d111a1c17a15ef7367fa0291b3 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 24 Apr 2020 18:29:21 +0000 >Subject: [PATCH] Bug 25281: Use modal confirmation when deleting a list in the > OPAC > >This patch modifies the process of deleting a list in the OPAC so that >the deletion confirmation alert is replaced with a Bootstrap modal. > >In the process, I moved the repeated deletion form markup into a block > >To test, apply the patch and log in to the OPAC as a user who has >multiple lists, including some which have been shared with other users. > >Go to the list of your lists and click the "Delete" link next to any of >your lists. It should trigger a confirmation modal: > > - The modal should show the title of the list you're deleting. > - If the list has titles on it, it show how many. > - If the list has been shared with someone it should say so. > >Next, view a list which is not empty. > > - Test the "Delete list" link in the toolbar. > - You should see the same information in the confirmation message as in > the previous step. > >Do the same with a list which is empty. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 64 +++++++++++++++------- > 1 file changed, 44 insertions(+), 20 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 52cf9578cf..37d2b8108f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -8,6 +8,22 @@ > [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %] > [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %] > >+[% BLOCK delete_shelf %] >+ <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="deleteshelf[% shelf.shelfnumber | html %]" class="form-inline"> >+ <input type="hidden" name="op" value="delete" /> >+ <input type="hidden" name="referer" value="list" /> >+ <input type='hidden' name='category' value='[% category | html %]' /> >+ <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" /> >+ <button type="submit" class="btn btn-link remove deleteshelf" data-shelfnumber="[% shelf.shelfnumber | html %]" data-shelfname="[% shelf.shelfname | html %]" data-shared="[% shelf.is_shared | html %]" data-count="[% contents.count | html %]"><i class="fa fa-remove" aria-hidden="true"></i> >+ [% IF ( context == "list" ) %] >+ Delete >+ [% ELSE %] >+ Delete list >+ [% END %] >+ </button> >+ </form> >+[% END %] >+ > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › [% IF op == 'view' %]Contents of [% shelf.shelfname | html %][% ELSE %]Your lists[% END %]</title>[% INCLUDE 'doc-head-close.inc' %] > [% BLOCK cssinclude %][% END %] >@@ -159,6 +175,8 @@ > </h3> > > [% IF ( itemsloop ) %] >+ [% SET contents = shelf.get_contents %] >+ [% IF ( contents.count ) %]<p>This list contains [% contents.count | html %] titles</p>[% END %] > <div id="floating"> > <div id="toolbar" class="toolbar clearfix"> > <div class="list-actions"> >@@ -181,13 +199,8 @@ > <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o"></i> Edit list</button> > </form> > >- <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline"> >- <input type="hidden" name="op" value="delete" /> >- <input type="hidden" name="referer" value="list" /> >- <input type='hidden' name='category' value='[% shelf.category | html %]' /> >- <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" /> >- <button type="submit" class="btn btn-link remove deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"><i class="fa fa-fw fa-remove"></i> Delete list</button> >- </form> >+ [% PROCESS delete_shelf context = "details" %] >+ > [% IF category == PRIVATE && Koha.Preference('OpacAllowSharingPrivateLists') %] > <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | uri %]" class="btn btn-link sharelist"><i class="fa fa-fw fa-share"></i> Share list</a> > [% END %] >@@ -504,12 +517,8 @@ > <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o"></i> Edit list</button> > </form> > >- <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline"> >- <input type="hidden" name="op" value="delete" /> >- <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/> >- <input type="hidden" name="category" value="[% shelf.category | html %]" /> >- <button type="submit" class="btn btn-link remove deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"><i class="fa fa-fw fa-remove"></i> Delete list</button> >- </form> >+ [% PROCESS delete_shelf context = "details" %] >+ > [% END %] > </div> <!-- / .list-actions --> > </div> <!-- / #toolbar --> >@@ -688,13 +697,7 @@ > </form> > [% END %] > [% IF s.can_be_deleted( loggedinusernumber ) %] >- <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline"> >- <input type="hidden" name="op" value="delete" /> >- <input type="hidden" name="referer" value="list" /> >- <input type='hidden' name='category' value='[% category | html %]' /> >- <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" /> >- <button type="submit" class="btn btn-link remove deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"><i class="fa fa-remove"></i> Delete</button> >- </form> >+ [% PROCESS delete_shelf shelf = s context = "list" %] > [% END %] > [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %] > <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber | uri %]" class="sharelist btn btn-link"><i class="fa fa-share"></i> Share</a> >@@ -966,6 +969,27 @@ $(function() { > }); > [% END %] > >+ $(".deleteshelf").on("click", function(e){ >+ e.preventDefault(); >+ var shelf_name = $(this).data("shelfname"); >+ var shelf_number = $(this).data("shelfnumber"); >+ var is_shared = $(this).data("shared"); >+ var count = $(this).data("count"); >+ var message = "<p><i>" + shelf_name + "</i></p>"; >+ if( count ){ >+ message += "<p>" + _("Items on this list:") + " <strong>" + count + "</strong></p>"; >+ } >+ if( is_shared ){ >+ message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>"; >+ } >+ confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){ >+ if( result ){ >+ $("#deleteshelf" + shelf_number ).submit(); >+ } >+ } >+ ); >+ }); >+ > $(".remove_share").on("click", function(e){ > e.preventDefault(); > var shelf_name = $(this).data("shelfname"); >-- >2.11.0
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 25281
:
103704
|
103708
|
103709
|
103715