(fix) improved the start/end delta handling and fixed the attendees viewer

pull/110/head
Ludovic Marcotte 2015-10-07 14:42:37 -04:00
parent 74eb0846e8
commit e6be7e00ba
2 changed files with 17 additions and 15 deletions

View File

@ -401,6 +401,8 @@
Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
});
this.delta = 60;
if (this.startDate)
this.start = new Date(this.startDate.substring(0,10) + ' ' + this.startDate.substring(11,16));
else if (this.type == 'appointment') {
@ -413,7 +415,7 @@
else if (this.type == 'appointment') {
this.end = new Date();
this.end.setMinutes(Math.round(this.end.getMinutes()/15)*15);
this.end.addHours(1);
this.end.addMinutes(this.delta);
}
if (this.dueDate)

View File

@ -168,23 +168,23 @@
hours: getHours()
};
$scope.$watch('editor.component.startDate', function(newStartDate, oldStartDate) {
if (newStartDate) {
$timeout(function() {
vm.component.start = new Date(newStartDate.substring(0,10) + ' ' + newStartDate.substring(11,16));
vm.component.freebusy = vm.component.updateFreeBusyCoverage();
vm.attendeesEditor.days = getDays();
});
$scope.$watch('editor.component.start', function(newStartDate, oldStartDate) {
if (vm.component.type == 'appointment') {
vm.component.end = new Date(vm.component.start);
vm.component.end.addMinutes(vm.component.delta);
vm.component.freebusy = vm.component.updateFreeBusyCoverage();
vm.attendeesEditor.days = getDays();
}
});
$scope.$watch('editor.component.endDate', function(newEndDate, oldEndDate) {
if (newEndDate) {
$timeout(function() {
vm.component.end = new Date(newEndDate.substring(0,10) + ' ' + newEndDate.substring(11,16));
vm.component.freebusy = vm.component.updateFreeBusyCoverage();
vm.attendeesEditor.days = getDays();
});
$scope.$watch('editor.component.end', function(newEndDate, oldEndDate) {
if (newEndDate <= vm.component.start) {
vm.component.end = oldEndDate;
}
else {
vm.component.delta = Math.floor((Math.abs(vm.component.end-vm.component.start)/1000)/60);
vm.component.freebusy = vm.component.updateFreeBusyCoverage();
vm.attendeesEditor.days = getDays();
}
});