dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40930
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20851: tracker-capture: use a different approach of integrating angular with ouwt.js
------------------------------------------------------------
revno: 20851
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-22 13:47:52 +0200
message:
tracker-capture: use a different approach of integrating angular with ouwt.js
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/index.html
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/tracker-capture.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html
--
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-10-22 10:28:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2015-10-22 11:47:52 +0000
@@ -8,21 +8,19 @@
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();
+ //once ou tree is loaded, start meta-data download
+ $( '#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);
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-10-02 10:23:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-10-22 11:47:52 +0000
@@ -72,8 +72,8 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
- <script src="../dhis-web-commons/ouwt/ouwt.js"></script>
- <script src="scripts/tracker-capture.js"></script>
+ <!--<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
+ <script src="scripts/tracker-capture.js"></script>-->
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/select.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/select2.js"></script>
=== 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-10-22 10:28:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-10-22 11:47:52 +0000
@@ -9,43 +9,42 @@
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();
- });
- }
- //});
+
+ if( dhis2.tc && dhis2.tc.metaDataCached ){
+ $("#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);
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-10-20 09:44:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-10-22 11:47:52 +0000
@@ -14,7 +14,7 @@
var attributesInPromise = [];
dhis2.tc.store = null;
-dhis2.tc.metaDataCached = false;
+dhis2.tc.metaDataCached = dhis2.tc.metaDataCached || false;
dhis2.tc.memoryOnly = $('html').hasClass('ie7') || $('html').hasClass('ie8');
var adapters = [];
if( dhis2.tc.memoryOnly ) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-10-21 10:04:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-10-22 11:47:52 +0000
@@ -24,9 +24,13 @@
$(window).resize(function () {
$("#selectDropDown").width($("#selectDropDownParent").width());
$("#searchDropDown").width($("#searchDropDownParent").width());
- });
+ });
+
</script>
+<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
+<script src="scripts/tracker-capture.js"></script>
+
<span id="showLeftBar">
<a href="javascript:dhis2.leftBar.showAnimated()" title="$i18n.getString('show_menu' )"><i class="fa fa-arrow-right leftBarIcon"></i></a>
</span>