← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12477: minor fixes in tracker saveVal, add new file jquery.plugins.js, used for cases where we want to e...

 

------------------------------------------------------------
revno: 12477
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-07 16:22:45 +0200
message:
  minor fixes in tracker saveVal, add new file jquery.plugins.js, used for cases where we want to extend the jquery object, this is best used in cases where you want action performed on an array of selected dom elements, but can also be used for utility methods like $.trimArray ($.trims an array)
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.plugins.js
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm


--
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-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-08-23 16:12:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-10-07 14:22:45 +0000
@@ -15,6 +15,7 @@
 ../dhis-web-commons/css/print.css
 ../favicon.ico
 ../dhis-web-commons/javascripts/jQuery/jquery.min.js
+../dhis-web-commons/javascripts/jQuery/jquery.plugins.js
 ../dhis-web-commons/javascripts/jQuery/jquery.metadata.js
 ../dhis-web-commons/javascripts/jQuery/jquery.glob.js
 ../dhis-web-commons/javascripts/jQuery/jquery.date.js

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-09-19 03:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-10-07 14:22:45 +0000
@@ -15,15 +15,12 @@
 
     var fieldValue = jQuery.trim( field.value );
     var arrData = jQuery( "#" + fieldId ).attr( 'data' ).replace( '{', '' ).replace( '}', '' ).replace( /'/g, "" ).split( ',' );
-    var data = new Array();
-
-    for ( var i in arrData ) {
-        var values = arrData[i].split( ':' );
-        var key = jQuery.trim( values[0] );
-        var value = jQuery.trim( values[1] );
-
-        data[key] = value;
-    }
+    var data = [];
+
+    $.each(arrData, function() {
+        var values = $.trimArray(this.split(':'));
+        data[values[0]] = values[1];
+    });
 
     var dataElementName = data['deName'];
     var type = data['deType'];

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-09-30 15:52:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-10-07 14:22:45 +0000
@@ -10,6 +10,7 @@
 ../dhis-web-dataentry/style/dhis-web-dataentry.css
 ../favicon.ico
 javascripts/jQuery/jquery.min.js
+javascripts/jQuery/jquery.plugins.js
 javascripts/jQuery/jquery.metadata.js
 javascripts/jQuery/jquery.glob.js
 javascripts/jQuery/jquery.date.js

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.plugins.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.plugins.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.plugins.js	2013-10-07 14:22:45 +0000
@@ -0,0 +1,19 @@
+
+// internal 'plugins' that touches jquery core
+
+;(function( $, window, document, undefined ) {
+
+    // iterate over and trim every item of an array
+    $.trimArray = function( arr ) {
+        if( !$.isArray(arr) ) {
+            throw new Error('requires an array as argument')
+        }
+
+        for( var i = 0, len = arr.length; i < len; i++ ) {
+            arr[i] = $.trim(arr[i]);
+        }
+
+        return arr;
+    }
+
+})(jQuery, window, document);

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm	2013-10-04 16:25:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm	2013-10-07 14:22:45 +0000
@@ -19,6 +19,7 @@
     </script>
 
     <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
+    <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.plugins.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.ext.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.metadata.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.tablesorter.min.js"></script>