[open-ils-commits] [GIT] Evergreen ILS branch master updated. 49837dc3010755342a04c08527e4aa28d24e3832

Evergreen Git git at git.evergreen-ils.org
Fri Sep 14 10:30:53 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  49837dc3010755342a04c08527e4aa28d24e3832 (commit)
       via  3436eccbd9e1407cb564b7250e87ef9d5c5093d4 (commit)
       via  b0ed643b8efef834da6d9689be6c5c74047abaf6 (commit)
      from  88072d56f1a55e3f03f28cd2f552595419193c55 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 49837dc3010755342a04c08527e4aa28d24e3832
Author: Kyle Huckins <khuckins at catalyte.io>
Date:   Tue Sep 11 17:13:11 2018 +0000

    lp1511742 Additional Scaffolding Fixes
    
    - Apply scaffolding fixes to Aquisition Patron Requests,
    Circ Age to Lost, and Auto Print settings UIs, preventing
    Org Selector from taking up entire width of screen.
    
    Signed-off-by: Kyle Huckins <khuckins at catalyte.io>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/templates/staff/acq/requests/t_list.tt2 b/Open-ILS/src/templates/staff/acq/requests/t_list.tt2
index 5c279b4..af828d1 100644
--- a/Open-ILS/src/templates/staff/acq/requests/t_list.tt2
+++ b/Open-ILS/src/templates/staff/acq/requests/t_list.tt2
@@ -8,9 +8,10 @@
   <div class="form-group">
     <div class="row">
       <span ng-hide="context_user || context_lineitem">
-        <label for="select-request-ou">[% l('Patron Home Library: ' ) %]</label>
-        <eg-org-selector id="select-request-ou" selected="context_ou"></eg-org-selector>
-        <span> </span>
+        <div class="col-md-3 input-group">
+          <span class="input-group-addon">[% l('Patron Home Library: ' ) %]</span>
+          <eg-org-selector id="select-request-ou" selected="context_ou"></eg-org-selector>
+        </div>
       </span>
       <span ng-show="context_user">[% l('User ID: [_1]','{{context_user}}') %]</span>
       <span ng-show="context_lineitem">[% l('PO Line Item ID: [_1]','{{context_lineitem}}') %]</span>
diff --git a/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2 b/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2
index f3471a6..b9a51f2 100644
--- a/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2
+++ b/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2
@@ -26,9 +26,9 @@ you wish to age to a Lost status.  Note the descendants of these values
 
 <div id='age-to-lost-container'>
   <div xclass="form-inline">
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('User Profile') %]</label>
-      <div class="btn-group" uib-dropdown>
+      <div class="btn-group col-md-2" uib-dropdown>
         <button type="button" class="btn btn-default" uib-dropdown-toggle>
           <span style="padding-right: 5px;">{{selected_profile.name()}}</span>
           <span class="caret"></span>
@@ -42,13 +42,13 @@ you wish to age to a Lost status.  Note the descendants of these values
         </ul>
       </div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Circulation Library') %]</label>
-      <eg-org-selector selected="context_org"></eg-org-selector>
+      <div class="col-md-2"><eg-org-selector selected="context_org"></eg-org-selector></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Are you sure?') %]</label>
-      <input type="checkbox" ng-model="i_am_sure"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="i_am_sure"/></div>
     </div>
   </div>
     <div class="form-group">
diff --git a/Open-ILS/src/templates/staff/admin/local/config/auto_print.tt2 b/Open-ILS/src/templates/staff/admin/local/config/auto_print.tt2
index a6b4725..73b7209 100644
--- a/Open-ILS/src/templates/staff/admin/local/config/auto_print.tt2
+++ b/Open-ILS/src/templates/staff/admin/local/config/auto_print.tt2
@@ -45,34 +45,34 @@ dialog (the ones that offer Print and Do Not Print as options).[% END %]
   <div class="row"></div><!-- add some padding -->
 
   <div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Checkout Receipt') %]</label>
-      <input type="checkbox" ng-model="co_recpt"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="co_recpt"/></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Bill Pay Receipt') %]</label>
-      <input type="checkbox" ng-model="bill_recpt"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="bill_recpt"/></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Hold Slip') %]</label>
-      <input type="checkbox" ng-model="hold_slip"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="hold_slip"/></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Transit Slip') %]</label>
-      <input type="checkbox" ng-model="transit_slip"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="transit_slip"/></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('Hold/Transit Slip') %]</label>
-      <input type="checkbox" ng-model="hold_transit_slip"/>
+      <div class="col-md-2"><input type="checkbox" ng-model="hold_transit_slip"/></div>
     </div>
