Bug 15496: (follow-up) Update interaction for deleting records
authorOwen Leonard <oleonard@myacpl.org>
Wed, 17 Apr 2019 16:20:18 +0000 (16:20 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 26 Apr 2019 12:07:04 +0000 (12:07 +0000)
This patch makes minor changes to markup and JavaScript to alter the
interaction for deleting the record. Now a successful deletion will
convert the dialog to a "message" type dialog and show only the success
message.

To test, apply the patch and test the process of attaching the last item
from a record and deleting that record.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt

index 29e6499..1816647 100644 (file)
        [% ELSE %]
            [% IF ( success ) %]
             [% IF from_biblio.items.count == 0 %]
-                <div class="dialog alert">
-                    The record <em>[% from_biblio.title | html %]</em> has [% from_biblio.items.count | html %] attached items.
-                    <p>
-                        <button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record
-                        </button>
-                        <span id="del-bib-success" style="display:none">Record deleted</span>
-                        <span id="del-bib-failure" style="display:none">Attempt to delete record failed.</span>
+                <div class="dialog alert" id="del-bib-alert">
+                    <div id="del-bib-action">
+                        The record <em><a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% from_biblio.id | html %]">[% from_biblio.title | html %]</a></em> has [% from_biblio.items.count | html %] attached items.
+                        <p><button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record
+                        </button></p>
+                    </div>
+                    <p id="del-bib-result">
+                        <span id="del-bib-success" style="display:none"><i class="fa fa-check success"></i> Record deleted</span>
+                        <span id="del-bib-failure" style="display:none"><i class="fa fa-warning"></i> Attempt to delete record failed.</span>
                     </p>
                 </div>
-                <br/>
             [% END %]
 
             <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %]<i>[% bibliotitle | html %]</i></a>.
     <script>
         $("#delete-biblio-btn").on("click", function(){
             if ( confirm(_("Are you sure you want to delete this record?")) ) {
-                let btn = $(this);
                 $("#del-bib-spn").show();
                 let biblionumber = $(this).data('biblionumber');
                 $.ajax({
                     url: '/api/v1/biblios/' + biblionumber,
                     type: 'DELETE',
                     success: function(result) {
-                        btn.hide();
+                        $("#del-bib-action").hide();
                         $('#del-bib-success').show();
+                        $("#del-bib-alert").attr("class","dialog message")
                     },
                     error: function(result) {
-                        btn.hide();
+                        $("#delete-biblio-btn").hide();
                         $('#del-bib-failure').show();
                     }
                 });