refactor
authorJason Etheridge <jason@esilibrary.com>
Fri, 10 Jun 2016 18:17:13 +0000 (14:17 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 18 Aug 2016 19:34:22 +0000 (15:34 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js

index 6632bdc..323288e 100644 (file)
@@ -27,31 +27,6 @@ angular.module('egOrgUnitApp',
        ['$scope','$q','$routeParams','$window','egCore','egOrg',
 function($scope , $q , $routeParams , $window , egCore , egOrg  ) {
 
-    $scope.update = function() {
-        var new_org = egOrg.get($scope.org.id);
-        new_org.name( $scope.org.name );
-        new_org.shortname( $scope.org.shortname );
-        new_org.email( $scope.org.email );
-        new_org.phone( $scope.org.phone );
-        egCore.pcrud.update(new_org).then(
-            function(res) { // success
-                console.log('handler1');
-                window.handler1 = res;
-                window.sessionStorage.removeItem('eg.env.aou.tree');
-                egCore.env.load();
-                init(0);
-            },
-            function(res) { // success
-                console.log('handler2');
-                window.handler2 = res;
-            },
-            function(res) { // error
-                console.log('handler3');
-                window.handler3 = res;
-            }
-        );
-    };
-
     $scope.reset = function() {
         $scope.org = angular.copy($scope.selectedNode);
     };
@@ -96,5 +71,35 @@ function($scope , $q , $routeParams , $window , egCore , egOrg  ) {
         }
     }
 
+    // main tab behavior
+
+    $scope.update = function() {
+        var new_org = egOrg.get($scope.org.id);
+        new_org.name( $scope.org.name );
+        new_org.shortname( $scope.org.shortname );
+        new_org.email( $scope.org.email );
+        new_org.phone( $scope.org.phone );
+        egCore.pcrud.update(new_org).then(
+            function(res) { // success
+                console.log('handler1');
+                window.handler1 = res;
+                window.sessionStorage.removeItem('eg.env.aou.tree');
+                egCore.env.load();
+                init(0);
+            },
+            function(res) { // success
+                console.log('handler2');
+                window.handler2 = res;
+            },
+            function(res) { // error
+                console.log('handler3');
+                window.handler3 = res;
+            }
+        );
+    };
+
+
+
+
 }])