Bugzilla – Attachment 60225 Details for
Bug 7626
Delete multiple tags at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7626: Delete multiple tags in OPAC at once
Bug-7626-Delete-multiple-tags-in-OPAC-at-once.patch (text/plain), 5.92 KB, created by
Aleisha Amohia
on 2017-02-15 00:07:19 UTC
(
hide
)
Description:
Bug 7626: Delete multiple tags in OPAC at once
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-02-15 00:07:19 UTC
Size:
5.92 KB
patch
obsolete
>From d44ab1582e37d43601819af62e72d0966b5c00af Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 15 Feb 2017 00:03:28 +0000 >Subject: [PATCH] Bug 7626: Delete multiple tags in OPAC at once > >This patch removes the individual 'Delete' buttons for every tag as >suggested in Comment 0. It adds a checkbox to every tag, with a 'Delete >selected tags' button at the bottom of the table. This patch also adds a >function to check if any checkboxes have been checked before submitting >the form (only works with JS enabled). > >To test: >1) Find a record in the OPAC and add some tags to it >2) Go to your tags and notice the checkboxes, no more delete buttons for >each tag >3) Click 'Delete selected tags' button without selecting any tags >4) Confirm alert shows up. Click OK >5) Select one or more tags and click 'Delete selected tags' button >6) Confirm delete is successful and correct number of deleted tags shows >up > >Sponsored-by: Catalyst IT >--- > .../opac-tmpl/bootstrap/en/modules/opac-tags.tt | 34 +++++++++++++++------- > 1 file changed, 24 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >index 052acd6..4d6a428 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >@@ -105,21 +105,24 @@ > [% END # / TAGLOOP%] > [% IF ( add_op ) %] > [% IF ( added_count ) %] >- <div class="dialog message">[% added_count %] [% IF ( added_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully added.</div> >+ <div class="dialog message">[% added_count %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div> > [% END %] > [% IF ( deleted_count ) %] >- <div class="dialog message">[% deleted_count %][% IF ( deleted_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully deleted.</div> >+ <div class="dialog message">[% deleted_count %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div> > [% END %] > [% END # /add_op %] > > [% IF ( MY_TAGS ) %] >- <form method="post" action="opac-tags.pl"> >+ <form id="deletetags" method="post" action="opac-tags.pl"> > <h2>Your tags</h2> > <table id="mytagst" class="table table-bordered table-striped"> >- <thead><tr><th>Term</th><th>Title</th><th>Date added</th><th>Delete</th></tr></thead> >+ <thead><tr><th> </th><th>Term</th><th>Title</th><th>Date added</th></tr></thead> > <tbody> > [% FOREACH MY_TAG IN MY_TAGS %] > <tr> >+ <td> >+ <input type="checkbox" name="del[% MY_TAG.tag_id %]" value="del[% MY_TAG.tag_id %]"> >+ </td> > <td class="tagterm"> > <span class="tdlabel">Tag:</span> > [% IF MY_TAG.approved == 1 %] >@@ -128,7 +131,6 @@ > [% MY_TAG.term |html %] (not approved) > [% END %] > </td> >- > <td> > [% IF ( MY_TAG.XSLTBloc ) %] > [% MY_TAG.XSLTBloc %] >@@ -153,11 +155,11 @@ > [% MY_TAG.date_created | $KohaDates %] > </span> > </td> >- <td><input type="submit" name="del[% MY_TAG.tag_id %]" value="Delete" class="btn btn-danger btn-mini delete" /></td> > </tr> > [% END %] > </tbody> > </table> >+ <input type="submit" value="Delete selected tags" class="btn btn-danger btn-sm delete"> > </form> > [% END # /MY_TAGS %] > </div> <!-- / .usertags --> >@@ -171,17 +173,29 @@ > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > //<![CDATA[ >+ function checkboxesChecked() { >+ if ($("#deletetags input:checkbox:checked").length > 0) { >+ return 1; >+ } else { >+ return 0; >+ } >+ } > > $(document).ready(function(){ >- var MSG_DELETE_TAG = _("Are you sure you want to delete this tag?"); >- $(".delete").on("click", function(){ >- return confirmDelete(MSG_DELETE_TAG); >+ var MSG_DELETE_TAG = _("Are you sure you want to delete the selected tag(s)?"); >+ $(".delete").on("click", function(e){ >+ if ( checkboxesChecked() == 1 ) { >+ return confirmDelete(MSG_DELETE_TAG); >+ } else { >+ alert(_("Please select a tag to delete.")); >+ e.preventDefault(); >+ } > }); > > $("#mytagst").dataTable($.extend(true, {}, dataTablesDefaults, { > "aaSorting": [[ 2, "asc" ]], > "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false } >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false } > ], > "aoColumns": [ > null, >-- >2.1.4
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 7626
:
7949
|
60225
|
60294
|
60310