(js) Improve handling of reminders on tasks

Fixes #4456
pull/241/head
Francis Lachapelle 2018-04-27 09:05:20 -04:00
parent b0e59f9ac9
commit e375575436
2 changed files with 5 additions and 3 deletions

View File

@ -236,7 +236,8 @@
ng-show="editor.component.start || editor.component.due"> ng-show="editor.component.start || editor.component.due">
<!-- reminder --> <!-- reminder -->
<md-checkbox ng-model="editor.component.$hasAlarm" <md-checkbox ng-model="editor.component.$hasAlarm"
label:aria-label="Reminder"> label:aria-label="Reminder"
ng-change="editor.onAlarmChange(eventForm)">
<var:string label:value="Reminder"/> <var:string label:value="Reminder"/>
</md-checkbox> </md-checkbox>
<div flex-offset="5" <div flex-offset="5"

View File

@ -358,7 +358,7 @@
} }
function changeAlarmRelation(form) { function changeAlarmRelation(form) {
if (vm.component.type == 'task' && if (vm.component.type == 'task' && vm.component.$hasAlarm &&
((!vm.component.start && vm.component.alarm.relation == 'START') || ((!vm.component.start && vm.component.alarm.relation == 'START') ||
(!vm.component.due && vm.component.alarm.relation == 'END'))) { (!vm.component.due && vm.component.alarm.relation == 'END'))) {
form.alarmRelation.$setValidity('alarm', false); form.alarmRelation.$setValidity('alarm', false);
@ -368,7 +368,7 @@
} }
} }
function onAlarmChange(event) { function onAlarmChange(form) {
if (vm.component.type !== 'task') { if (vm.component.type !== 'task') {
return; return;
} }
@ -377,6 +377,7 @@
} else if (!vm.component.due && vm.component.alarm.relation == 'END') { } else if (!vm.component.due && vm.component.alarm.relation == 'END') {
vm.component.alarm.relation = 'START'; vm.component.alarm.relation = 'START';
} }
changeAlarmRelation(form);
} }
function save(form, options) { function save(form, options) {