mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 17:22:42 +01:00
47051643c7
Summary: Fixes T8458, Show informative errors when attempting to set a recurrence end date on a non-recurring event. Test Plan: Create new event, set recurrence end date via date-picker without setting the "is recurring" checkbox, and attempt to save. Should get error saying there cannot be a recurrence end date on a non-recurring event. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8458 Differential Revision: https://secure.phabricator.com/D13192
41 lines
968 B
JavaScript
41 lines
968 B
JavaScript
/**
|
|
* @provides javelin-behavior-recurring-edit
|
|
*/
|
|
|
|
|
|
JX.behavior('recurring-edit', function(config) {
|
|
var checkbox = JX.$(config.isRecurring);
|
|
var frequency = JX.$(config.frequency);
|
|
var end_date = JX.$(config.recurrenceEndDate);
|
|
|
|
var end_date_checkbox = JX.DOM.find(end_date, 'input', 'calendar-enable');
|
|
|
|
JX.DOM.listen(checkbox, 'change', null, function() {
|
|
if (checkbox.checked) {
|
|
enableRecurring();
|
|
} else {
|
|
disableRecurring();
|
|
}
|
|
});
|
|
|
|
JX.DOM.listen(end_date, 'change', null, function() {
|
|
if (end_date_checkbox.checked) {
|
|
enableRecurring();
|
|
}
|
|
});
|
|
|
|
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);
|
|
}
|
|
});
|