Commit 624881e4 authored by Pettersson Tomas's avatar Pettersson Tomas

testing

parent 2c4ee263
...@@ -505,11 +505,11 @@ var STWkit; ...@@ -505,11 +505,11 @@ var STWkit;
self.backwardButton.textContent = 'Backward'; self.backwardButton.textContent = 'Backward';
self.forwardButton.onclick = function () { self.forwardButton.onclick = function () {
self.forward = true; self.forward = true;
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.backwardButton.onclick = function () { self.backwardButton.onclick = function () {
self.forward = false; self.forward = false;
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
var clearDiv = L.DomUtil.create('div', 'uk-clearfix', periodDiv); var clearDiv = L.DomUtil.create('div', 'uk-clearfix', periodDiv);
var clearButton = L.DomUtil.create('button', 'uk-button uk-margin-top uk-align-left', clearDiv); var clearButton = L.DomUtil.create('button', 'uk-button uk-margin-top uk-align-left', clearDiv);
...@@ -567,13 +567,13 @@ var STWkit; ...@@ -567,13 +567,13 @@ var STWkit;
self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + ''; self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + '';
} }
} }
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.startDateInput.onchange = function (evt) { self.startDateInput.onchange = function (evt) {
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.startTimeInput.onchange = function (evt) { self.startTimeInput.onchange = function (evt) {
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
UIkit.ready(function () { UIkit.ready(function () {
if (!self.ready) { if (!self.ready) {
...@@ -612,11 +612,11 @@ var STWkit; ...@@ -612,11 +612,11 @@ var STWkit;
return; return;
self.startDateInput.value = changeCard.obsDateInput.value; self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value; self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate(); self.updateFromStartDate(true);
} }
if ((typeof changeCard.durationhours !== 'undefined')) { if ((typeof changeCard.durationhours !== 'undefined')) {
self.durationHours.value = changeCard.durationhours; self.durationHours.value = changeCard.durationhours;
self.updateFromStartDate(); self.updateFromStartDate(false);
} }
}; };
PeriodCard.prototype.isDateValid = function (date) { PeriodCard.prototype.isDateValid = function (date) {
...@@ -699,7 +699,7 @@ var STWkit; ...@@ -699,7 +699,7 @@ var STWkit;
self.forwardButton.click(); self.forwardButton.click();
else { else {
self.forward = true; self.forward = true;
self.updateFromStartDate(); self.updateFromStartDate(true);
} }
}; };
PeriodCard.prototype.populateCard = function (geojson) { PeriodCard.prototype.populateCard = function (geojson) {
...@@ -733,7 +733,7 @@ var STWkit; ...@@ -733,7 +733,7 @@ var STWkit;
geojson.features[0].properties["simulation"]["stopDate"] = self.from.valueOf(); geojson.features[0].properties["simulation"]["stopDate"] = self.from.valueOf();
} }
}; };
PeriodCard.prototype.updateFromStartDate = function () { PeriodCard.prototype.updateFromStartDate = function (validate) {
var self = this; var self = this;
var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat); var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat);
if (self.forward) { if (self.forward) {
...@@ -746,7 +746,7 @@ var STWkit; ...@@ -746,7 +746,7 @@ var STWkit;
} }
self.adjustDateToRange(); self.adjustDateToRange();
self.updateSlider(); self.updateSlider();
if (self.ready) if (self.ready && validate)
self.validate(); self.validate();
}; };
PeriodCard.prototype.getInitDate = function () { PeriodCard.prototype.getInitDate = function () {
...@@ -766,7 +766,7 @@ var STWkit; ...@@ -766,7 +766,7 @@ var STWkit;
self.startDateInput.value = initDate.format(self.dateFormat); self.startDateInput.value = initDate.format(self.dateFormat);
self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat); self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
self.durationHours.value = '0'; self.durationHours.value = '0';
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
return PeriodCard; return PeriodCard;
}(AccordionCard)); }(AccordionCard));
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -556,11 +556,11 @@ module STWkit { ...@@ -556,11 +556,11 @@ module STWkit {
self.forwardButton.onclick = function () { self.forwardButton.onclick = function () {
self.forward = true; self.forward = true;
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.backwardButton.onclick = function () { self.backwardButton.onclick = function () {
self.forward = false; self.forward = false;
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
var clearDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-clearfix', periodDiv); var clearDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-clearfix', periodDiv);
...@@ -621,15 +621,15 @@ module STWkit { ...@@ -621,15 +621,15 @@ module STWkit {
self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + ''; self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + '';
} }
} }
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.startDateInput.onchange = function (evt) { self.startDateInput.onchange = function (evt) {
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
self.startTimeInput.onchange = function (evt) { self.startTimeInput.onchange = function (evt) {
self.updateFromStartDate(); self.updateFromStartDate(true);
}; };
...@@ -674,11 +674,11 @@ module STWkit { ...@@ -674,11 +674,11 @@ module STWkit {
if (date.isBefore(self.minDate) || date.isAfter(self.maxDate)) return; if (date.isBefore(self.minDate) || date.isAfter(self.maxDate)) return;
self.startDateInput.value = changeCard.obsDateInput.value; self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value; self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate(); self.updateFromStartDate(true);
} }
if ((typeof changeCard.durationhours !== 'undefined')) { if ((typeof changeCard.durationhours !== 'undefined')) {
self.durationHours.value = changeCard.durationhours; self.durationHours.value = changeCard.durationhours;
self.updateFromStartDate(); self.updateFromStartDate(false);
} }
} }
...@@ -763,7 +763,7 @@ module STWkit { ...@@ -763,7 +763,7 @@ module STWkit {
self.forwardButton.click(); self.forwardButton.click();
else { else {
self.forward = true; self.forward = true;
self.updateFromStartDate(); self.updateFromStartDate(true);
} }
} }
...@@ -798,7 +798,7 @@ module STWkit { ...@@ -798,7 +798,7 @@ module STWkit {
} }
} }
private updateFromStartDate() { private updateFromStartDate(validate) {
var self = this; var self = this;
var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat) var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat)
if (self.forward) { if (self.forward) {
...@@ -811,7 +811,7 @@ module STWkit { ...@@ -811,7 +811,7 @@ module STWkit {
self.adjustDateToRange(); self.adjustDateToRange();
self.updateSlider(); self.updateSlider();
if (self.ready) self.validate(); if (self.ready && validate) self.validate();
} }
private getInitDate() { private getInitDate() {
...@@ -832,7 +832,7 @@ module STWkit { ...@@ -832,7 +832,7 @@ module STWkit {
self.startDateInput.value = initDate.format(self.dateFormat); self.startDateInput.value = initDate.format(self.dateFormat);
self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat); self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
self.durationHours.value = '0'; self.durationHours.value = '0';
self.updateFromStartDate(); self.updateFromStartDate(true);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment