Some initial work on adding trimmed chat functionality
This commit is contained in:
parent
0b710b807d
commit
0b10ad00fd
27
converse.js
27
converse.js
@ -1304,6 +1304,7 @@
|
|||||||
trimChat: function () {
|
trimChat: function () {
|
||||||
// TODO: Instead of closing the chat, we should add it to
|
// TODO: Instead of closing the chat, we should add it to
|
||||||
// div#offscreen-chatboxes
|
// div#offscreen-chatboxes
|
||||||
|
this.model.set('trimmed', true);
|
||||||
this.$el.hide(); // Hide it immediately to avoid flashes on the screen
|
this.$el.hide(); // Hide it immediately to avoid flashes on the screen
|
||||||
this.closeChat();
|
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({
|
this.RosterView = Backbone.View.extend({
|
||||||
tagName: 'dl',
|
tagName: 'dl',
|
||||||
id: 'converse-roster',
|
id: 'converse-roster',
|
||||||
|
@ -551,14 +551,14 @@ span.spinner.hor_centered {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#conversejs #offscreen-chatboxes {
|
#conversejs #trimmed-chatboxes {
|
||||||
float: left;
|
float: left;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
#conversejs #offscreen-chatboxes .box-flyout {
|
#conversejs #trimmed-chatboxes .box-flyout {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: block;
|
display: block;
|
||||||
bottom: 1px;
|
bottom: 1px;
|
||||||
@ -567,7 +567,7 @@ span.spinner.hor_centered {
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#conversejs #offscreen-chatboxes .box-flyout .chat-head {
|
#conversejs #trimmed-chatboxes .box-flyout .chat-head {
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 3px 0 0 5px;
|
padding: 3px 0 0 5px;
|
||||||
@ -576,7 +576,7 @@ span.spinner.hor_centered {
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#conversejs #offscreen-chatboxes .chat-head-chatroom {
|
#conversejs #trimmed-chatboxes .chat-head-chatroom {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="offscreen-chatboxes">
|
<div id="trimmed-chatboxes">
|
||||||
<div class="box-flyout">
|
<div class="box-flyout">
|
||||||
<div class="chat-head chat-head-chatroom">
|
<div class="chat-head chat-head-chatroom">
|
||||||
<a class="close-chatbox-button icon-close"></a>
|
<a class="close-chatbox-button icon-close"></a>
|
||||||
|
4
src/templates/trimmed_chat.html
Normal file
4
src/templates/trimmed_chat.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div class="chat-head">
|
||||||
|
<a class="close-chatbox-button icon-close"></a>
|
||||||
|
<div class="chat-title">JC Brand</div>
|
||||||
|
</div>
|
1
src/templates/trimmed_chats.html
Normal file
1
src/templates/trimmed_chats.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div class="box-flyout"></div>
|
Loading…
Reference in New Issue
Block a user