mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	refactor: Move click handlers to compose_closed_ui.js.
This commit is contained in:
		@@ -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"});
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user