settings: Remove ID from discard button in save-discard widget.

This commit removes ID from discard button in save-discard widget.

Generating IDs using variables results in difficulty to grep
the code and we can anyway access the discard button by using
ID of the settings-subsection-parent div. Also, we do not use
ID to access this button, so we can change this safely.
This commit is contained in:
Sahil Batra 2022-12-07 17:47:29 +05:30 committed by Tim Abbott
parent 821a409c8b
commit ee04677d4b
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ function createSaveButtons(subsection) {
const $stub_save_button_header = $(`#org-${CSS.escape(subsection)}`);
const $save_button_controls = $(".save-button-controls");
const $stub_save_button = $(".save-discard-widget-button.save-button");
const $stub_discard_button = $(`#org-discard-${CSS.escape(subsection)}`);
const $stub_discard_button = $(".save-discard-widget-button.discard-button");
const $stub_save_button_text = $(".save-discard-widget-button-text");
$stub_save_button_header.set_find_results(
".subsection-failed-status p",
@ -70,7 +70,7 @@ function createSaveButtons(subsection) {
$stub_save_button_header.set_find_results(".save-button-controls", $save_button_controls);
$stub_save_button_header.set_find_results(
".subsection-changes-discard button",
$(`#org-discard-${CSS.escape(subsection)}`),
$stub_discard_button,
);
$save_button_controls.set_find_results(".discard-button", $stub_discard_button);
const props = {};
@ -439,7 +439,7 @@ function test_discard_changes_button(discard_changes) {
const ev = {
preventDefault: noop,
stopPropagation: noop,
target: "#org-discard-msg-editing",
target: ".save-discard-widget-button.discard-button",
};
page_params.realm_allow_edit_history = true;

View File

@ -10,7 +10,7 @@
</button>
</div>
<div class="inline-block subsection-changes-discard">
<button class="save-discard-widget-button button discard-button" id="org-discard-{{section_name}}">
<button class="save-discard-widget-button button discard-button">
<span class="fa fa-times save-discard-widget-button-icon"></span>
<span class="save-discard-widget-button-text">
{{t 'Discard' }}