-    <div class="form-group">
+    <div class="form-group row">
       <label class="col-md-2">[% l('For This Library and Descendants') %]</label>
-      <eg-org-selector selected="context_org" 
-        onchange="show_org_values" disable-test="cant_use_org"></eg-org-selector>
+      <div class="col-md-2"><eg-org-selector selected="context_org" 
+        onchange="show_org_values" disable-test="cant_use_org"></eg-org-selector></div>
     </div>
   </div>
   </div>
-    <div class="form-group">
+    <div class="form-group row">
       <button class="btn btn-default" 
         ng-class="{disabled : in_flight}"
         ng-click="update_auto_print()">

commit 3436eccbd9e1407cb564b7250e87ef9d5c5093d4
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Sep 7 16:36:17 2018 -0400

    LP#1511742 Org selector typeahead UI formatting
    
    The display behavior of the org selector changed when migrating to a
    typeahead.  In some cases, the boundaries of the input need to be more
    clearly defined or it will fill the page horizontally.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kyle Huckins <khuckins at catalyte.io>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_workstations.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_workstations.tt2
index 6210395..8d7eb90 100644
--- a/Open-ILS/src/templates/staff/admin/workstation/t_workstations.tt2
+++ b/Open-ILS/src/templates/staff/admin/workstation/t_workstations.tt2
@@ -16,15 +16,15 @@
     </div>
   </div>
   <div class="row">
-    <div class="col-md-6">
+    <div class="col-md-2">
+      <eg-org-selector 
+        selected="contextOrg"
+        hidden-test="wsOrgHidden">
+        disable-test="cant_have_users">
+      </eg-org-selector>
+    </div>
+    <div class="col-md-4">
       <div class="input-group">
-        <div class="input-group-btn">
-          <eg-org-selector 
-            selected="contextOrg"
-            hidden-test="wsOrgHidden">
-            disable-test="cant_have_users">
-          </eg-org-selector>
-        </div>
         <input type='text' class='form-control'  
           title="[% l('Workstation Name') %]"
           placeholder="[% l('Workstation Name') %]"
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_pending_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_pending_list.tt2
index b073b8c..7384211 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_pending_list.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_pending_list.tt2
@@ -4,8 +4,11 @@
   </div>
 </div>
 
-<span>[% l('Home Library: ' ) %]</span>
-<span><eg-org-selector selected="context_org"></eg-org-selector></span>
+<div class="flex-row">
+  <div class="pad-right-min">[% l('Home Library: ' ) %]</div>
+  <eg-org-selector selected="context_org"></eg-org-selector>
+  <div class="flex-1"></div>
+</div>
 <hr/>
 
 <eg-grid

commit b0ed643b8efef834da6d9689be6c5c74047abaf6
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Sep 7 15:59:35 2018 -0400

    LP#1511742 Org unit selector typeahead
    
    Reimplements <eg-org-selector> as an ngbTypeahead:
    
    https://angular-ui.github.io/bootstrap/#!#typeahead
    
    This allows for type-to-entry of the org selector.  A few additional
    bits of logic are added to support click-to-open of the selector
    regardless of the selected value.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kyle Huckins <khuckins at catalyte.io>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/templates/staff/share/t_org_select.tt2 b/Open-ILS/src/templates/staff/share/t_org_select.tt2
