From 53ebf7e506edf5a66f35ce1e0ef873e6df2c4d20 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 15 Jan 2019 12:20:52 -0500 Subject: [PATCH] LP1717366 Patron summary auto-collapse as org setting Treat "circ.auto_hide_patron_summary" as an org setting instead of a browser client (workstation) setting for consistency with XUL client. Pre-fetch the circ.auto_hide_patron_summary org setting value so it's loaded and cached along with the initial patron org settings batch (one fewer API call). Move the show/hide function up in the file so it's defined before it's first referenced (for clarity). Signed-off-by: Bill Erickson --- .../js/ui/default/staff/circ/patron/app.js | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 7c3aefacec..df7034110d 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -38,7 +38,8 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', 'egUserBucketMod', 'circ.patron_expires_soon_warning', 'ui.circ.items_out.lost', 'ui.circ.items_out.longoverdue', - 'ui.circ.items_out.claimsreturned' + 'ui.circ.items_out.claimsreturned', + 'circ.auto_hide_patron_summary' ]).then(function(settings) { // local settings are cached within egOrg. Caching them // again in egEnv just simplifies the syntax for access. @@ -267,6 +268,15 @@ function($scope, $q , $location , $filter , egCore , egNet , egUser , egAlertDi return false; } + // Expand or collapse the patron summary side bar. + function setSummaryState(condition) { + if (condition) { + egCore.hatch.setItem('eg.circ.patron.summary.collapse', true); + } else { + egCore.hatch.removeItem('eg.circ.patron.summary.collapse'); + } + } + // called after each route-specified controller is instantiated. // this doubles as a way to inform the top-level controller that // egStartup.go() has completed, which means we are clear to @@ -277,6 +287,11 @@ function($scope, $q , $location , $filter , egCore , egNet , egUser , egAlertDi $scope.aous = egCore.env.aous; $scope.auth_user_id = egCore.auth.user().id(); + if (egCore.env.aous && // cached in startup + egCore.env.aous['circ.auto_hide_patron_summary']) { + setSummaryState(true); + } + if (patron_id) { $scope.patron_id = patron_id; return patronSvc.setPrimary($scope.patron_id) @@ -357,18 +372,6 @@ function($scope, $q , $location , $filter , egCore , egNet , egUser , egAlertDi lNode.style.visibility = 'hidden'; } - function setSummaryState(condition) { - if (condition) { - egCore.hatch.setItem('eg.circ.patron.summary.collapse', true); - } else { - egCore.hatch.removeItem('eg.circ.patron.summary.collapse'); - } - } - - egCore.hatch.getItem('circ.auto_hide_patron_summary').then(function(res) { - setSummaryState(res); - }); - $scope.toggle_expand_summary = function() { if ($scope.collapsePatronSummary) { $scope.collapsePatronSummary = false; -- 2.43.2