From 7c02b4bf8863bafe2c7200d994ae14b18ad540d4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 4 Nov 2016 14:29:54 -0400 Subject: [PATCH] (js) Disable submit btn while saving event or task Fixes #3880 --- .../UIxAppointmentEditorTemplate.wox | 33 ++++++++++--------- UI/Templates/SchedulerUI/UIxCalMainView.wox | 2 +- .../SchedulerUI/UIxTaskEditorTemplate.wox | 8 +++-- .../js/Scheduler/Component.service.js | 4 +-- .../js/Scheduler/ComponentController.js | 21 +++++++++--- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox index 3734cf5065..0398ffd677 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox @@ -192,13 +192,14 @@ add -
+
-
- +
+ @@ -293,14 +294,16 @@ - + - + + ng-disabled="eventForm.$pristine || eventForm.$invalid || eventForm.$submitted"> @@ -308,9 +311,9 @@ -
-
- +
+
+ close
@@ -332,11 +335,11 @@
- + + ng-click="editor.edit(eventForm)">
{{editor.attendeeConflictError.reject}}
- + close - + + ng-click="editor.edit(eventForm)"> diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 6a9cd4da93..4c286be6fb 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -764,7 +764,7 @@

{{ ::'Warning' | loc }}

-

{{ ::'A time conflict exists with one or more attendees.\nWould you like to keep the current settings anyway?' | loc }}

+

person {{$AttendeeConflictDialogController.conflictError.attendee_name}} ({{$AttendeeConflictDialogController.conflictError.attendee_email}}) diff --git a/UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox b/UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox index d6dbda2222..4f244aad18 100644 --- a/UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox @@ -247,14 +247,16 @@
- + - + + ng-disabled="eventForm.$pristine || eventForm.$invalid || eventForm.$submitted"> diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index 2ff2045fc0..7870455f6a 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -1114,7 +1114,7 @@ component.completedDate = component.completed ? component.completed.format(dlp, '%Y-%m-%d') : ''; // Update recurrence definition depending on selections - if (this.$hasCustomRepeat) { + if (this.hasCustomRepeat()) { if (this.repeat.frequency == 'monthly' && this.repeat.month.type && this.repeat.month.type == 'byday' || this.repeat.frequency == 'yearly' && this.repeat.year.byday) { // BYDAY mask for a monthly or yearly recurrence @@ -1130,7 +1130,7 @@ else if (this.repeat.frequency && this.repeat.frequency != 'never') { component.repeat = { frequency: this.repeat.frequency }; } - if (component.startDate && this.repeat.frequency) { + if (component.startDate && this.repeat.frequency && this.repeat.frequency != 'never') { if (this.repeat.end == 'until' && this.repeat.until) component.repeat.until = this.repeat.until.stringWithSeparator('-'); else if (this.repeat.end == 'count' && this.repeat.count) diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index f246bdf122..831676f3a4 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -225,7 +225,9 @@ vm.removeAttendee = removeAttendee; vm.addAttachUrl = addAttachUrl; vm.priorityLevel = priorityLevel; + vm.reset = reset; vm.cancel = cancel; + vm.edit = edit; vm.save = save; vm.attendeeConflictError = false; vm.attendeesEditor = { @@ -302,19 +304,22 @@ vm.component.$save(options) .then(function(data) { $rootScope.$emit('calendars:list'); - $mdDialog.hide(); Alarm.getAlarms(); + $mdDialog.hide(); }, function(response) { - if (response.status == CalendarSettings.ConflictHTTPErrorCode && - response.data && response.data.message && - angular.isObject(response.data.message)) + if (response.status == CalendarSettings.ConflictHTTPErrorCode) vm.attendeeConflictError = response.data.message; }); } } - function cancel() { + function reset(form) { vm.component.$reset(); + form.$setPristine(); + } + + function cancel(form) { + reset(form); if (vm.component.isNew) { // Cancelling the creation of a component vm.component = null; @@ -322,6 +327,12 @@ $mdDialog.cancel(); } + function edit(form) { + vm.attendeeConflictError = false; + form.$setPristine(); + form.$setDirty(); + } + function getDays() { var days = [];