diff --git a/src/converse-profile.js b/src/converse-profile.js index bb516801c..fc710eaf7 100644 --- a/src/converse-profile.js +++ b/src/converse-profile.js @@ -10,6 +10,7 @@ define(["converse-core", "bootstrap", "tpl!chat_status_modal", + "tpl!profile_modal", "tpl!profile_view", "tpl!status_option", "converse-vcard", @@ -19,6 +20,7 @@ converse, bootstrap, tpl_chat_status_modal, + tpl_profile_modal, tpl_profile_view, tpl_status_option ) { @@ -40,6 +42,17 @@ { __ } = _converse; + _converse.ProfileModal = _converse.BootstrapModal.extend({ + + toHTML () { + return tpl_profile_modal(_.extend(this.model.toJSON(), { + 'heading_profile': __('Your profile'), + 'label_close': __('Close') + })); + }, + }); + + _converse.ChatStatusModal = _converse.BootstrapModal.extend({ events: { "submit form#set-xmpp-status": "onFormSubmitted", @@ -85,6 +98,7 @@ _converse.XMPPStatusView = Backbone.VDOMView.extend({ tagName: "div", events: { + "click a.show-profile": "showProfileModal", "click a.change-status": "showStatusChangeModal", "click .dropdown dd ul li a": "setStatus", "click .logout": "logOut" @@ -108,7 +122,14 @@ })); }, - showStatusChangeModal (ev) { + showProfileModal (ev) { + if (_.isUndefined(this.profile_modal)) { + this.profile_modal = new _converse.ProfileModal({model: this.model}); + } + this.profile_modal.show(ev); + }, + + showStatusChangeModal (ev) { if (_.isUndefined(this.status_modal)) { this.status_modal = new _converse.ChatStatusModal({model: this.model}); } diff --git a/src/templates/profile_modal.html b/src/templates/profile_modal.html new file mode 100644 index 000000000..156749f8f --- /dev/null +++ b/src/templates/profile_modal.html @@ -0,0 +1,12 @@ + diff --git a/src/templates/profile_view.html b/src/templates/profile_view.html index 6f4940f57..a959f8c57 100644 --- a/src/templates/profile_view.html +++ b/src/templates/profile_view.html @@ -1,7 +1,9 @@
{[ if (o.image) { ]} - User Avatar + + User Avatar + {[ } ]} {{{o.fullname}}}