From a80f25685d9f7617434c800adb62c20031ed8508 Mon Sep 17 00:00:00 2001
From: Kathy Lussier <klussier@masslnc.org>
Date: Wed, 14 Nov 2018 12:49:16 -0500
Subject: [PATCH] LP#1787479: Make the display of some fields conditional on
 the Print Feed Option

Ideally, we would remove the entire Page Settings section for those who are
printing to a continuous feed printer, but it carries the risk of users
not being able to see a field with a value that is affecting the layout. However, there are several fields within that section that don't affect the
continuous feed layout and can be hidden in continuous feed mode. I also
adjusted one help tip to display different information for continuous and
sheet feed printing.

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
---
 Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 | 17 +++++++++--------
 Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js |  4 ++--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 b/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2
index c67bf86b32..059d88f7ba 100644
--- a/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2
+++ b/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2
@@ -171,7 +171,8 @@
                               </div>
                               <div class="eg-print-label-section">
                                 <p><strong>[% l('Print Grid Size') %]</strong>
-                                <eg-help-popover help-text="[% l('Please specify the number of columns and rows (if applicable) on the print medium. This setting is only used to control page layouts and breaks. It will not limit the number of rows printed, which is determined by the number of selected copies. The column count should include each label in a row. For example, if you have a row with two sets of labels that include one spine and one pocket, the count is four.') %]"></p>
+                                        <span ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'"><eg-help-popover help-text="[% l('Please specify the number of columns and rows on the print medium. This setting is only used to control page layouts and breaks. It will not limit the number of rows printed, which is determined by the number of selected copies. The column count should include each label in a row. For example, if you have a row with two sets of labels that include one spine and one pocket, the count is four.') %]"></span>
+                                         <span ng-if="preview_scope.toolbox_settings.feed_option.selected === 'continuous'"><eg-help-popover help-text="[% l('Please specify the number of columns on the print medium. The column count should include each label on your medium. For example, if your medium has a spine and pocket label, the count is two.') %]"></span></p>
                                 <ul>
                                     <li ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'">
                                         <label>[% l('Rows') %]:</label>
@@ -183,22 +184,22 @@
                                     </li>
                                 </ul>
                               </div>
-                              <div class="eg-print-label-section">
+                              <div class="eg-print-label-section" ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'">
                                 <p><label>[% l('Gap Between Rows') %]</label>
                                 <eg-help-popover help-text="[%l ('Must be in format &quot;0.25in&quot;, &quot;2.5cm&quot;, &quot;1.5in&quot;, etc. (units of measurement must be valid CSS)') %]"></p>
                                 <p><input type="text" ng-model="preview_scope.toolbox_settings.page.space_between_labels.vertical.size" ng-min="0" eg-print-label-valid-css required /></p>
                                </div>
-                               <div class="eg-print-label-section">
+                               <div class="eg-print-label-section" ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'">
                                 <p><label>[% l('Gap Between Columns') %]</label>
                                 <eg-help-popover help-text="[% l('Gap between each label set (spine/pocket combo) or, when using only one type of label, between each
 label. Use pocket label left margin to identify how much space to provide between labels within one set. Must be in format &quot;0.25in&quot;, &quot;2.5cm&quot;, &quot;1.5in&quot;, etc. (units of measurement must be valid CSS)') %]"></p>
                               <p><input type="text" ng-model="preview_scope.toolbox_settings.page.label.gap.size" ng-min="0" eg-print-label-valid-css required /></p>
                               </div>
-                              <div class="eg-print-label-section" ng-if="preview_scope.toolbox_settings.page.dimensions.rows > 1 || preview_scope.toolbox_settings.page.dimensions.columns > 1">
+                              <div class="eg-print-label-section" ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'">
                                 <p><strong>[% l('Starting Position on Label Grid') %]</strong>
                                 <eg-help-popover help-text="[% l('Specify the starting row and column where labels should begin printing. Values must not exceed the respective row and column size specified in &quot;Print Grid Size&quot;') %]"></p>
                                 <ul>
-                                    <li ng-if="preview_scope.toolbox_settings.feed_option.selected === 'sheet'">
+                                    <li>
                                         <label>[% l('Row') %]:</label>
                                         <input type="number" eg-print-label-valid-int eg-print-label-row-bounds ng-model="preview_scope.toolbox_settings.page.start_position.row" ng-min="1" required />
                                     </li>
@@ -209,14 +210,14 @@ label. Use pocket label left margin to identify how much space to provide betwee
                                 </ul>
                                 </div>
                               </div> 
-                              <div class="eg-print-label-group">
-                                <div class="eg-print-label-section">
+                              <div class="eg-print-label-group" class="eg-print-label-section" ng-if="preview_scope.valid_print_label_start_column() && preview_scope.valid_print_label_start_row() && preview_scope.toolbox_settings.page.dimensions.columns > 1">
+                                <div>
                                 <h4>[% l('Label Set Configuration') %]
                                 <eg-help-popover help-text="[% l('A label set is a group of labels that should print data from the same bibliographic record. In this
 section, identify the number of labels contained in each set, which columns should print spine label data, and which columns should print pocket label data.') %]"></h4>
                                 <label>[% l('Number of Labels in Set') %]:</label>
                               <input type="number" eg-print-label-valid-int="" ng-min="1" ng-model="preview_scope.toolbox_settings.page.label.set.size" />
-                                <ul ng-if="preview_scope.valid_print_label_start_column() && preview_scope.valid_print_label_start_row() && preview_scope.toolbox_settings.mode.selected === 'spine-pocket'">
+                                <ul>
                                     <li ng-repeat="i in preview_scope.toolbox_settings.page.label.set.size | columnRowRange">
                                         <label>[% l('Column') %] {{i + 1}}</label>
                                         <select id="eg_print_label_column_spec_{{i}}" ng-model="preview_scope.toolbox_settings.page.column_class[i]" ng-change="redraw_label_table()">
diff --git a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js
index f798f4c4a4..1e83afa994 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js
@@ -117,8 +117,8 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet,
         },
         mode: {
             options: [
-                { label: "Label 1 Only", value: "spine-only" },
-                { label: "Labels 1 & 2", value: "spine-pocket" }
+                { label: "Spine Label", value: "spine-only" },
+                { label: "Pocket Label", value: "spine-pocket" }
             ],
             selected: "spine-pocket"
         },
-- 
2.11.0