The JavaScript involved wasn't working since we removed the disable-date
attribute in commit 73ff6881.
We're also improving the JavaScript in two ways:
First, we trigger the `change` event immediately, so when the page loads
date fields are disabled when phases are disabled.
And second, we don't remove the selected dates when disabling a phase,
so disabling it and enabling it again will keep the selected values.
26 lines
733 B
JavaScript
26 lines
733 B
JavaScript
(function() {
|
|
"use strict";
|
|
App.LegislationAdmin = {
|
|
initialize: function() {
|
|
$(".legislation-process-form").find("[name$='enabled]'],[name$='[published]']").on({
|
|
change: function() {
|
|
var checkbox;
|
|
checkbox = $(this);
|
|
|
|
checkbox.closest("fieldset").find("input[type='text']").each(function() {
|
|
if (checkbox.is(":checked")) {
|
|
$(this).removeAttr("disabled");
|
|
} else {
|
|
$(this).prop("disabled", true);
|
|
}
|
|
});
|
|
}
|
|
}).trigger("change");
|
|
|
|
$("#nested_question_options").on("cocoon:after-insert", function() {
|
|
App.Globalize.refresh_visible_translations();
|
|
});
|
|
}
|
|
};
|
|
}).call(this);
|