From 8d9c75d587953cad9a6e20e8e7ff60dc04da6ecb Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 5 Oct 2015 20:21:23 +0000 Subject: [PATCH 1/1] webstaff: add egOrg.root() method Also, start adding some documentation for egOrg. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../web/js/ui/default/staff/services/org.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/staff/services/org.js b/Open-ILS/web/js/ui/default/staff/services/org.js index dcf1d52948..e9fcc2d11c 100644 --- a/Open-ILS/web/js/ui/default/staff/services/org.js +++ b/Open-ILS/web/js/ui/default/staff/services/org.js @@ -1,7 +1,19 @@ /** * Core Service - egOrg * - * TODO: more docs + * This provides access to the organizational unit tree and + * caches it in browser session storage. + * + * Methods include: + * get() - retrieve OU based on ID or aou object + * list() - retrieve flattened list of OUs + * tree() - retrieve OU as tree + * root() - get aou object representing root of the OU tree + * ancestors() - get ancestors of supplied OU + * descendants() - get descendants of supplied OU + * + * TODO more to document + * */ angular.module('egCoreMod') @@ -29,6 +41,11 @@ function($q, egEnv, egAuth, egNet) { return egEnv.aou.tree; } + // get the root OU + service.root = function() { + return egEnv.aou.list[0]; + } + // list of org_unit objects or IDs for ancestors + me service.ancestors = function(node_or_id, as_id) { var node = service.get(node_or_id); -- 2.43.2