new file mode 100644
index 0000000..613c28d
--- /dev/null
+++ b/Open-ILS/src/templates/staff/share/t_org_select.tt2
@@ -0,0 +1,19 @@
+<span>
+  <script type="text/ng-template" id="org-select-entry.html">
+    <a ng-class="{disabled : $parent.$parent.$parent.orgIsDisabled(match.label)}">
+      <span ng-bind-html="match.label | uibTypeaheadHighlight:query"></span>
+    </a>
+  </script>
+
+  <input type="text" class="form-control" ng-model="selectedName"
+    placeholder="{{label}}"
+    ng-click="handleClick($event)"
+    ng-trim="false"
+    empty-typeahead
+    typeahead-min-length="0"
+    typeahead-template-url="org-select-entry.html"
+    typeahead-editable="false"
+    typeahead-on-select="inputChanged($event)"
+    typeahead-input-formatter="formatDisplayName($event)"
+    uib-typeahead="shortName for shortName in shortNames | filter:$viewValue:compare"/>
+</span>
diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js
index 6916319..8f38e1c 100644
--- a/Open-ILS/web/js/ui/default/staff/services/ui.js
+++ b/Open-ILS/web/js/ui/default/staff/services/ui.js
@@ -1032,7 +1032,7 @@ function($uibModal , $interpolate , egCore) {
             // onchange handler.
             onchange : '=',
 
-            // optional primary drop-down button label
+            // optional typeahead placeholder text
             label : '@',
 
             // optional name of settings key for persisting
@@ -1040,30 +1040,16 @@ function($uibModal , $interpolate , egCore) {
             stickySetting : '@'
         },
 
-        // any reason to move this into a TT2 template?
-        template : 
-            '<div class="btn-group eg-org-selector" uib-dropdown>'
-            + '<button type="button" class="btn btn-default" uib-dropdown-toggle ng-disabled="disable_button">'
-             + '<span style="padding-right: 5px;">{{getSelectedName()}}</span>'
-             + '<span class="caret"></span>'
-           + '</button>'
-           + '<ul uib-dropdown-menu class="scrollable-menu">'
-             + '<li ng-repeat="org in orgList" ng-hide="hiddenTest(org.id)">'
-               + '<a href ng-click="orgChanged(org)" a-disabled="disableTest(org.id)" '
-                 + 'style="padding-left: {{org.depth * 10 + 5}}px">'
-                 + '{{org.shortname}}'
-               + '</a>'
-             + '</li>'
-           + '</ul>'
-          + '</div>',
+        templateUrl : './share/t_org_select',
 
         controller : ['$scope','$timeout','egCore','egStartup','egLovefield','$q',
               function($scope , $timeout , egCore , egStartup , egLovefield , $q) {
 
-            if ($scope.alldisabled) {
-                $scope.disable_button = $scope.alldisabled == 'true' ? true : false;
-            } else {
-                $scope.disable_button = false;
+            // See emptyTypeahead directive below.
+            var secretEmptyKey = '_INTERNAL_';
+
+            function formatName(org) {
+                return " ".repeat(org.ou_type().depth()) + org.shortname();
             }
 
             // avoid linking the full fleshed tree to the scope by 
@@ -1083,30 +1069,39 @@ function($uibModal , $interpolate , egCore) {
             ).then(
                 function() {
 
-                    $scope.orgList = egCore.org.list().map(function(org) {
-                        return {
-                            id : org.id(),
-                            shortname : org.shortname(), 
-                            depth : org.ou_type().depth()
-                        }
+                    $scope.selecteName = '';
+
+                    $scope.shortNames = egCore.org.list()
+                    .filter(function(org) {
+                        return !(
+                            $scope.hiddenTest && 
+                            $scope.hiddenTest(org.id())
+                        );
+                    }).map(function(org) {
+                        return formatName(org);
                     });
-                    
     
                     // Apply default values
     
                     if ($scope.stickySetting) {
                         var orgId = egCore.hatch.getLocalItem($scope.stickySetting);
                         if (orgId) {
-                            $scope.selected = egCore.org.get(orgId);
+                            var org = egCore.org.get(orgId);
+                            if (org) {
+                                $scope.selected = org;
+                                $scope.selectedName = org.shortname();
+                            }
                         }
                     }
     
                     if (!$scope.selected && !$scope.nodefault && egCore.auth.user()) {
-                        $scope.selected = 
-                            egCore.org.get(egCore.auth.user().ws_ou());
+                        var org = egCore.org.get(egCore.auth.user().ws_ou());
+                        $scope.selected = org;
+                        $scope.selectedName = org.shortname();
                     }
     
                     fire_orgsel_onchange(); // no-op if nothing is selected
+                    watch_external_changes();
                 }
             );
 
@@ -1126,21 +1121,90 @@ function($uibModal , $interpolate , egCore) {
                 });
             }
 
-            $scope.getSelectedName = function() {
-                if ($scope.selected && $scope.selected.shortname)
-                    return $scope.selected.shortname();
-                return $scope.label;
+            // Force the compare filter to run when the input is
+            // clicked.  This allows for displaying all values when
+            // clicking on an empty input.
+            $scope.handleClick = function (e) {
+                $timeout(function () {
+                    var current = $scope.selectedName;
+                    // HACK-CITY
+                    // Force the input value to "" so when the compare 
+                    // function runs it will see the special empty key
+                    // instead of the selected value.
+                    $(e.target).val('');
+                    $(e.target).trigger('input');
+                    // After the compare function runs, reset the the
+                    // selected value.
+                    $scope.selectedName = current;
+                });
             }
 
-            $scope.orgChanged = function(org) {
-                $scope.selected = egCore.org.get(org.id);
-                if ($scope.stickySetting) {
-                    egCore.hatch.setLocalItem($scope.stickySetting, org.id);
+            $scope.compare = function(shortName, inputValue) {
+                return inputValue === secretEmptyKey ||
+                    (shortName || '').toLowerCase().trim()
+                        .indexOf((inputValue || '').toLowerCase().trim()) > -1;
+            }
+
+            // Trim leading tree-spaces before displaying selected value
+            $scope.formatDisplayName = function(shortName) {
+                return ($scope.selectedName || '').trim();
+            }
+
+            $scope.orgIsDisabled = function(shortName) {
+                if ($scope.alldisabled === 'true') return true;
+                if (shortName && $scope.disableTest) {
+                    var org = egCore.org.list().filter(function(org) {
+                        return org.shortname() === shortName.trim();
+                    })[0];
+
+                    return org && $scope.disableTest(org.id());
+                }
+                return false;
+            }
+
+            $scope.inputChanged = function(shortName) {
+                // Avoid watching for changes on $scope.selected while
+                // manually applying values below.
+                unwatch_external_changes();
+
+                // Manually prevent selection of disabled orgs
+                if ($scope.selectedName && 
+                    !$scope.orgIsDisabled($scope.selectedName)) {
+                    $scope.selected = egCore.org.list().filter(function(org) {
+                        return org.shortname() === $scope.selectedName.trim()
+                    })[0];
+                } else {
+                    $scope.selected = null;
+                }
+                if ($scope.selected && $scope.stickySetting) {
+                    egCore.hatch.setLocalItem(
+                        $scope.stickySetting, $scope.selected.id());
                 }
+
                 fire_orgsel_onchange();
+                $timeout(watch_external_changes);
             }
 
+            // Propagate external changes on $scope.selected to the typeahead
+            var dewatcher;
+            function watch_external_changes() {
+                dewatcher = $scope.$watch('selected', function(newVal, oldVal) {
+                    if (newVal) {
+                        $scope.selectedName = newVal.shortname();
+                    } else {
+                        $scope.selectedName = '';
+                    }
+                });
+            }
+
+            function unwatch_external_changes() {
+                if (dewatcher) {
+                    dewatcher();
+                    dewatcher = null;
+                }
+            }
         }],
+
         link : function(scope, element, attrs, egGridCtrl) {
 
             // boolean fields are presented as value-less attributes
@@ -1157,6 +1221,34 @@ function($uibModal , $interpolate , egCore) {
     }
 })
 
+/*
+https://stackoverflow.com/questions/24764802/angular-js-automatically-focus-input-and-show-typeahead-dropdown-ui-bootstra
+*/
+.directive('emptyTypeahead', function () {
+    return {
+        require: 'ngModel',
+        link: function(scope, element, attrs, modelCtrl) {
+
+            var secretEmptyKey = '_INTERNAL_';
+
+            // this parser run before typeahead's parser
+            modelCtrl.$parsers.unshift(function (inputValue) {
+                // replace empty string with secretEmptyKey to bypass typeahead-min-length check
+                var value = (inputValue ? inputValue : secretEmptyKey);
+                // this $viewValue must match the inputValue pass to typehead directive
+                modelCtrl.$viewValue = value;
+                return value;
+            });
+
+            // this parser run after typeahead's parser
+            modelCtrl.$parsers.push(function (inputValue) {
+                // set the secretEmptyKey back to empty string
+                return inputValue === secretEmptyKey ? '' : inputValue;
+            });
+        }
+    }
+})
+
 .directive('nextOnEnter', function () {
     return function (scope, element, attrs) {
         element.bind("keydown keypress", function (event) {

-----------------------------------------------------------------------

Summary of changes:
 .../src/templates/staff/acq/requests/t_list.tt2    |    7 +-
 .../staff/admin/local/circ/age_to_lost.tt2         |   12 +-
 .../staff/admin/local/config/auto_print.tt2        |   28 ++--
 .../staff/admin/workstation/t_workstations.tt2     |   16 +-
 .../templates/staff/circ/patron/t_pending_list.tt2 |    7 +-
 .../src/templates/staff/share/t_org_select.tt2     |   19 +++
 Open-ILS/web/js/ui/default/staff/services/ui.js    |  170 +++++++++++++++-----
 7 files changed, 187 insertions(+), 72 deletions(-)
 create mode 100644 Open-ILS/src/templates/staff/share/t_org_select.tt2


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list