Don't render avatar for headlines chatbox
This commit is contained in:
parent
8cd75aa09c
commit
031d640438
@ -15,6 +15,7 @@
|
|||||||
}(this, function (converse, tpl_chatbox) {
|
}(this, function (converse, tpl_chatbox) {
|
||||||
"use strict";
|
"use strict";
|
||||||
const { _, utils } = converse.env;
|
const { _, utils } = converse.env;
|
||||||
|
const HEADLINES_TYPE = 'headline';
|
||||||
|
|
||||||
converse.plugins.add('converse-headline', {
|
converse.plugins.add('converse-headline', {
|
||||||
|
|
||||||
@ -25,6 +26,17 @@
|
|||||||
//
|
//
|
||||||
// New functions which don't exist yet can also be added.
|
// New functions which don't exist yet can also be added.
|
||||||
|
|
||||||
|
ChatBoxes: {
|
||||||
|
model (attrs, options) {
|
||||||
|
const { _converse } = this.__super__;
|
||||||
|
if (attrs.type == HEADLINES_TYPE) {
|
||||||
|
return new _converse.HeadlinesBox(attrs, options);
|
||||||
|
} else {
|
||||||
|
return this.__super__.model.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
ChatBoxViews: {
|
ChatBoxViews: {
|
||||||
onChatBoxAdded (item) {
|
onChatBoxAdded (item) {
|
||||||
const { _converse } = this.__super__;
|
const { _converse } = this.__super__;
|
||||||
@ -40,6 +52,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
initialize () {
|
initialize () {
|
||||||
/* The initialize function gets called as soon as the plugin is
|
/* The initialize function gets called as soon as the plugin is
|
||||||
* loaded by converse.js's plugin machinery.
|
* loaded by converse.js's plugin machinery.
|
||||||
@ -47,6 +60,18 @@
|
|||||||
const { _converse } = this,
|
const { _converse } = this,
|
||||||
{ __ } = _converse;
|
{ __ } = _converse;
|
||||||
|
|
||||||
|
_converse.HeadlinesBox = _converse.ChatBox.extend({
|
||||||
|
defaults: {
|
||||||
|
'type': 'headline',
|
||||||
|
'show_avatar': false,
|
||||||
|
'bookmarked': false,
|
||||||
|
'chat_state': undefined,
|
||||||
|
'num_unread': 0,
|
||||||
|
'url': ''
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
_converse.HeadlinesBoxView = _converse.ChatBoxView.extend({
|
_converse.HeadlinesBoxView = _converse.ChatBoxView.extend({
|
||||||
className: 'chatbox headlines',
|
className: 'chatbox headlines',
|
||||||
|
|
||||||
@ -74,7 +99,6 @@
|
|||||||
_.extend(this.model.toJSON(), {
|
_.extend(this.model.toJSON(), {
|
||||||
info_close: '',
|
info_close: '',
|
||||||
label_personal_message: '',
|
label_personal_message: '',
|
||||||
show_avatar: false,
|
|
||||||
show_send_button: false,
|
show_send_button: false,
|
||||||
show_textarea: false,
|
show_textarea: false,
|
||||||
show_toolbar: false,
|
show_toolbar: false,
|
||||||
@ -82,6 +106,7 @@
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
this.$content = this.$el.find('.chat-content');
|
this.$content = this.$el.find('.chat-content');
|
||||||
|
this.content = this.$content[0];
|
||||||
utils.refreshWebkit();
|
utils.refreshWebkit();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -98,7 +123,7 @@
|
|||||||
'id': from_jid,
|
'id': from_jid,
|
||||||
'jid': from_jid,
|
'jid': from_jid,
|
||||||
'fullname': from_jid,
|
'fullname': from_jid,
|
||||||
'type': 'headline'
|
'type': 'headline',
|
||||||
});
|
});
|
||||||
chatbox.createMessage(message, undefined, message);
|
chatbox.createMessage(message, undefined, message);
|
||||||
_converse.emit('message', {'chatbox': chatbox, 'stanza': message});
|
_converse.emit('message', {'chatbox': chatbox, 'stanza': message});
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<div class="chat-head chat-head-chatbox">
|
<div class="chat-head chat-head-chatbox">
|
||||||
<a class="chatbox-btn close-chatbox-button icon-close" title="{{{o.info_close}}}"></a>
|
<a class="chatbox-btn close-chatbox-button icon-close" title="{{{o.info_close}}}"></a>
|
||||||
<img alt="User Avatar"
|
{[ if (o.show_avatar) { ]}
|
||||||
class="avatar"
|
<img alt="User Avatar"
|
||||||
height="{{{o.avatar_height}}}px" width="{{{o.avatar_width}}}px"
|
class="avatar"
|
||||||
src="data:{{{o.image_type}}};base64,{{{o.image}}}"/>
|
height="{{{o.avatar_height}}}px" width="{{{o.avatar_width}}}px"
|
||||||
|
src="data:{{{o.image_type}}};base64,{{{o.image}}}"/>
|
||||||
|
{[ } ]}
|
||||||
<div class="chat-title">
|
<div class="chat-title">
|
||||||
{[ if (o.url) { ]}
|
{[ if (o.url) { ]}
|
||||||
<a href="{{{o.url}}}" target="_blank" rel="noopener" class="user">
|
<a href="{{{o.url}}}" target="_blank" rel="noopener" class="user">
|
||||||
|
Loading…
Reference in New Issue
Block a user