Skip to content

Commit

Permalink
(js) Improve handling of reminders on tasks
Browse files Browse the repository at this point in the history
Fixes #4456
  • Loading branch information
cgx committed Apr 27, 2018
1 parent b0e59f9 commit e375575
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox
Expand Up @@ -236,7 +236,8 @@
ng-show="editor.component.start || editor.component.due">
<!-- reminder -->
<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"/>
</md-checkbox>
<div flex-offset="5"
Expand Down
5 changes: 3 additions & 2 deletions UI/WebServerResources/js/Scheduler/ComponentController.js
Expand Up @@ -358,7 +358,7 @@
}

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.due && vm.component.alarm.relation == 'END'))) {
form.alarmRelation.$setValidity('alarm', false);
Expand All @@ -368,7 +368,7 @@
}
}

function onAlarmChange(event) {
function onAlarmChange(form) {
if (vm.component.type !== 'task') {
return;
}
Expand All @@ -377,6 +377,7 @@
} else if (!vm.component.due && vm.component.alarm.relation == 'END') {
vm.component.alarm.relation = 'START';
}
changeAlarmRelation(form);
}

function save(form, options) {
Expand Down

0 comments on commit e375575

Please sign in to comment.