2021-06-24 19:30:01 +02:00
|
|
|
import $ from "jquery";
|
|
|
|
|
|
|
|
import * as common from "./common";
|
|
|
|
|
2022-08-19 21:36:33 +02:00
|
|
|
// banner types
|
|
|
|
export const WARNING = "warning";
|
|
|
|
|
|
|
|
export const CLASSNAMES = {
|
|
|
|
// warnings
|
|
|
|
topic_resolved: "topic_resolved",
|
|
|
|
};
|
|
|
|
|
2022-01-25 11:36:19 +01:00
|
|
|
export function show(error_html: string, $bad_input?: JQuery, alert_class = "alert-error"): void {
|
2021-06-24 19:30:01 +02:00
|
|
|
$("#compose-send-status")
|
|
|
|
.removeClass(common.status_classes)
|
|
|
|
.addClass(alert_class)
|
|
|
|
.stop(true)
|
|
|
|
.fadeTo(0, 1);
|
|
|
|
$("#compose-error-msg").html(error_html);
|
2021-11-30 06:26:05 +01:00
|
|
|
// TODO: Replace with compose_ui.hide_compose_spinner() when it is converted to ts.
|
|
|
|
$("#compose-send-button .loader").hide();
|
|
|
|
$("#compose-send-button span").show();
|
|
|
|
$("#compose-send-button").removeClass("disable-btn");
|
|
|
|
|
2022-01-25 11:36:19 +01:00
|
|
|
if ($bad_input !== undefined) {
|
|
|
|
$bad_input.trigger("focus").trigger("select");
|
2021-06-24 19:30:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-25 11:36:19 +01:00
|
|
|
export function show_not_subscribed(error_html: string, $bad_input?: JQuery): void {
|
|
|
|
show(error_html, $bad_input, "home-error-bar");
|
2021-06-24 19:30:01 +02:00
|
|
|
$(".compose-send-status-close").hide();
|
|
|
|
}
|
2021-06-25 13:36:43 +02:00
|
|
|
|
2021-07-06 19:05:08 +02:00
|
|
|
export function hide(): void {
|
2021-06-25 13:36:43 +02:00
|
|
|
$("#compose-send-status").stop(true).fadeOut(500);
|
|
|
|
}
|