From d37ea59584e46626b054a529f82e1d3457a676ea Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Wed, 6 Jun 2018 01:48:33 +0000
Subject: [PATCH] Bug 15766: [FOLLOW-UP] Fixing layout of description button

This patch moves the 'Save' button to the toolbar as suggested. The
description textbox and 'Save' button are hidden if the batch is new and
appears when items are added.
---
 .../intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt | 12 +++++++-----
 .../intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt  | 12 +++++++-----
 svc/creator_batches                                          |  0
 3 files changed, 14 insertions(+), 10 deletions(-)
 mode change 100644 => 100755 svc/creator_batches

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
index 3ef719f..4aa143a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
@@ -175,7 +175,7 @@
             });
             $("#savedesc").click(function(event){
                 event.preventDefault(); // prevent form submission
-                var newdescription = $(this).siblings('input[name="description"]').val();
+                var newdescription = $('input[name="description"]').val();
                 var batch_id = $(this).data('batch_id');
                 var ajaxData = {
                     'newdescription': newdescription,
@@ -212,8 +212,10 @@
         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
         <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> &rsaquo;
         <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a> &rsaquo;
-        [% IF batch_id %]
-            Edit ([% batch_id %])
+        [% IF description %]
+            Edit <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% batch_id %]">[% description %]</a>
+        [% ELSIF batch_id %]
+            Edit <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% batch_id %]">([% batch_id %])</a>
         [% ELSE %]
             New
         [% END %]
@@ -258,8 +260,7 @@
                                         <input type="hidden" name="op" value="add" />
                                         <input type="hidden" name="batch_id" value="[% batch_id %]" />
                                         <label for="description">Batch description: </label>
-                                        <input type="text" name="description" value="[% description %]">
-                                        <a href="#" id="savedesc" data-batch_id="[% batch_id %]" class="btn btn-default btn-xs">Save description</a> <span id="change-status"></span>
+                                        <input type="text" name="description" value="[% description %]"> <span id="change-status"></span>
                                     </li>
                                     <li>
                                         <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
@@ -279,6 +280,7 @@
                             </form>
                             <div id="batch-manage" class="btn-toolbar">
                                 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
+                                <a class="btn btn-default btn-sm" id="savedesc" href="#" data-batch_id="[% batch_id %]"><i class="fa fa-save"></i> Save description</a>
                                 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected items</a>
                                 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
                                 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt
index 7965a91..daff6a2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt
@@ -14,8 +14,10 @@
         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
         <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> &rsaquo;
         <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> &rsaquo;
-        [% IF batch_id %]
-            Edit ([% batch_id %])
+        [% IF description %]
+            Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id %]">[% description %]</a>
+        [% ELSIF batch_id %]
+            Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id %]">([% batch_id %])</a>
         [% ELSE %]
             New
         [% END %]
@@ -47,8 +49,7 @@
                                         <input type="hidden" name="op" value="add" />
                                         <input type="hidden" name="batch_id" value="[% batch_id %]" />
                                         <label for="description">Batch description: </label>
-                                        <input type="text" name="description" value="[% description %]">
-                                        <a href="#" id="savedesc" data-batch_id="[% batch_id %]" class="btn btn-default btn-xs">Save description</a> <span id="change-status"></span>
+                                        <input type="text" name="description" value="[% description %]"> <span id="change-status"></span>
                                     </li><li>
                                         <label for="bor_num_list">Add by borrowernumber(s):
                                             <br /> <span class="hint">One borrowernumber per line.</span>
@@ -60,6 +61,7 @@
                             </form>
                             <div id="batch-manage" class="action">
                                 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
+                                <a class="btn btn-default btn-sm" id="savedesc" href="#" data-batch_id="[% batch_id %]"><i class="fa fa-save"></i> Save description</a>
                                 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
                                 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
                                 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
@@ -271,7 +273,7 @@
                 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800);
             });
             $("#savedesc").click(function(event){
-                var newdescription = $(this).siblings('input[name="description"]').val();
+                var newdescription = $('input[name="description"]').val();
                 var batch_id = $(this).data('batch_id');
                 var ajaxData = {
                     'newdescription': newdescription,
diff --git a/svc/creator_batches b/svc/creator_batches
old mode 100644
new mode 100755
-- 
2.1.4