[Time Conductor] Validate start/end times

This commit is contained in:
Victor Woeltjen 2016-01-11 15:08:56 -08:00
parent e5cf419697
commit 5b0c0e1278
2 changed files with 13 additions and 2 deletions

View File

@ -25,7 +25,7 @@
<span class="l-time-range-inputs-elem ui-symbol type-icon">&#x43;</span>
<span class="l-time-range-input">
<mct-control key="'datetime-field'"
structure="{ format: parameters.format }"
structure="{ format: parameters.format, validate: validateStart }"
ng-model="formModel"
ng-blur="updateBoundsFromForm()"
field="'start'"
@ -37,7 +37,7 @@
<span class="l-time-range-input" ng-controller="ToggleController as t2">
<mct-control key="'datetime-field'"
structure="{ format: parameters.format }"
structure="{ format: parameters.format, validate: validateEnd }"
ng-model="formModel"
ng-blur="updateBoundsFromForm()"
field="'end'"

View File

@ -240,6 +240,14 @@ define(
};
}
function validateStart(startValue) {
return startValue <= $scope.ngModel.outer.end - outerMinimumSpan;
}
function validateEnd(endValue) {
return endValue >= $scope.ngModel.outer.start + outerMinimumSpan;
}
$scope.startLeftDrag = startLeftDrag;
$scope.startRightDrag = startRightDrag;
$scope.startMiddleDrag = startMiddleDrag;
@ -249,6 +257,9 @@ define(
$scope.updateBoundsFromForm = updateBoundsFromForm;
$scope.validateStart = validateStart;
$scope.validateEnd = validateEnd;
$scope.ticks = [];
// Initialize scope to defaults