|
@@ -1207,6 +1207,7 @@
|
|
|
events: {
|
|
|
'click .close-chatbox-button': 'close',
|
|
|
'click .toggle-chatbox-button': 'minimize',
|
|
|
+ 'click .view-vcard-button': 'renderVCard',
|
|
|
'keypress textarea.chat-textarea': 'keyPressed',
|
|
|
'click .toggle-smiley': 'toggleEmoticonMenu',
|
|
|
'click .toggle-smiley ul li': 'insertEmoticon',
|
|
@@ -1270,6 +1271,33 @@
|
|
|
return this.showStatusMessage();
|
|
|
},
|
|
|
|
|
|
+ renderVCard: function () {
|
|
|
+ var $chat_body = this.$el.find('.chat-body');
|
|
|
+ if (this.$el.find('.vcard-info').length) {
|
|
|
+ return this.returnToChat();
|
|
|
+ }
|
|
|
+ $chat_body.children().addClass('hidden');
|
|
|
+ $chat_body.append(converse.templates.vcard(
|
|
|
+ _.extend(this.model.toJSON(), {
|
|
|
+ label_return: __('Return to chat')
|
|
|
+ })
|
|
|
+ ));
|
|
|
+ $chat_body.find('input[type=button]').on('click', this.returnToChat.bind(this));
|
|
|
+ return this;
|
|
|
+ },
|
|
|
+
|
|
|
+ returnToChat: function (ev) {
|
|
|
+ if (ev && ev.preventDefault) { ev.preventDefault(); }
|
|
|
+ var $chat_body = this.$el.find('.chat-body');
|
|
|
+ this.$el.find('.vcard-info').hide(
|
|
|
+ function () {
|
|
|
+ $(this).remove();
|
|
|
+ $chat_body.children().removeClass('hidden');
|
|
|
+ }
|
|
|
+ );
|
|
|
+ return this;
|
|
|
+ },
|
|
|
+
|
|
|
setWidth: function () {
|
|
|
// If a custom width is applied (due to drag-resizing),
|
|
|
// then we need to set the width of the .chatbox element as well.
|
|
@@ -2903,7 +2931,7 @@
|
|
|
this.toggleOccupants(null, true);
|
|
|
return this;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
toggleOccupants: function (ev, preserve_state) {
|
|
|
if (ev) {
|
|
|
ev.preventDefault();
|