mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
compose: Extract compose_error.js.
This commit moves the compose_error function to its own module, which will be useful for future work splitting the compose module. We also simplify compose_not_subscribed_error to call the compose_error show function.
This commit is contained in:
22
static/js/compose_error.js
Normal file
22
static/js/compose_error.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as common from "./common";
|
||||
|
||||
export function show(error_html, bad_input, alert_class = "alert-error") {
|
||||
$("#compose-send-status")
|
||||
.removeClass(common.status_classes)
|
||||
.addClass(alert_class)
|
||||
.stop(true)
|
||||
.fadeTo(0, 1);
|
||||
$("#compose-error-msg").html(error_html);
|
||||
$("#compose-send-button").prop("disabled", false);
|
||||
$("#sending-indicator").hide();
|
||||
if (bad_input !== undefined) {
|
||||
bad_input.trigger("focus").trigger("select");
|
||||
}
|
||||
}
|
||||
|
||||
export function show_not_subscribed(error_html, bad_input) {
|
||||
show(error_html, bad_input, "home-error-bar");
|
||||
$(".compose-send-status-close").hide();
|
||||
}
|
||||
Reference in New Issue
Block a user