[IMP] Thread widget: cleaned follow/unfollow buttons behavior (text change when mouseover/mouseleave, update followers display)

bzr revid: tde@openerp.com-20120313172233-3zgm41f7m7mxzmie
This commit is contained in:
Thibault Delavallée
2012-03-13 18:22:33 +01:00
parent 5dbd526a19
commit 09a01870ff
2 changed files with 10 additions and 11 deletions
+8 -9
View File
@@ -377,9 +377,11 @@ openerp.mail = function(session) {
var self = this;
this._super.apply(this, arguments);
/* bind and hide buttons */
self.$element.find('button.oe_mail_button_followers').bind('click', function () { self.do_toggle_followers(); });
self.$element.find('button.oe_mail_button_follow').bind('click', function () { self.do_follow(); }).hide();
self.$element.find('button.oe_mail_button_unfollow').bind('click', function () { self.do_unfollow(); }).hide();
self.$element.find('button.oe_mail_button_followers').bind('click', function () { self.do_toggle_followers(); }).hide();
self.$element.find('button.oe_mail_button_follow').click(function () { self.do_follow(); }).hide()
.mouseover(function () { $(this).html('Follow'); }).mouseleave(function () { $(this).html('Not following'); });
self.$element.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); }).hide()
.mouseover(function () { $(this).html('Unfollow'); }).mouseleave(function () { $(this).html('Following'); });
},
stop: function () {
@@ -387,7 +389,6 @@ openerp.mail = function(session) {
},
set_value: function() {
console.log('set_value');
var self = this;
this._super.apply(this, arguments);
this.see_sub = 1;
@@ -428,12 +429,12 @@ openerp.mail = function(session) {
do_follow: function () {
this.do_toggle_follow();
return this.ds.call('message_subscribe', [[this.view.datarecord.id]]).when();
return this.ds.call('message_subscribe', [[this.view.datarecord.id]]).then(this.proxy('fetch_subscribers'));
},
do_unfollow: function () {
this.do_toggle_follow();
return this.ds.call('message_unsubscribe', [[this.view.datarecord.id]]).when();
return this.ds.call('message_unsubscribe', [[this.view.datarecord.id]]).then(this.proxy('fetch_subscribers'));
},
do_toggle_follow: function () {
@@ -450,9 +451,7 @@ openerp.mail = function(session) {
},
thread_get_avatar_mini: function(model, field, id) {
id = id || '';
var url = this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
return url;
return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '');
},
});
+2 -2
View File
@@ -31,8 +31,8 @@
</div>
<div class="oe_mail_recthread_right">
<div class="oe_mail_actions">
<button type="button" class="oe_mail_button_follow">Follow</button>
<button type="button" class="oe_mail_button_unfollow">Unfollow</button>
<button type="button" class="oe_mail_button_follow">Not following</button>
<button type="button" class="oe_mail_button_unfollow">Following</button>
<button type="button" class="oe_mail_button_followers">Display followers</button>
</div>
<div class="oe_mail_followers">