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

testing

parent 2c4ee263
......@@ -505,11 +505,11 @@ var STWkit;
self.backwardButton.textContent = 'Backward';
self.forwardButton.onclick = function () {
self.forward = true;
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.backwardButton.onclick = function () {
self.forward = false;
self.updateFromStartDate();
self.updateFromStartDate(true);
};
var clearDiv = L.DomUtil.create('div', 'uk-clearfix', periodDiv);
var clearButton = L.DomUtil.create('button', 'uk-button uk-margin-top uk-align-left', clearDiv);
......@@ -567,13 +567,13 @@ var STWkit;
self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + '';
}
}
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.startDateInput.onchange = function (evt) {
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.startTimeInput.onchange = function (evt) {
self.updateFromStartDate();
self.updateFromStartDate(true);
};
UIkit.ready(function () {
if (!self.ready) {
......@@ -612,11 +612,11 @@ var STWkit;
return;
self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate();
self.updateFromStartDate(true);
}
if ((typeof changeCard.durationhours !== 'undefined')) {
self.durationHours.value = changeCard.durationhours;
self.updateFromStartDate();
self.updateFromStartDate(false);
}
};
PeriodCard.prototype.isDateValid = function (date) {
......@@ -699,7 +699,7 @@ var STWkit;
self.forwardButton.click();
else {
self.forward = true;
self.updateFromStartDate();
self.updateFromStartDate(true);
}
};
PeriodCard.prototype.populateCard = function (geojson) {
......@@ -733,7 +733,7 @@ var STWkit;
geojson.features[0].properties["simulation"]["stopDate"] = self.from.valueOf();
}
};
PeriodCard.prototype.updateFromStartDate = function () {
PeriodCard.prototype.updateFromStartDate = function (validate) {
var self = this;
var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat);
if (self.forward) {
......@@ -746,7 +746,7 @@ var STWkit;
}
self.adjustDateToRange();
self.updateSlider();
if (self.ready)
if (self.ready && validate)
self.validate();
};
PeriodCard.prototype.getInitDate = function () {
......@@ -766,7 +766,7 @@ var STWkit;
self.startDateInput.value = initDate.format(self.dateFormat);
self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
self.durationHours.value = '0';
self.updateFromStartDate();
self.updateFromStartDate(true);
};
return PeriodCard;
}(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 {
self.forwardButton.onclick = function () {
self.forward = true;
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.backwardButton.onclick = function () {
self.forward = false;
self.updateFromStartDate();
self.updateFromStartDate(true);
};
var clearDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-clearfix', periodDiv);
......@@ -621,15 +621,15 @@ module STWkit {
self.durationHours.value = moment.duration(self.to.diff(self.from)).asHours() + '';
}
}
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.startDateInput.onchange = function (evt) {
self.updateFromStartDate();
self.updateFromStartDate(true);
};
self.startTimeInput.onchange = function (evt) {
self.updateFromStartDate();
self.updateFromStartDate(true);
};
......@@ -674,11 +674,11 @@ module STWkit {
if (date.isBefore(self.minDate) || date.isAfter(self.maxDate)) return;
self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate();
self.updateFromStartDate(true);
}
if ((typeof changeCard.durationhours !== 'undefined')) {
self.durationHours.value = changeCard.durationhours;
self.updateFromStartDate();
self.updateFromStartDate(false);
}
}
......@@ -763,7 +763,7 @@ module STWkit {
self.forwardButton.click();
else {
self.forward = true;
self.updateFromStartDate();
self.updateFromStartDate(true);
}
}
......@@ -798,7 +798,7 @@ module STWkit {
}
}
private updateFromStartDate() {
private updateFromStartDate(validate) {
var self = this;
var date = moment.utc(self.startDateInput.value + ' ' + self.startTimeInput.value, self.datetimeFormat)
if (self.forward) {
......@@ -811,7 +811,7 @@ module STWkit {
self.adjustDateToRange();
self.updateSlider();
if (self.ready) self.validate();
if (self.ready && validate) self.validate();
}
private getInitDate() {
......@@ -832,7 +832,7 @@ module STWkit {
self.startDateInput.value = initDate.format(self.dateFormat);
self.startTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
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