Commit 0c2c7be4 authored by JC Brand's avatar JC Brand

Close the controlbox when logging out...

and don't show the online count in the toggle.
parent 5610d759
......@@ -175,7 +175,8 @@
closeAllChatBoxes: function () {
this.each(function (view) {
if (view.model.get('id') !== 'controlbox') {
if (!converse.connection.connected ||
view.model.get('id') !== 'controlbox') {
view.close();
}
});
......@@ -361,6 +362,9 @@
this.$el.hide('fast', function () {
utils.refreshWebkit();
converse.emit('chatBoxClosed', this);
if (!converse.connection.connected) {
converse.controlboxtoggle.render();
}
converse.controlboxtoggle.show(function () {
if (typeof callback === "function") {
callback();
......@@ -738,7 +742,7 @@
},
initialize: function () {
this.render();
$('#conversejs').prepend(this.render());
this.updateOnlineCount();
converse.on('initialized', function () {
converse.roster.on("add", this.updateOnlineCount, this);
......@@ -749,17 +753,15 @@
},
render: function () {
$('#conversejs').prepend(this.$el.html(
converse.templates.controlbox_toggle({
'label_toggle': __('Toggle chat')
})
));
// We let the render method of ControlBoxView decide whether
// the ControlBox or the Toggle must be shown. This prevents
// artifacts (i.e. on page load the toggle is shown only to then
// seconds later be hidden in favor of the control box).
this.$el.hide();
return this;
return this.$el.html(
converse.templates.controlbox_toggle({
'label_toggle': __('Toggle chat')
})
).hide();
},
updateOnlineCount: _.debounce(function () {
......
<span class="conn-feedback">{{label_toggle}}</span>
<span id="online-count">(0)</span>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment