digest: Toggle display of digest weekday setting dynamically.

Hide or show the digest weekday setting, based on whether
`digest_emails_enabled` flag is turned on or off.
This commit is contained in:
Puneeth Chaganti 2019-05-08 11:41:30 +05:30 committed by Tim Abbott
parent 55a4c5751d
commit b016ab257e
2 changed files with 11 additions and 0 deletions

View File

@ -761,6 +761,7 @@ run_test('set_up', () => {
$("#id_realm_message_content_delete_limit_minutes").set_parent($.create('<stub delete limti parent>'));
$("#message_content_in_email_notifications_label").set_parent($.create('<stub in-content setting checkbox>'));
$("#enable_digest_emails_label").set_parent($.create('<stub digest setting checkbox>'));
$("#id_realm_digest_weekday").set_parent($.create('<stub digest weekday setting dropdown>'));
$("#id_realm_msg_edit_limit_setting").change = noop;
$('#id_realm_msg_delete_limit_setting').change = noop;
const waiting_period_parent_elem = $.create('waiting-period-parent-stub');

View File

@ -282,6 +282,14 @@ function set_enable_digest_emails_visibility() {
}
}
function set_digest_emails_weekday_visibility() {
if (page_params.realm_digest_emails_enabled) {
$('#id_realm_digest_weekday').parent().show();
} else {
$('#id_realm_digest_weekday').parent().hide();
}
}
exports.populate_realm_domains = function (realm_domains) {
if (!meta.loaded) {
return;
@ -430,6 +438,7 @@ function update_dependent_subsettings(property_name) {
set_message_content_in_email_notifications_visiblity();
} else if (property_name === 'realm_digest_emails_enabled') {
set_enable_digest_emails_visibility();
set_digest_emails_weekday_visibility();
}
}
@ -593,6 +602,7 @@ exports.build_page = function () {
set_user_invite_restriction_dropdown();
set_message_content_in_email_notifications_visiblity();
set_enable_digest_emails_visibility();
set_digest_emails_weekday_visibility();
function check_property_changed(elem) {
elem = $(elem);