Commit 7039dbe0 authored by JC Brand's avatar JC Brand

Move chat minimization to a separate plugin

parent fc251db5
...@@ -46,16 +46,17 @@ require.config({ ...@@ -46,16 +46,17 @@ require.config({
// Converse // Converse
"converse-api": "src/converse-api", "converse-api": "src/converse-api",
"converse-chatview": "src/converse-chatview", "converse-chatview": "src/converse-chatview",
"converse-rosterview": "src/converse-rosterview",
"converse-controlbox": "src/converse-controlbox", "converse-controlbox": "src/converse-controlbox",
"converse-core": "src/converse-core", "converse-core": "src/converse-core",
"converse-headline": "src/converse-headline", "converse-headline": "src/converse-headline",
"converse-mam": "src/converse-mam", "converse-mam": "src/converse-mam",
"converse-minimize": "src/converse-minimize",
"converse-muc": "src/converse-muc", "converse-muc": "src/converse-muc",
"converse-notification": "src/converse-notification", "converse-notification": "src/converse-notification",
"converse-otr": "src/converse-otr", "converse-otr": "src/converse-otr",
"converse-ping": "src/converse-ping", "converse-ping": "src/converse-ping",
"converse-register": "src/converse-register", "converse-register": "src/converse-register",
"converse-rosterview": "src/converse-rosterview",
"converse-templates": "src/converse-templates", "converse-templates": "src/converse-templates",
// Off-the-record-encryption // Off-the-record-encryption
...@@ -236,6 +237,7 @@ if (typeof define !== 'undefined') { ...@@ -236,6 +237,7 @@ if (typeof define !== 'undefined') {
"converse-register", // XEP-0077 In-band registration "converse-register", // XEP-0077 In-band registration
"converse-ping", // XEP-0199 XMPP Ping "converse-ping", // XEP-0199 XMPP Ping
"converse-notification",// HTML5 Notifications "converse-notification",// HTML5 Notifications
"converse-minimize", // Allows chat boxes to be minimized
"converse-headline", // Support for headline messages "converse-headline", // Support for headline messages
/* END: Removable components */ /* END: Removable components */
......
...@@ -66,12 +66,13 @@ ...@@ -66,12 +66,13 @@
}, },
ChatBoxes: { ChatBoxes: {
chatBoxShouldBeShown: function (chatbox) {
return this._super.chatBoxShouldBeShown.apply(this, arguments) &&
chatbox.get('id') !== 'controlbox';
},
onChatBoxesFetched: function (collection, resp) { onChatBoxesFetched: function (collection, resp) {
collection.each(function (chatbox) { this._super.onChatBoxesFetched.apply(this, arguments);
if (chatbox.get('id') !== 'controlbox' && !chatbox.get('minimized')) {
chatbox.trigger('show');
}
});
if (!_.include(_.pluck(resp, 'id'), 'controlbox')) { if (!_.include(_.pluck(resp, 'id'), 'controlbox')) {
this.add({ this.add({
id: 'controlbox', id: 'controlbox',
...@@ -80,7 +81,6 @@ ...@@ -80,7 +81,6 @@
} }
this.get('controlbox').save({connected:true}); this.get('controlbox').save({connected:true});
}, },
}, },
ChatBoxViews: { ChatBoxViews: {
...@@ -126,17 +126,6 @@ ...@@ -126,17 +126,6 @@
}, },
MinimizedChats: {
onChanged: function (item) {
if (item.get('id') === 'controlbox') {
return;
} else {
this._super.onChanged.apply(this, arguments);
}
}
},
ChatBox: { ChatBox: {
initialize: function () { initialize: function () {
if (this.get('id') === 'controlbox') { if (this.get('id') === 'controlbox') {
...@@ -330,17 +319,20 @@ ...@@ -330,17 +319,20 @@
return this; return this;
}, },
show: function () { onControlBoxToggleHidden: function () {
converse.controlboxtoggle.hide(function () { this.$el.show('fast', function () {
converse.chatboxviews.trimChats(this); if (converse.rosterview) {
this.$el.show('fast', function () { converse.rosterview.update();
if (converse.rosterview) { }
converse.rosterview.update(); utils.refreshWebkit();
}
utils.refreshWebkit();
}.bind(this));
converse.emit('controlBoxOpened', this); converse.emit('controlBoxOpened', this);
}.bind(this)); }.bind(this));
},
show: function () {
converse.controlboxtoggle.hide(
this.onControlBoxToggleHidden.bind(this)
);
return this; return this;
}, },
......
This diff is collapsed.
This diff is collapsed.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"converse-core", "converse-core",
"converse-api", "converse-api",
// TODO remove next two dependencies // TODO remove next two dependencies
"converse-chatview", "converse-chatview",
"converse-controlbox" "converse-controlbox"
], factory); ], factory);
}(this, function (converse, converse_api) { }(this, function (converse, converse_api) {
...@@ -933,7 +933,7 @@ ...@@ -933,7 +933,7 @@
} }
return true; return true;
}, },
fetchArchivedMessages: function (options) { fetchArchivedMessages: function (options) {
/* Fetch archived chat messages from the XMPP server. /* Fetch archived chat messages from the XMPP server.
* *
......
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