2015-05-29 02:27:25 +02:00
|
|
|
/**
|
|
|
|
* @provides javelin-behavior-recurring-edit
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
JX.behavior('recurring-edit', function(config) {
|
|
|
|
var checkbox = JX.$(config.isRecurring);
|
2015-06-08 00:57:19 +02:00
|
|
|
var frequency = JX.$(config.frequency);
|
|
|
|
var end_date = JX.$(config.recurrenceEndDate);
|
2015-06-02 03:56:11 +02:00
|
|
|
|
2015-06-08 00:57:19 +02:00
|
|
|
var end_date_checkbox = JX.DOM.find(end_date, 'input', 'calendar-enable');
|
2015-05-29 02:27:25 +02:00
|
|
|
|
2015-06-08 00:57:19 +02:00
|
|
|
JX.DOM.listen(checkbox, 'change', null, function() {
|
|
|
|
if (checkbox.checked) {
|
|
|
|
enableRecurring();
|
|
|
|
} else {
|
|
|
|
disableRecurring();
|
|
|
|
}
|
|
|
|
});
|
2015-06-02 03:56:11 +02:00
|
|
|
|
2015-06-08 00:57:19 +02:00
|
|
|
JX.DOM.listen(end_date, 'change', null, function() {
|
|
|
|
if (end_date_checkbox.checked) {
|
|
|
|
enableRecurring();
|
2015-06-02 03:56:11 +02:00
|
|
|
}
|
2015-05-29 02:27:25 +02:00
|
|
|
});
|
|
|
|
|
2015-06-08 00:57:19 +02:00
|
|
|
function enableRecurring() {
|
|
|
|
checkbox.checked = true;
|
|
|
|
frequency.disabled = false;
|
|
|
|
end_date.disabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function disableRecurring() {
|
|
|
|
checkbox.checked = false;
|
|
|
|
frequency.disabled = true;
|
|
|
|
end_date.disabled = true;
|
|
|
|
end_date_checkbox.checked = false;
|
|
|
|
|
|
|
|
JX.DOM.alterClass(end_date, 'datepicker-disabled', true);
|
|
|
|
}
|
2015-05-29 02:27:25 +02:00
|
|
|
});
|