diff --git a/converse.js b/converse.js index 2bdf69eb0..b1bb7defa 100644 --- a/converse.js +++ b/converse.js @@ -1304,6 +1304,7 @@ trimChat: function () { // TODO: Instead of closing the chat, we should add it to // div#offscreen-chatboxes + this.model.set('trimmed', true); this.$el.hide(); // Hide it immediately to avoid flashes on the screen this.closeChat(); }, @@ -2963,6 +2964,32 @@ } }); + this.TrimmedChatBoxes = Backbone.View.extend({ + /* A view for trimmed chat boxes and chat rooms. + * XXX: Add this view inside ChatBoxViews's $el (i.e. #conversejs) + */ + tagName: 'div', + id: 'trimmed-chatboxes', + initialize: function () { + var views = {}; + this.get = function (id) { return views[id]; }; + this.set = function (id, view) { views[id] = view; }; + this.getAll = function () { return views; }; + + this.$el.html(converse.templates.trimmed_chats()); + this.model.on("add", function (item) { + if (!item.get('trimmed')) { + return; + } + this.show(item); + }, this); + }, + + show: function (item) { + this.$('.box-flyout').append(converse.templates.trim_chat()); + } + }); + this.RosterView = Backbone.View.extend({ tagName: 'dl', id: 'converse-roster', diff --git a/less/converse.less b/less/converse.less index e8bf528b0..3120b1079 100644 --- a/less/converse.less +++ b/less/converse.less @@ -551,14 +551,14 @@ span.spinner.hor_centered { color: white; } -#conversejs #offscreen-chatboxes { +#conversejs #trimmed-chatboxes { float: left; height: 25px; margin-left: 5px; display: block; } -#conversejs #offscreen-chatboxes .box-flyout { +#conversejs #trimmed-chatboxes .box-flyout { position: absolute; display: block; bottom: 1px; @@ -567,7 +567,7 @@ span.spinner.hor_centered { height: auto; } -#conversejs #offscreen-chatboxes .box-flyout .chat-head { +#conversejs #trimmed-chatboxes .box-flyout .chat-head { font-size: 100%; border-radius: 4px; padding: 3px 0 0 5px; @@ -576,7 +576,7 @@ span.spinner.hor_centered { height: 24px; } -#conversejs #offscreen-chatboxes .chat-head-chatroom { +#conversejs #trimmed-chatboxes .chat-head-chatroom { width: 100px; } diff --git a/mockup/index.html b/mockup/index.html index 9de2ab47a..ad9141940 100644 --- a/mockup/index.html +++ b/mockup/index.html @@ -373,7 +373,7 @@ -
+
diff --git a/src/templates/trimmed_chat.html b/src/templates/trimmed_chat.html new file mode 100644 index 000000000..b26b56665 --- /dev/null +++ b/src/templates/trimmed_chat.html @@ -0,0 +1,4 @@ +
+ +
JC Brand
+
diff --git a/src/templates/trimmed_chats.html b/src/templates/trimmed_chats.html new file mode 100644 index 000000000..b179d37a0 --- /dev/null +++ b/src/templates/trimmed_chats.html @@ -0,0 +1 @@ +