Small code simplification
This commit is contained in:
parent
d42ca55bfc
commit
915035e9ba
1 changed files with 6 additions and 12 deletions
|
@ -3609,25 +3609,19 @@ function rcube_calendar_ui(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
var id = this.value;
|
var id = this.value;
|
||||||
if (me.calendars[id]) { // add or remove event source on click
|
|
||||||
var action;
|
|
||||||
if (this.checked) {
|
|
||||||
action = 'addEventSource';
|
|
||||||
me.calendars[id].active = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
action = 'removeEventSource';
|
|
||||||
me.calendars[id].active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// add or remove event source on click
|
||||||
|
if (me.calendars[id]) {
|
||||||
// adjust checked state of original list item
|
// adjust checked state of original list item
|
||||||
if (calendars_list.is_search()) {
|
if (calendars_list.is_search()) {
|
||||||
calendars_list.container.find('input[value="'+id+'"]').prop('checked', this.checked);
|
calendars_list.container.find('input[value="'+id+'"]').prop('checked', this.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me.calendars[id].active = this.checked;
|
||||||
|
|
||||||
// add/remove event source
|
// add/remove event source
|
||||||
fc.fullCalendar(action, me.calendars[id]);
|
fc.fullCalendar(this.checked ? 'addEventSource' : 'removeEventSource', me.calendars[id]);
|
||||||
rcmail.http_post('calendar', { action:'subscribe', c:{ id:id, active:me.calendars[id].active?1:0 } });
|
rcmail.http_post('calendar', {action: 'subscribe', c: {id: id, active: this.checked ? 1 : 0}});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('keypress', 'input[type=checkbox]', function(e) {
|
.on('keypress', 'input[type=checkbox]', function(e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue