|
@@ -7,11 +7,13 @@ import "converse-chatboxviews";
|
|
import "converse-message-view";
|
|
import "converse-message-view";
|
|
import "converse-modal";
|
|
import "converse-modal";
|
|
import { debounce, get, isString } from "lodash";
|
|
import { debounce, get, isString } from "lodash";
|
|
|
|
+import { View } from "skeletor.js/src/view";
|
|
import { Overview } from "skeletor.js/src/overview";
|
|
import { Overview } from "skeletor.js/src/overview";
|
|
|
|
+import { html, render } from "lit-html";
|
|
import converse from "@converse/headless/converse-core";
|
|
import converse from "@converse/headless/converse-core";
|
|
import log from "@converse/headless/log";
|
|
import log from "@converse/headless/log";
|
|
import tpl_chatbox from "templates/chatbox.html";
|
|
import tpl_chatbox from "templates/chatbox.html";
|
|
-import tpl_chatbox_head from "templates/chatbox_head.html";
|
|
|
|
|
|
+import tpl_chatbox_head from "templates/chatbox_head.js";
|
|
import tpl_chatbox_message_form from "templates/chatbox_message_form.html";
|
|
import tpl_chatbox_message_form from "templates/chatbox_message_form.html";
|
|
import tpl_error_message from "templates/error_message.html";
|
|
import tpl_error_message from "templates/error_message.html";
|
|
import tpl_help_message from "templates/help_message.html";
|
|
import tpl_help_message from "templates/help_message.html";
|
|
@@ -71,7 +73,7 @@ converse.plugins.add('converse-chatview', {
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
- _converse.ChatBoxHeading = _converse.ViewWithAvatar.extend({
|
|
|
|
|
|
+ _converse.ChatBoxHeading = View.extend({
|
|
initialize () {
|
|
initialize () {
|
|
this.listenTo(this.model, 'change:status', this.onStatusMessageChanged);
|
|
this.listenTo(this.model, 'change:status', this.onStatusMessageChanged);
|
|
|
|
|
|
@@ -92,20 +94,34 @@ converse.plugins.add('converse-chatview', {
|
|
render () {
|
|
render () {
|
|
const vcard = get(this.model, 'vcard');
|
|
const vcard = get(this.model, 'vcard');
|
|
const vcard_json = vcard ? vcard.toJSON() : {};
|
|
const vcard_json = vcard ? vcard.toJSON() : {};
|
|
- this.el.innerHTML = tpl_chatbox_head(
|
|
|
|
|
|
+ render(tpl_chatbox_head(
|
|
Object.assign(
|
|
Object.assign(
|
|
vcard_json,
|
|
vcard_json,
|
|
this.model.toJSON(),
|
|
this.model.toJSON(),
|
|
{ '_converse': _converse,
|
|
{ '_converse': _converse,
|
|
- 'info_close': __('Close this chat box'),
|
|
|
|
|
|
+ 'buttons': this.getHeadingButtons(),
|
|
'display_name': this.model.getDisplayName()
|
|
'display_name': this.model.getDisplayName()
|
|
}
|
|
}
|
|
)
|
|
)
|
|
- );
|
|
|
|
- this.renderAvatar();
|
|
|
|
|
|
+ ), this.el);
|
|
return this;
|
|
return this;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ getHeadingButtons () {
|
|
|
|
+ const buttons = [];
|
|
|
|
+ if (!_converse.singleton) {
|
|
|
|
+ const info_close = __('Close this chat box');
|
|
|
|
+ const template = html`<a class="chatbox-btn close-chatbox-button fa fa-times" title="${info_close}"></a>`;
|
|
|
|
+ template.name = 'close';
|
|
|
|
+ buttons.push(template);
|
|
|
|
+ }
|
|
|
|
+ const info_details = __('Show more details about this groupchat');
|
|
|
|
+ const template = html`<a class="chatbox-btn show-user-details-modal fa fa-id-card" title="${info_details}"></a>`;
|
|
|
|
+ template.name = 'details';
|
|
|
|
+ buttons.push(template);
|
|
|
|
+ return buttons;
|
|
|
|
+ },
|
|
|
|
+
|
|
onStatusMessageChanged (item) {
|
|
onStatusMessageChanged (item) {
|
|
this.debouncedRender();
|
|
this.debouncedRender();
|
|
/**
|
|
/**
|