[Time Conductor] Wire in datetime pickers

WTD-1515
This commit is contained in:
Victor Woeltjen 2015-09-15 18:48:00 -07:00
parent 9a78b63065
commit 70d9587c9b
3 changed files with 31 additions and 15 deletions

View File

@ -22,12 +22,9 @@
<div class="l-time-controller" ng-controller="TimeRangeController">
<div class="l-time-range-inputs-holder">
Start: {{ngModel.outer.start}}
Start: {{startOuterText}}
<span ng-controller="ToggleController as t">
<a class="ui-symbol" ng-click="t.toggle()">
p
</a>
<a class="ui-symbol" ng-click="t.toggle()">p</a>
<mct-popup ng-if="t.isActive()">
<div style="background: #555;"
mct-click-elsewhere="t.setState(false)">
@ -39,7 +36,22 @@
</div>
</mct-popup>
</span>
End: <input type="date" ng-model="endOuterDate"/>
End: {{endOuterText}}
<span ng-controller="ToggleController as t2">
<a class="ui-symbol" ng-click="t2.toggle()">p</a>
<mct-popup ng-if="t2.isActive()">
<div style="background: #555;"
mct-click-elsewhere="t2.setState(false)">
<mct-control key="'datetime-picker'"
ng-model="ngModel.outer"
field="'end'"
options="{ hours: true }">
</mct-control>
</div>
</mct-popup>
</span>
</div>

View File

@ -172,29 +172,31 @@ define(
updateViewFromModel($scope.ngModel);
}
function updateOuterStart(date) {
function updateOuterStart(t) {
var ngModel = $scope.ngModel;
ngModel.outer.start =
date.getTime();
ngModel.outer.end =
Math.max(ngModel.outer.start, ngModel.outer.end);
ngModel.inner.start =
Math.max(ngModel.outer.start, ngModel.inner.start);
ngModel.inner.end =
Math.max(ngModel.outer.start, ngModel.inner.end);
$scope.startOuterText = formatTimestamp(t);
updateViewForInnerSpanFromModel(ngModel);
}
function updateOuterEnd(date) {
function updateOuterEnd(t) {
var ngModel = $scope.ngModel;
ngModel.outer.end =
date.getTime();
ngModel.outer.start =
Math.min(ngModel.outer.end, ngModel.outer.start);
ngModel.inner.start =
Math.min(ngModel.outer.end, ngModel.inner.start);
ngModel.inner.end =
Math.min(ngModel.outer.end, ngModel.inner.end);
$scope.endOuterText = formatTimestamp(t);
updateViewForInnerSpanFromModel(ngModel);
}
@ -213,8 +215,8 @@ define(
$scope.$watchCollection("ngModel", updateViewFromModel);
$scope.$watch("spanWidth", updateSpanWidth);
$scope.$watch("startOuterDate", updateOuterStart);
$scope.$watch("endOuterDate", updateOuterEnd);
$scope.$watch("ngModel.outer.start", updateOuterStart);
$scope.$watch("ngModel.outer.end", updateOuterEnd);
}
return TimeConductorController;

View File

@ -23,6 +23,8 @@
define(
function () {
'use strict';
var TEMPLATE = "<div></div>";
function MCTPopup($window, $document, $compile) {
@ -60,7 +62,7 @@ define(
transclude: true,
link: link,
scope: {}
}
};
}
return MCTPopup;