mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-06 05:57:59 +00:00
(js) Improve event editor
- fixed form validity check; - fixed alarm restoration after a reset; - fixed recurrence rules check.
This commit is contained in:
@@ -303,7 +303,7 @@
|
||||
<var:string label:value="Reset"/>
|
||||
</md-button>
|
||||
<md-button class="md-primary" type="submit"
|
||||
ng-disabled="eventForm.$pristine || eventForm.$invalid || eventForm.$submitted">
|
||||
ng-disabled="eventForm.$invalid || eventForm.$submitted">
|
||||
<var:string label:value="Save"/>
|
||||
</md-button>
|
||||
</md-dialog-actions>
|
||||
|
||||
@@ -565,11 +565,15 @@
|
||||
this.repeat.frequency = 'never';
|
||||
if (angular.isUndefined(this.repeat.interval))
|
||||
this.repeat.interval = 1;
|
||||
if (angular.isUndefined(this.repeat.month))
|
||||
this.repeat.month = { occurrence: '1', day: 'SU', type: 'bymonthday' };
|
||||
if (angular.isUndefined(this.repeat.monthdays))
|
||||
// TODO: initialize this.repeat.monthdays with month day of start date
|
||||
this.repeat.monthdays = [];
|
||||
else if (this.repeat.monthdays.length > 0)
|
||||
this.repeat.month = { type: 'bymonthday' };
|
||||
if (angular.isUndefined(this.repeat.month))
|
||||
this.repeat.month = {};
|
||||
if (angular.isUndefined(this.repeat.month.occurrence))
|
||||
angular.extend(this.repeat.month, { occurrence: '1', day: 'SU' });
|
||||
if (angular.isUndefined(this.repeat.months))
|
||||
// TODO: initialize this.repeat.months with month of start date
|
||||
this.repeat.months = [];
|
||||
@@ -607,7 +611,7 @@
|
||||
_this.sendAppointmentNotifications = Component.$Preferences.defaults.SOGoAppointmentSendEMailNotifications;
|
||||
});
|
||||
}
|
||||
else {
|
||||
else if (angular.isUndefined(data.$hasAlarm)) {
|
||||
this.$hasAlarm = angular.isDefined(data.alarm);
|
||||
}
|
||||
|
||||
@@ -639,10 +643,10 @@
|
||||
Component.prototype.hasCustomRepeat = function() {
|
||||
var b = angular.isDefined(this.repeat) &&
|
||||
(this.repeat.interval > 1 ||
|
||||
this.repeat.days && this.repeat.days.length > 0 ||
|
||||
this.repeat.monthdays && this.repeat.monthdays.length > 0 ||
|
||||
this.repeat.months && this.repeat.months.length > 0 ||
|
||||
this.repeat.month && this.repeat.month.day);
|
||||
angular.isDefined(this.repeat.days) && this.repeat.days.length > 0 ||
|
||||
angular.isDefined(this.repeat.monthdays) && this.repeat.monthdays.length > 0 ||
|
||||
angular.isDefined(this.repeat.months) && this.repeat.months.length > 0 ||
|
||||
angular.isDefined(this.repeat.month) && angular.isDefined(this.repeat.month.type));
|
||||
return b;
|
||||
};
|
||||
|
||||
@@ -1257,7 +1261,7 @@
|
||||
var component = {};
|
||||
angular.forEach(this, function(value, key) {
|
||||
if (key != 'constructor' &&
|
||||
key[0] != '$' &&
|
||||
(key == '$hasAlarm' || key[0] != '$') &&
|
||||
key != 'blocks') {
|
||||
component[key] = angular.copy(value);
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@
|
||||
|
||||
c.$reply().then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
$mdDialog.hide();
|
||||
Alarm.getAlarms();
|
||||
$mdDialog.hide();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@
|
||||
vm.categories = {};
|
||||
vm.showRecurrenceEditor = vm.component.$hasCustomRepeat;
|
||||
vm.toggleRecurrenceEditor = toggleRecurrenceEditor;
|
||||
vm.recurrenceMonthDaysAreRequired = recurrenceMonthDaysAreRequired;
|
||||
vm.showAttendeesEditor = false;
|
||||
vm.toggleAttendeesEditor = toggleAttendeesEditor;
|
||||
//vm.searchText = null;
|
||||
@@ -263,6 +264,11 @@
|
||||
vm.showAttendeesEditor = !vm.showAttendeesEditor;
|
||||
}
|
||||
|
||||
function recurrenceMonthDaysAreRequired() {
|
||||
return vm.component.repeat.frequency == 'monthly' &&
|
||||
vm.component.repeat.month.type == 'bymonthday';
|
||||
}
|
||||
|
||||
// Autocomplete cards for attendees
|
||||
function cardFilter($query) {
|
||||
AddressBook.$filterAll($query);
|
||||
@@ -308,8 +314,11 @@
|
||||
Alarm.getAlarms();
|
||||
$mdDialog.hide();
|
||||
}, function(response) {
|
||||
if (response.status == CalendarSettings.ConflictHTTPErrorCode)
|
||||
if (response.status == CalendarSettings.ConflictHTTPErrorCode &&
|
||||
_.isObject(response.data.message))
|
||||
vm.attendeeConflictError = response.data.message;
|
||||
else
|
||||
edit(form);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user