now displays the number of pending messages when a discussion is minimized
bzr revid: nicolas.vanhoren@openerp.com-20130207143717-wg52x7lkbwm2g0rl
This commit is contained in:
@@ -353,6 +353,7 @@ openerp.web_im = function(instance) {
|
||||
this.user.add_watcher();
|
||||
this.set("right_position", 0);
|
||||
this.shown = true;
|
||||
this.set("pending", 0);
|
||||
},
|
||||
start: function() {
|
||||
var change_status = function() {
|
||||
@@ -366,6 +367,13 @@ openerp.web_im = function(instance) {
|
||||
this.on("change:right_position", this, this.calc_pos);
|
||||
this.full_height = this.$el.height();
|
||||
this.calc_pos();
|
||||
this.on("change:pending", this, _.bind(function() {
|
||||
if (this.get("pending") === 0) {
|
||||
this.$(".oe_im_chatview_nbr_messages").text("");
|
||||
} else {
|
||||
this.$(".oe_im_chatview_nbr_messages").text("(" + this.get("pending") + ")");
|
||||
}
|
||||
}, this));
|
||||
},
|
||||
show_hide: function() {
|
||||
if (this.shown) {
|
||||
@@ -378,11 +386,19 @@ openerp.web_im = function(instance) {
|
||||
});
|
||||
}
|
||||
this.shown = ! this.shown;
|
||||
if (this.shown) {
|
||||
this.set("pending", 0);
|
||||
}
|
||||
},
|
||||
calc_pos: function() {
|
||||
this.$el.css("right", this.get("right_position"));
|
||||
},
|
||||
received_message: function(message) {
|
||||
if (this.shown) {
|
||||
this.set("pending", 0);
|
||||
} else {
|
||||
this.set("pending", this.get("pending") + 1);
|
||||
}
|
||||
this._add_bubble(this.user, message.message, message.date);
|
||||
},
|
||||
send_message: function(e) {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<div class="oe_im_chatview_header">
|
||||
<img t-att-src="_s +'/web_im/static/src/img/green.png'" class="oe_im_chatview_online"/>
|
||||
<t t-esc="widget.user.get('name') || 'Anonymous'"/>
|
||||
<scan class="oe_im_chatview_nbr_messages" />
|
||||
<button class="oe_im_chatview_close">×</button>
|
||||
</div>
|
||||
<div class="oe_im_chatview_disconnected">
|
||||
|
||||
Reference in New Issue
Block a user