(js) Disable submit btn while saving event or task

Fixes #3880
This commit is contained in:
Francis Lachapelle
2016-11-04 14:29:54 -04:00
parent fb7a83f44a
commit 7c02b4bf88
5 changed files with 42 additions and 26 deletions
@@ -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)
@@ -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 = [];