mirror of
https://github.com/ansible/awx.git
synced 2026-02-18 11:40:05 -03:30
[system_tracking] Update right date when left is changed to something greater
This commit is contained in:
@@ -13,7 +13,8 @@ export default
|
|||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
date: '=',
|
date: '=',
|
||||||
minDate: '='
|
minDate: '=',
|
||||||
|
autoUpdate: '=?'
|
||||||
},
|
},
|
||||||
templateUrl: '/static/js/system-tracking/date-picker/date-picker.partial.html',
|
templateUrl: '/static/js/system-tracking/date-picker/date-picker.partial.html',
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
@@ -21,10 +22,16 @@ export default
|
|||||||
// We need to make sure this _never_ recurses, which sometimes happens
|
// We need to make sure this _never_ recurses, which sometimes happens
|
||||||
// with two-way binding.
|
// with two-way binding.
|
||||||
var mustUpdateValue = true;
|
var mustUpdateValue = true;
|
||||||
|
scope.autoUpdate = scope.autoUpdate === false ? false : true;
|
||||||
|
|
||||||
scope.$watch('minDate', function(newValue) {
|
scope.$watch('minDate', function(newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
$('.date', element).systemTrackingDP('setStartDate', newValue.toString());
|
|
||||||
|
if (scope.autoUpdate && scope.date.isBefore(newValue)) {
|
||||||
|
scope.date = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.date', element).systemTrackingDP('setStartDate', newValue.toDate());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user