Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
static: Move click handlers for alert-box to a separate module.
PIG20836e90195e008
diff --git a/static/js/alert_popup.ts b/static/js/alert_popup.tsnew file mode 100644index 00000000000..889caf8d745--- /dev/null+++ b/static/js/alert_popup.ts@@ -0,0 +1,16 @@+import $ from "jquery";++export function initialize(): void {+ // this will hide the alerts that you click "x" on.+ $("body").on("click", ".alert-box > div .exit", function () {+ const $alert = $(this).closest(".alert-box > div");+ $alert.addClass("fade-out");+ setTimeout(() => {+ $alert.removeClass("fade-out show");+ }, 300);+ });++ $(".alert-box").on("click", ".stackframe .expand", function () {+ $(this).parent().siblings(".code-context").toggle("fast");+ });+}diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 1278ad82694..4ac8519c4dd 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -643,15 +643,6 @@ export function initialize() {server_events.restart_get_events({dont_block: true});});- // this will hide the alerts that you click "x" on.- $("body").on("click", ".alert-box > div .exit", function () {- const $alert = $(this).closest(".alert-box > div");- $alert.addClass("fade-out");- setTimeout(() => {- $alert.removeClass("fade-out show");- }, 300);- });-$("#settings_page").on("click", ".collapse-settings-btn", () => {settings_toggle.toggle_org_setting_collapse();});@@ -660,10 +651,6 @@ export function initialize() {popovers.hide_all();});- $(".alert-box").on("click", ".stackframe .expand", function () {- $(this).parent().siblings(".code-context").toggle("fast");- });-// COMPOSE// NB: This just binds to current elements, and won't bind to elementsdiff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex 94bc73bea8c..695a7df8039 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -8,6 +8,7 @@ import * as fenced_code from "../shared/js/fenced_code";import render_edit_content_button from "../templates/edit_content_button.hbs";import * as activity from "./activity";+import * as alert_popup from "./alert_popup";import * as alert_words from "./alert_words";import * as blueslip from "./blueslip";import * as bot_data from "./bot_data";@@ -473,6 +474,7 @@ export function initialize_everything() {const user_status_params = pop_fields("user_status");+ alert_popup.initialize();alert_words.initialize(alert_words_params);emojisets.initialize();people.initialize(page_params.user_id, people_params);diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex a13bcf4ba3b..581522b1125 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -36,6 +36,7 @@ USAGE = """# We do not yet require 100% line coverage for these files:EXEMPT_FILES = {"static/js/admin.js",+ "static/js/alert_popup.ts","static/js/archive.js","static/js/attachments_ui.js","static/js/avatar.js",