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,8 +175,9 @@ ...@@ -175,8 +175,9 @@
closeAllChatBoxes: function () { closeAllChatBoxes: function () {
this.each(function (view) { this.each(function (view) {
if (view.model.get('id') !== 'controlbox') { if (!converse.connection.connected ||
view.close(); view.model.get('id') !== 'controlbox') {
view.close();
} }
}); });
return this; return this;
...@@ -361,6 +362,9 @@ ...@@ -361,6 +362,9 @@
this.$el.hide('fast', function () { this.$el.hide('fast', function () {
utils.refreshWebkit(); utils.refreshWebkit();
converse.emit('chatBoxClosed', this); converse.emit('chatBoxClosed', this);
if (!converse.connection.connected) {
converse.controlboxtoggle.render();
}
converse.controlboxtoggle.show(function () { converse.controlboxtoggle.show(function () {
if (typeof callback === "function") { if (typeof callback === "function") {
callback(); callback();
...@@ -738,7 +742,7 @@ ...@@ -738,7 +742,7 @@
}, },
initialize: function () { initialize: function () {
this.render(); $('#conversejs').prepend(this.render());
this.updateOnlineCount(); this.updateOnlineCount();
converse.on('initialized', function () { converse.on('initialized', function () {
converse.roster.on("add", this.updateOnlineCount, this); converse.roster.on("add", this.updateOnlineCount, this);
...@@ -749,17 +753,15 @@ ...@@ -749,17 +753,15 @@
}, },
render: function () { render: function () {
$('#conversejs').prepend(this.$el.html(
converse.templates.controlbox_toggle({
'label_toggle': __('Toggle chat')
})
));
// We let the render method of ControlBoxView decide whether // We let the render method of ControlBoxView decide whether
// the ControlBox or the Toggle must be shown. This prevents // the ControlBox or the Toggle must be shown. This prevents
// artifacts (i.e. on page load the toggle is shown only to then // artifacts (i.e. on page load the toggle is shown only to then
// seconds later be hidden in favor of the control box). // seconds later be hidden in favor of the control box).
this.$el.hide(); return this.$el.html(
return this; converse.templates.controlbox_toggle({
'label_toggle': __('Toggle chat')
})
).hide();
}, },
updateOnlineCount: _.debounce(function () { updateOnlineCount: _.debounce(function () {
......
<span class="conn-feedback">{{label_toggle}}</span> <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