@@ -, +, @@
list in the OPAC
- Click the "Remove from this list" link under one of the titles.
- You should see a modal confirmation message, "Are you sure you want
to remove this item from the list?" It should show the title of the
item on the list.
- Test both the "Yes" and "No" choices.
- Check the box next to one title on the list, and click the
"Remove from list" link at the top 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 of the
item on the list.
- Test boh the "Yes" and "No" choices.
- Check the box next to multiple titles on the list and clcik the
"Remove from list" link at the top of the table.
- You should see a modal confirmation message, "Are you sure you want
to remove these items from the list?" It should show the titles of
all the records you selected.
- Test both the "Yes" and "No" choices.
---
.../bootstrap/en/includes/title-actions-menu.inc | 2 +-
.../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 65 +++++++++++++++-------
2 files changed, 46 insertions(+), 21 deletions(-)
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc
@@ -44,7 +44,7 @@
[% IF ( shelf AND op == 'view' ) %]
Save to another list
[% IF can_remove_biblios %]
- Remove from this list
+ Remove from this list
[% END %]
[% ELSE %]
Save to lists
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
@@ -369,7 +369,7 @@
[% ELSE %]
[% check_title = itemsloo.biblionumber %]
[% END %]
-
+
[% UNLESS ( item_level_itypes ) %]
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
@@ -558,7 +558,7 @@
-
+
[% END %]
[% ELSE %]
@@ -961,29 +961,54 @@ $(function() {
[% END %]
[% IF loggedinusername && can_remove_biblios %]
- $(".removefromlist").on("click", function(e){
- return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
- });
- $("#myform").submit(function(){
- var checkedBoxes = $(".checkboxed input:checkbox:checked");
- var numchecked = $(checkedBoxes).size();
- if (numchecked) {
- if( numchecked > 1 ){
- return confirmDelete(MSG_REMOVE_FROM_LIST);
+ $("body").on("click", ".removeitems", function(e){
+ e.preventDefault();
+ var href;
+ var title;
+ var yes_label;
+ var no_label;
+ var message = "";
+ /* Single "Remove from list" link has a biblionumber data-attribute */
+ if( $(this).data("biblionumber") ){
+ /* Use the checkbox with that value to preview the title in the confirmation */
+ var selected_titles = $(".cb[value='" + $(this).data("biblionumber") + "'");
+ var href = $(this).attr("href");
+ } else {
+ var selected_titles = $(".cb:checked");
+ }
+ if ( selected_titles.size() < 1 ) {
+ alert( _("No item was selected") );
+ } else {
+ if( selected_titles.size() > 1 ){
+ message = $("
");
+ title = _("Are you sure you want to remove these items from the list?");
+ yes_label = _("Yes, delete from list");
+ no_label = _("No, do not delete from list");
+ selected_titles.each(function(){
+ message.append( "
" + $(this).data("title") + "
" );
+ });
} else {
- return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
+ title = _("Are you sure you want to remove this item from the list?");
+ yes_label = _("Yes, delete from list");
+ no_label = _("No, do not delete from list");
+ selected_titles.each(function(){
+ message += $(this).data("title");
+ });
}
- } else {
- alert( __("No item was selected") );
- return false;
+ confirmModal( message, title, yes_label, no_label, function( result ){
+ if( result ){
+ if( href ){
+ location.href= href;
+ } else {
+ $("#myform").submit();
+ }
+ }
+ });
}
});
- $("#removeitems").html(" "+_("Remove from list")+"")
- .click(function(){
- $("#myform").submit();
- return false;
- });
+
+ $("#removeitems").html(" "+_("Remove from list")+"");
[% END %]
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
--