refactor: Move click handlers to compose_closed_ui.js.

This commit is contained in:
Tim Abbott
2021-05-04 20:51:55 -07:00
parent 0db7fe389e
commit 638ffb36a4
3 changed files with 28 additions and 24 deletions

View File

@@ -638,28 +638,6 @@ export function initialize() {
$("#nonexistent_stream_reply_error").stop(true).fadeOut(500);
});
$("body").on("click", ".compose_stream_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("stream", {trigger: "new topic button"});
});
$("body").on("click", ".compose_private_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("private");
});
$("body").on("click", ".compose_mobile_stream_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("stream", {trigger: "new topic button"});
});
$("body").on("click", ".compose_mobile_private_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("private");
});
$("body").on("click", ".compose_reply_button", () => {
compose_actions.respond_to_message({trigger: "reply button"});
});
$("body").on("click", ".empty_feed_compose_stream", (e) => {
compose_actions.start("stream", {trigger: "empty feed message"});
e.preventDefault();

View File

@@ -1,6 +1,8 @@
import $ from "jquery";
import * as compose_actions from "./compose_actions";
import * as message_lists from "./message_lists";
import * as popovers from "./popovers";
function update_reply_recipient_label() {
const message = message_lists.current.selected_message();
@@ -15,11 +17,34 @@ function update_reply_recipient_label() {
$(".compose_reply_button_recipient_label").text(recipient_label);
}
// TODO: Move the closed-compose buttons click handlers here, probably.
export function initialize() {
// When the message selection changes, change the label on the Reply button.
$(document).on("message_selected.zulip", () => {
update_reply_recipient_label();
});
// Click handlers for buttons in the compose compose box.
$("body").on("click", ".compose_stream_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("stream", {trigger: "new topic button"});
});
$("body").on("click", ".compose_private_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("private");
});
$("body").on("click", ".compose_mobile_stream_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("stream", {trigger: "new topic button"});
});
$("body").on("click", ".compose_mobile_private_button", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("private");
});
$("body").on("click", ".compose_reply_button", () => {
compose_actions.respond_to_message({trigger: "reply button"});
});
}

View File

@@ -46,6 +46,7 @@ EXEMPT_FILES = {
"static/js/blueslip_stacktrace.ts",
"static/js/click_handlers.js",
"static/js/compose_actions.js",
"static/js/compose_closed_ui.js",
"static/js/composebox_typeahead.js",
"static/js/compose_fade.js",
"static/js/compose.js",