settings: Rename "org-subsection-parent" class to "settings-subsection-parent".

This commit renames the "org-subsection-parent" class used for
organization settings subsections to "settings-subsection-parent"
such that we can use same for the stream settings and avoid
duplicating code for handling save-discard widget which will be
added in future.
This commit is contained in:
Sahil Batra 2022-11-03 17:48:42 +05:30 committed by Tim Abbott
parent e9316499cb
commit 30f4e67aaa
9 changed files with 30 additions and 30 deletions

View File

@ -470,7 +470,7 @@ function test_discard_changes_button(discard_changes) {
"id_realm_message_content_delete_limit_minutes",
);
const $discard_button_parent = $(".org-subsection-parent");
const $discard_button_parent = $(".settings-subsection-parent");
$discard_button_parent.find = () => [
$allow_edit_history,
$msg_edit_limit_setting,

View File

@ -628,7 +628,7 @@ export function change_save_button_state($element, state) {
if (state === "discarded") {
show_hide_element($element, false, 0, () =>
enable_or_disable_save_button($element.closest(".org-subsection-parent")),
enable_or_disable_save_button($element.closest(".settings-subsection-parent")),
);
return;
}
@ -672,13 +672,13 @@ export function change_save_button_state($element, state) {
$textEl.text(button_text);
$saveBtn.attr("data-status", data_status);
if (state === "unsaved") {
enable_or_disable_save_button($element.closest(".org-subsection-parent"));
enable_or_disable_save_button($element.closest(".settings-subsection-parent"));
}
show_hide_element($element, is_show, 800);
}
export function save_organization_settings(data, $save_button, patch_url) {
const $subsection_parent = $save_button.closest(".org-subsection-parent");
const $subsection_parent = $save_button.closest(".settings-subsection-parent");
const $save_btn_container = $subsection_parent.find(".save-button-controls");
const $failed_alert_elem = $subsection_parent.find(".subsection-failed-status p");
change_save_button_state($save_btn_container, "saving");
@ -948,7 +948,7 @@ export function register_save_discard_widget_handlers(
);
}
const $subsection = $(e.target).closest(".org-subsection-parent");
const $subsection = $(e.target).closest(".settings-subsection-parent");
save_discard_widget_status_handler($subsection, for_realm_default_settings);
return undefined;
});
@ -956,7 +956,7 @@ export function register_save_discard_widget_handlers(
$container.on("click", ".subsection-header .subsection-changes-discard button", (e) => {
e.preventDefault();
e.stopPropagation();
const $subsection = $(e.target).closest(".org-subsection-parent");
const $subsection = $(e.target).closest(".settings-subsection-parent");
for (const elem of get_subsection_property_elements($subsection)) {
discard_property_element_changes(elem, for_realm_default_settings);
}
@ -1072,7 +1072,7 @@ export function register_save_discard_widget_handlers(
e.preventDefault();
e.stopPropagation();
const $save_button = $(e.currentTarget);
const $subsection_elem = $save_button.closest(".org-subsection-parent");
const $subsection_elem = $save_button.closest(".settings-subsection-parent");
let extra_data = {};
if (!for_realm_default_settings) {
@ -1123,12 +1123,12 @@ export function build_page() {
register_save_discard_widget_handlers($(".admin-realm-form"), "/json/realm", false);
$(".org-subsection-parent").on("keydown", "input", (e) => {
$(".settings-subsection-parent").on("keydown", "input", (e) => {
e.stopPropagation();
if (keydown_util.is_enter_event(e)) {
e.preventDefault();
$(e.target)
.closest(".org-subsection-parent")
.closest(".settings-subsection-parent")
.find(".subsection-changes-save button")
.trigger("click");
}

View File

@ -3,7 +3,7 @@
<div class='tip'>{{t "Only organization owners can edit these settings."}}</div>
{{/unless}}
<form class="form-horizontal admin-realm-form org-authentications-form">
<div id="org-auth_settings" class="admin-table-wrapper org-subsection-parent">
<div id="org-auth_settings" class="admin-table-wrapper settings-subsection-parent">
<div class ="subsection-header">
<h3>{{t "Authentication methods" }}</h3>
{{> settings_save_discard_widget section_name="auth_settings" }}

View File

@ -1,5 +1,5 @@
<form class="display-settings-form">
<div class="lang-time-settings {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="lang-time-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<!-- this is inline block so that the alert notification can sit beside
it. If there's not an alert, don't make it inline-block.-->
<div class="subsection-header inline-block">
@ -29,7 +29,7 @@
</div>
<div class="theme-settings {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="theme-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Theme" }}</h3>
{{> settings_save_discard_widget section_name="theme-settings" show_only_indicator=(not for_realm_settings) }}
@ -108,7 +108,7 @@
</div>
</div>
<div class="advanced-settings {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="advanced-settings {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header">
<h3 class="light">{{t "Advanced" }}</h3>
{{> settings_save_discard_widget section_name="advanced-settings" show_only_indicator=(not for_realm_settings) }}

View File

@ -1,5 +1,5 @@
<form class="notification-settings-form">
<div class="general_notifications {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="general_notifications {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header inline-block">
<h3>{{t "Notification triggers" }}</h3>
{{> settings_save_discard_widget section_name="general-notifiy-settings" show_only_indicator=(not for_realm_settings) }}
@ -48,7 +48,7 @@
</table>
</div>
<div class="desktop_notifications m-10 {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="desktop_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header inline-block">
<h3>{{t "Desktop message notifications" }}
@ -96,7 +96,7 @@
</div>
</div>
<div class="mobile_notifications m-10 {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="mobile_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header inline-block">
<h3>{{t "Mobile message notifications" }}
@ -115,7 +115,7 @@
{{/each}}
</div>
<div class="email_message_notifications m-10 {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="email_message_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header inline-block">
<h3>{{t "Email message notifications" }}
@ -156,7 +156,7 @@
{{/each}}
</div>
<div class="other_email_notifications m-10 {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="other_email_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">
<div class="subsection-header inline-block">
<h3>{{t "Other emails" }}</h3>

View File

@ -1,7 +1,7 @@
<div id="organization-permissions" data-name="organization-permissions" class="settings-section">
<form class="form-horizontal admin-realm-form org-permissions-form">
<div id="org-join" class="org-subsection-parent">
<div id="org-join" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Joining the organization" }}</h3>
<i class="fa fa-info-circle settings-info-icon realm_message_retention_tooltip tippy-zulip-tooltip" aria-hidden="true" data-tippy-content="{{t 'Only owners can change these settings.' }}"></i>
@ -57,7 +57,7 @@
</div>
</div>
<div id="org-user-identity" class="org-subsection-parent">
<div id="org-user-identity" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "User identity" }}</h3>
{{> settings_save_discard_widget section_name="user-identity" }}
@ -91,7 +91,7 @@
</div>
</div>
<div id="org-stream-permissions" class="org-subsection-parent">
<div id="org-stream-permissions" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Stream permissions" }}</h3>
{{> settings_save_discard_widget section_name="stream-permissions" }}
@ -140,7 +140,7 @@
</div>
</div>
<div id="org-msg-editing" class="org-subsection-parent">
<div id="org-msg-editing" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Message and topic editing" }}
{{> ../help_link_widget link="/help/configure-message-editing-and-deletion" }}
@ -197,7 +197,7 @@
</div>
</div>
<div id="org-msg-deletion" class="org-subsection-parent">
<div id="org-msg-deletion" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Message deletion" }}
{{> ../help_link_widget link="/help/edit-or-delete-a-message#delete-a-message" }}
@ -240,7 +240,7 @@
</div>
</div>
<div id="org-other-permissions" class="org-subsection-parent">
<div id="org-other-permissions" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Other permissions" }}</h3>
{{> settings_save_discard_widget section_name="other-permissions" }}

View File

@ -2,7 +2,7 @@
<form class="form-horizontal admin-realm-form org-profile-form">
<div class="alert" id="admin-realm-deactivation-status"></div>
<div id="org-org-profile" class="org-subsection-parent">
<div id="org-org-profile" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Organization profile" }}
{{> ../help_link_widget link="/help/create-your-organization-profile" }}

View File

@ -1,7 +1,7 @@
<div id="organization-settings" data-name="organization-settings" class="settings-section">
<form class="form-horizontal admin-realm-form org-settings-form">
<div id="org-notifications" class="org-subsection-parent">
<div id="org-notifications" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Automated messages and emails" }}</h3>
{{> settings_save_discard_widget section_name="notifications" }}
@ -57,7 +57,7 @@
</div>
</div>
<div id="org-message-retention" class="org-subsection-parent">
<div id="org-message-retention" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Message retention" }}
{{> ../help_link_widget link="/help/message-retention-policy" }}
@ -93,7 +93,7 @@
</div>
</div>
<div id="org-other-settings" class="org-subsection-parent">
<div id="org-other-settings" class="settings-subsection-parent">
<div class="subsection-header">
<h3>{{t "Other settings" }}</h3>
{{> settings_save_discard_widget section_name="other-settings" }}

View File

@ -10,7 +10,7 @@
{{> notification_settings prefix="realm_" for_realm_settings=true}}
<div class="form-horizontal privacy_settings org-subsection-parent">
<div class="form-horizontal privacy_settings settings-subsection-parent">
<div class="subsection-header inline-block">
<h3 class="inline-block">{{t "Privacy settings" }}</h3>
{{> settings_save_discard_widget section_name="privacy-setting" show_only_indicator=false }}
@ -30,7 +30,7 @@
help_link="/help/read-receipts"}}
</div>
<div class="form-horizontal other_settings org-subsection-parent">
<div class="form-horizontal other_settings settings-subsection-parent">
<div class="subsection-header inline-block">
<h3 class="inline-block">{{t "Other settings" }}</h3>
{{> settings_save_discard_widget section_name="other-setting" show_only_indicator=false }}