← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15145: minor change in period generator

 

------------------------------------------------------------
revno: 15145
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-05 11:19:56 +0700
message:
  minor change in period generator
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-04-29 15:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-05-05 04:19:56 +0000
@@ -65,8 +65,7 @@
  * @param options Additional options, will be merged with the defaults
  */
 dhis2.period.DatePicker.prototype.createInstance = function( el, options ) {
-  var mergedOptions = $.extend({}, this.defaults, options);
-  $(el).calendarsPicker(mergedOptions);
+  $(el).calendarsPicker($.extend({}, this.defaults, options));
 };
 
 /**
@@ -93,11 +92,9 @@
 
   $fromEl.calendarsPicker(mergedOptions);
 
-  var toOptions = $.extend({}, mergedOptions, {
+  $toEl.calendarsPicker($.extend({}, mergedOptions, {
     maxDate: null
-  });
-
-  $toEl.calendarsPicker(toOptions);
+  }));
 
   $fromEl.calendarsPicker("setDate", $fromEl.calendarsPicker("getDate"));
   $toEl.calendarsPicker("setDate", $toEl.calendarsPicker("getDate"));
@@ -127,7 +124,7 @@
 
   this.format = format;
 
-  this.periodTypes = {
+  this.generators = {
     "Daily": dhis2.period.makeDailyPeriodGenerator(calendar, format),
     "Weekly": dhis2.period.makeWeeklyPeriodGenerator(calendar, format),
     "Monthly": dhis2.period.makeMonthlyPeriodGenerator(calendar, format),
@@ -146,7 +143,7 @@
  * @returns Object All available period generators
  */
 dhis2.period.PeriodGenerator.prototype.getAll = function() {
-  return this.periodTypes;
+  return this.generators;
 };
 
 /**
@@ -168,7 +165,7 @@
  * @returns Wanted generator if it exists
  */
 dhis2.period.PeriodGenerator.prototype.get = function( generator ) {
-  return this.periodTypes[generator];
+  return this.generators[generator];
 };
 
 /**
@@ -177,7 +174,7 @@
  * @returns Array of periods
  */
 dhis2.period.PeriodGenerator.prototype.generatePeriods = function( generator, offset ) {
-  return this.periodTypes[generator].generatePeriods(offset);
+  return this.generators[generator].generatePeriods(offset);
 };
 
 /**
@@ -186,7 +183,7 @@
  * @returns Array of periods
  */
 dhis2.period.PeriodGenerator.prototype.generateReversedPeriods = function( generator, offset ) {
-  return this.reverse(this.periodTypes[generator].generatePeriods(offset));
+  return this.reverse(this.generators[generator].generatePeriods(offset));
 };
 
 /**