From 75e1d91a4c0ecc67a343aad2b636fe58dc748216 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 15 Jun 2015 21:54:44 -0400 Subject: [PATCH] LP#1464767 Sort browser client org selector Sort each level of the shared org unit tree in the browser client by org unit shortname. This primarily affects org unit selectors / dropdowns (unless otherwise sorted). Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/staff/services/env.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/services/env.js b/Open-ILS/web/js/ui/default/staff/services/env.js index 25198fae7c..ad41fc12d5 100644 --- a/Open-ILS/web/js/ui/default/staff/services/env.js +++ b/Open-ILS/web/js/ui/default/staff/services/env.js @@ -146,10 +146,19 @@ function($q, $window , egAuth, egPCRUD, egIDL) { return $q.when(tree); } + // sort orgs at each level by shortname + function sort_aou(node) { + node.children(node.children().sort(function(a, b) { + return a.shortname() < b.shortname() ? -1 : 1; + })); + angular.forEach(node.children(), sort_aou); + } + return egPCRUD.search('aou', {parent_ou : null}, {flesh : -1, flesh_fields : {aou : ['children', 'ou_type']}} ).then( function(tree) { + sort_aou(tree); $window.sessionStorage.setItem( 'eg.env.aou.tree', js2JSON(tree)); service.absorbTree(tree, 'aou') -- 2.11.0