Add the option sticky_controlbox, to disable closing it.

updates #622
This commit is contained in:
JC Brand 2016-03-31 09:16:21 +00:00
parent a477970428
commit ea9665df4b
3 changed files with 24 additions and 3 deletions

View File

@ -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,
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
--------------------------

View File

@ -159,6 +159,7 @@
allow_logout: true,
default_domain: undefined,
show_controlbox_by_default: false,
sticky_controlbox: false,
xhr_user_search: false,
xhr_user_search_url: ''
});
@ -216,6 +217,11 @@
},
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) {
// TODO: we might need to take prebinding into consideration here.
this.renderLoginPanel();
@ -254,7 +260,6 @@
renderLoginPanel: function () {
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
var cfg = {
'$parent': this.$el.find('.controlbox-panes'),
'model': this
@ -273,7 +278,6 @@
},
renderContactsPanel: function () {
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
this.contactspanel = new converse.ContactsPanel({
'$parent': this.$el.find('.controlbox-panes')
});

View File

@ -4,7 +4,9 @@
<div class="dragresize dragresize-left"></div>
<div class="chat-head controlbox-head">
<ul id="controlbox-tabs"></ul>
<a class="chatbox-btn close-chatbox-button icon-close"></a>
{[ if (!sticky_controlbox) { ]}
<a class="chatbox-btn close-chatbox-button icon-close"></a>
{[ } ]}
</div>
<div class="controlbox-panes"></div>
</div>