From: Kyle Huckins Date: Mon, 17 Jun 2019 23:09:39 +0000 (+0000) Subject: lp1739277 Holdings View Owning Libraries Bolded X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3897a398872bbce5d13481bc15dee184839870b5;p=working%2FEvergreen.git lp1739277 Holdings View Owning Libraries Bolded - Create an orgstyle parameter for the orgSelector, which contains a list of applicable org units, and an apply function to apply the desired changes to the shortname as displayed in the selector. Signed-off-by: Kyle Huckins modified: Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 modified: Open-ILS/web/js/ui/default/staff/cat/catalog/app.js modified: Open-ILS/web/js/ui/default/staff/services/ui.js --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 index b694d6bc6c..87f49871a8 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -4,7 +4,9 @@
[% l('Show holdings at or below') %] - +
diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 2988d9504c..308da0750a 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -1204,6 +1204,28 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.holdings_cb_changed(item.checkbox,item.checked); } + $scope.ous_to_style = [] + egCore.net.request( + 'open-ils.search', + 'open-ils.search.biblio.copy_counts.retrieve.staff', + $scope.record_id + ).then(function(res) { + var ous = []; + if (res) { + angular.forEach(res, function(copy_count) { + $scope.ous_to_style.push(copy_count[0]); + }); + } + return ous; + }); + $scope.bold_ous = { + orgArray : $scope.ous_to_style, + apply : function(str, org_shortname) { + str = str + '' + org_shortname; + ''; + return str; + } + } + function gatherSelectedHoldingsIds () { var cp_id_list = []; angular.forEach( 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 0fe9918e37..deba0220b2 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -1081,7 +1081,10 @@ function($uibModal , $interpolate , egCore) { // optional name of settings key for persisting // the last selected org unit - stickySetting : '@' + stickySetting : '@', + + // optional parameters to style Org Units + styleorg : '=' }, templateUrl : './share/t_org_select', @@ -1093,7 +1096,12 @@ function($uibModal , $interpolate , egCore) { var secretEmptyKey = '_INTERNAL_'; function formatName(org) { - return " ".repeat(org.ou_type().depth()) + org.shortname(); + var org_str = " ".repeat(org.ou_type().depth()); + if ($scope.styleorg && $scope.styleorg.orgArray.includes(org.id())) { + return $scope.styleorg.apply(org_str, org.shortname()); + } else { + return org_str + org.shortname(); + } } // avoid linking the full fleshed tree to the scope by @@ -1112,9 +1120,7 @@ function($uibModal , $interpolate , egCore) { } ).then( function() { - $scope.selecteName = ''; - $scope.shortNames = egCore.org.list() .filter(function(org) { return !( @@ -1191,14 +1197,14 @@ function($uibModal , $interpolate , egCore) { // Trim leading tree-spaces before displaying selected value $scope.formatDisplayName = function(shortName) { - return ($scope.selectedName || '').trim(); + return ($scope.selectedName || '').trim().replace(/<[^>]*>?/gm, ''); } $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(); + return org.shortname() === shortName.trim().replace(/<[^>]*>?/gm, ''); })[0]; return org && $scope.disableTest(org.id()); @@ -1215,7 +1221,7 @@ function($uibModal , $interpolate , egCore) { if ($scope.selectedName && !$scope.orgIsDisabled($scope.selectedName)) { $scope.selected = egCore.org.list().filter(function(org) { - return org.shortname() === $scope.selectedName.trim() + return org.shortname() === $scope.selectedName.trim().replace(/<[^>]*>?/gm, '') })[0]; } else { $scope.selected = null;