settings: Disable save btn for invalid values of batching period setting.

We disable the "Save changes" button for invalid values in custom
input of realm-level default of email notification batching period
setting.
This commit is contained in:
Sahil Batra
2022-09-02 23:17:23 +05:30
committed by Tim Abbott
parent fa63045b49
commit a446f05c98
3 changed files with 10 additions and 2 deletions

View File

@@ -888,7 +888,7 @@ export function init_dropdown_widgets() {
default_code_language_widget.setup();
}
function update_save_button_state(e) {
export function update_save_button_state(e) {
const $subsection_elem = $(e.target).closest(".org-subsection-parent");
const time_limit_settings = Array.from($subsection_elem.find(".time-limit-setting"));
let disable_save_btn = false;

View File

@@ -63,6 +63,14 @@ export function set_up() {
);
maybe_disable_widgets();
$container.on("input", ".email_notification_batching_period_edit_minutes", (e) => {
settings_org.update_save_button_state(e);
});
$container.on("change", ".setting_email_notifications_batching_period_seconds", (e) => {
settings_org.update_save_button_state(e);
});
}
export function initialize() {

View File

@@ -119,7 +119,7 @@
{{> settings_save_discard_widget section_name="email-message-settings" show_only_indicator=(not for_realm_settings) }}
</div>
<div class="input-group form-horizontal">
<div class="input-group form-horizontal time-limit-setting">
<label for="email_notifications_batching_period">
{{t "Delay before sending message notification emails" }}