This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/assets/javascripts/discourse/widgets/topic-chat-button.js
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

23 lines
594 B
JavaScript

import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
export default createWidget("topic-chat-button", {
tagName: "button.btn.btn-default.topic-chat-button",
title: "chat.open",
click() {
this.appEvents.trigger(
"chat:open-channel-for-chatable",
ChatChannel.create(this.attrs.chat_channel)
);
},
template: hbs`
{{d-icon "far-comments"}}
<span class="label">
{{i18n "chat.topic_button_title"}}
</span>
`,
});