dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40929
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20850: tracker and event captre now use own directive instead of sharting one
------------------------------------------------------------
revno: 20850
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-22 12:28:56 +0200
message:
tracker and event captre now use own directive instead of sharting one
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2015-09-09 15:01:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2015-10-22 10:28:56 +0000
@@ -2,4 +2,38 @@
/* Directives */
-var eventCaptureDirectives = angular.module('eventCaptureDirectives', []);
\ No newline at end of file
+var eventCaptureDirectives = angular.module('eventCaptureDirectives', [])
+
+.directive('selectedOrgUnit', function ($timeout, OrgUnitService, SessionStorageService) {
+ return {
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ //once ou tree is loaded, start meta-data download
+ //$(function () {
+ $( '#orgUnitTree' ).one( 'ouwtLoaded', function( event, ids, names ){
+ console.log('Finished loading orgunit tree');
+ //Disable ou selection until meta-data has downloaded
+ $("#orgUnitTree").addClass("disable-clicks");
+
+ $timeout(function () {
+ scope.treeLoaded = true;
+ scope.$apply();
+ });
+
+ downloadMetaData();
+ });
+ //});
+
+ //listen to user selection, and inform angular
+ selection.setListenerFunction(setSelectedOu, true);
+ function setSelectedOu(ids, names) {
+ var ou = {id: ids[0], name: names[0]};
+ $timeout(function () {
+ scope.selectedOrgUnit = ou;
+ scope.$apply();
+ });
+ }
+ }
+ };
+})
+;
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-10-21 20:58:53 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-10-22 10:28:56 +0000
@@ -5,7 +5,6 @@
function($rootScope,
$scope,
$location,
- $route,
$modal,
$timeout,
$filter,
@@ -364,7 +363,7 @@
$scope.back = function(){
$location.path('/').search({program: $scope.selectedProgramId});
- $route.reload();
+ //$route.reload();
};
$scope.displayEnrollment = false;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-06-02 12:25:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-10-22 10:28:56 +0000
@@ -4,6 +4,62 @@
var trackerCaptureDirectives = angular.module('trackerCaptureDirectives', [])
+.directive('selectedOrgUnit', function ($timeout, OrgUnitService, SessionStorageService) {
+ return {
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ //once ou tree is loaded, start meta-data download
+ //$(function () {
+ if( dhis2.tc && dhis2.tc.metaDataCached ){
+ selection.load();
+ $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {
+ console.log('Finished loading orgunit tree');
+
+ //Disable ou selection until meta-data has downloaded
+ $("#orgUnitTree").addClass("disable-clicks");
+
+ var ouId = SessionStorageService.get('ouSelected');
+ OrgUnitService.get(ouId).then(function(ou){
+ if(ou && ou.id && ou.name){
+ $timeout(function () {
+ scope.selectedOrgUnit = ou;
+ scope.treeLoaded = true;
+ scope.$apply();
+ });
+ }
+ });
+ });
+ }
+ else{
+ $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {
+ console.log('Finished loading orgunit tree');
+
+ //Disable ou selection until meta-data has downloaded
+ $("#orgUnitTree").addClass("disable-clicks");
+
+ $timeout(function () {
+ scope.treeLoaded = true;
+ scope.$apply();
+ });
+
+ downloadMetaData();
+ });
+ }
+ //});
+
+ //listen to user selection, and inform angular
+ selection.setListenerFunction(setSelectedOu, true);
+ function setSelectedOu(ids, names) {
+ var ou = {id: ids[0], name: names[0]};
+ $timeout(function () {
+ scope.selectedOrgUnit = ou;
+ scope.$apply();
+ });
+ }
+ }
+ };
+})
+
.directive('eventPaginator', function factory() {
return {
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js 2015-10-21 10:04:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js 2015-10-22 10:28:56 +0000
@@ -46,56 +46,6 @@
};
})
-.directive('selectedOrgUnit', function ($timeout, OrgUnitService, SessionStorageService) {
- return {
- restrict: 'A',
- link: function (scope, element, attrs) {
- //once ou tree is loaded, start meta-data download
- $(function () {
- dhis2.ou.store.open().done(function () {
- if(dhis2.tc && dhis2.tc.metaDataCached){
- selection.load();
- var ouId = SessionStorageService.get('ouSelected');
- OrgUnitService.get(ouId).then(function(ou){
- if(ou && ou.id && ou.name){
- $timeout(function () {
- scope.selectedOrgUnit = ou;
- scope.treeLoaded = true;
- scope.$apply();
- });
- }
- });
- }
- else{
- $( '#orgUnitTree' ).one( 'ouwtLoaded', function( event, ids, names ){
- console.log('Finished loading orgunit tree');
- //Disable ou selection until meta-data has downloaded
- $("#orgUnitTree").addClass("disable-clicks");
-
- $timeout(function () {
- scope.treeLoaded = true;
- scope.$apply();
- });
-
- downloadMetaData();
- });
- }
- });
- });
-
- //listen to user selection, and inform angular
- selection.setListenerFunction(setSelectedOu, true);
- function setSelectedOu(ids, names) {
- var ou = {id: ids[0], name: names[0]};
- $timeout(function () {
- scope.selectedOrgUnit = ou;
- scope.$apply();
- });
- }
- }
- };
-})
-
.directive('blurOrChange', function () {
return function (scope, elem, attrs) {