Commit ea9665df authored by JC Brand's avatar JC Brand

Add the option sticky_controlbox, to disable closing it.

updates #622
parent a4779704
...@@ -773,6 +773,21 @@ Data in localStorage on the other hand is kept indefinitely. ...@@ -773,6 +773,21 @@ Data in localStorage on the other hand is kept indefinitely.
roster contact statuses will not become out of sync in a single session, roster contact statuses will not become out of sync in a single session,
only across more than one session. only across more than one session.
sticky_controlbox
-----------------
* Default: ``false``
If set to ``true``, the control box (which includes the login, registration,
contacts and rooms tabs) will not be closeable. It won't have a close button at
all.
The idea behind this setting is to provide a better experience on mobile
devices when the intent is to use converse.js as a web app. In this case
it doesn't make sense to close the control box, as there's often then nothing
"behind" it that's relevant to the user.
strict_plugin_dependencies strict_plugin_dependencies
-------------------------- --------------------------
......
...@@ -159,6 +159,7 @@ ...@@ -159,6 +159,7 @@
allow_logout: true, allow_logout: true,
default_domain: undefined, default_domain: undefined,
show_controlbox_by_default: false, show_controlbox_by_default: false,
sticky_controlbox: false,
xhr_user_search: false, xhr_user_search: false,
xhr_user_search_url: '' xhr_user_search_url: ''
}); });
...@@ -216,6 +217,11 @@ ...@@ -216,6 +217,11 @@
}, },
render: function () { render: function () {
this.$el.html(converse.templates.controlbox(
_.extend(this.model.toJSON(), {
sticky_controlbox: converse.sticky_controlbox
}))
);
if (!converse.connection.connected || !converse.connection.authenticated || converse.connection.disconnecting) { if (!converse.connection.connected || !converse.connection.authenticated || converse.connection.disconnecting) {
// TODO: we might need to take prebinding into consideration here. // TODO: we might need to take prebinding into consideration here.
this.renderLoginPanel(); this.renderLoginPanel();
...@@ -254,7 +260,6 @@ ...@@ -254,7 +260,6 @@
renderLoginPanel: function () { renderLoginPanel: function () {
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback. var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
var cfg = { var cfg = {
'$parent': this.$el.find('.controlbox-panes'), '$parent': this.$el.find('.controlbox-panes'),
'model': this 'model': this
...@@ -273,7 +278,6 @@ ...@@ -273,7 +278,6 @@
}, },
renderContactsPanel: function () { renderContactsPanel: function () {
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
this.contactspanel = new converse.ContactsPanel({ this.contactspanel = new converse.ContactsPanel({
'$parent': this.$el.find('.controlbox-panes') '$parent': this.$el.find('.controlbox-panes')
}); });
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
<div class="dragresize dragresize-left"></div> <div class="dragresize dragresize-left"></div>
<div class="chat-head controlbox-head"> <div class="chat-head controlbox-head">
<ul id="controlbox-tabs"></ul> <ul id="controlbox-tabs"></ul>
{[ if (!sticky_controlbox) { ]}
<a class="chatbox-btn close-chatbox-button icon-close"></a> <a class="chatbox-btn close-chatbox-button icon-close"></a>
{[ } ]}
</div> </div>
<div class="controlbox-panes"></div> <div class="controlbox-panes"></div>
</div> </div>
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