mirror of https://github.com/zulip/zulip.git
settings: Extract common logic for hide_spinners.
Move the redundant code for hiding spinners and re-enabling buttons into a common `hide_spinner` function inside `loading.ts`. This reduces duplication between `hide_button_spinner` and `hide_dialog_spinner`. Fixes #26691.
This commit is contained in:
parent
666e7bf433
commit
158cb6c747
|
@ -88,12 +88,11 @@ type RequestOpts = {
|
|||
};
|
||||
|
||||
export function hide_dialog_spinner(): void {
|
||||
$(".dialog_submit_button span").show();
|
||||
const dialog_widget_selector = current_dialog_widget_selector();
|
||||
const $spinner = $(`${dialog_widget_selector} .modal__spinner`);
|
||||
$(`${dialog_widget_selector} .modal__btn`).prop("disabled", false);
|
||||
|
||||
const $spinner = $(`${dialog_widget_selector} .modal__spinner`);
|
||||
loading.destroy_indicator($spinner);
|
||||
loading.hide_spinner($(".dialog_submit_button"), $spinner);
|
||||
}
|
||||
|
||||
export function show_dialog_spinner(): void {
|
||||
|
|
|
@ -106,3 +106,11 @@ export function show_spinner($button_element: JQuery, $spinner: JQuery): void {
|
|||
height: span_height,
|
||||
});
|
||||
}
|
||||
|
||||
export function hide_spinner($button_element: JQuery, $spinner: JQuery): void {
|
||||
// Show the span
|
||||
$button_element.find(".submit-button-text").show();
|
||||
|
||||
// Destroy the loading indicator
|
||||
destroy_indicator($spinner);
|
||||
}
|
||||
|
|
|
@ -95,8 +95,7 @@ export function show_button_spinner($button: JQuery): void {
|
|||
export function hide_button_spinner($button: JQuery): void {
|
||||
const $spinner = $button.find(".modal__spinner");
|
||||
$button.prop("disabled", false);
|
||||
$button.find("span").show();
|
||||
loading.destroy_indicator($spinner);
|
||||
loading.hide_spinner($button, $spinner);
|
||||
}
|
||||
|
||||
function compare_by_name(
|
||||
|
|
Loading…
Reference in New Issue