From 73cf8d29f9209c8adfcbed97248f6bcaaa220f41 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 5 Mar 2013 18:24:42 +0530 Subject: [IMP] Added EDIT button in message_followers template for editing the subtypes of the users. bzr revid: psa@tinyerp.com-20130305125442-z8h470slga4d77ll --- addons/mail/static/src/css/mail.css | 6 ++++++ addons/mail/static/src/js/mail_followers.js | 19 +++++++++++++++++++ addons/mail/static/src/xml/mail_followers.xml | 1 + 3 files changed, 26 insertions(+) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index e4e112cdfaf..3ed2482911c 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -617,6 +617,12 @@ right: 0px; line-height: 20px; } +.openerp .oe_followers .oe_edit_subtype{ + cursor: pointer; + line-height: 26px; + position: absolute; + right: 12px; +} .openerp .oe_followers .oe_show_more{ cursor: pointer; diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 41634fd2135..ba776995d5b 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -74,10 +74,29 @@ openerp_mail_followers = function(session, mail) { this.$el.on('click', '.oe_subtype_list input', self.do_update_subscription); // event: click on 'invite' button, that opens the invite wizard this.$('.oe_invite').on('click', self.on_invite_follower); + this.$el.on('click', '.oe_edit_subtype', self.on_edit_subtype); this.$el.on('click', '.oe_remove_follower', self.on_remove_follower); this.$el.on('click', '.oe_show_more', self.on_show_more_followers) }, + on_edit_subtype: function() { + var self = this; + var action = { + type: 'ir.actions.act_window', + res_model: 'mail.message.subtype', + domain: [['res_model','=', self.view.model]], + view_mode: 'list', + view_type: 'list', + views: [[false, 'list']], + target: 'new', + } + this.do_action(action, { + on_close: function() { + self.read_value(); + }, + }); + }, + on_invite_follower: function (event) { var self = this; var action = { diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 459f13155a0..c22d253b1f7 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,6 +32,7 @@
+ Edit X
-- cgit v1.2.3 From 7c5ddd2de0ead278c488fb380992a7a344b4c916 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 6 Mar 2013 16:48:54 +0530 Subject: [IMP]Placed edit image in place of edit link and improved css. bzr revid: psa@tinyerp.com-20130306111854-d95kiof2o4apc8ns --- addons/mail/static/src/css/mail.css | 4 +++- addons/mail/static/src/img/icon-edit.gif | Bin 0 -> 129 bytes addons/mail/static/src/xml/mail_followers.xml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 addons/mail/static/src/img/icon-edit.gif (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 3ed2482911c..8056c95ecb3 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -619,9 +619,11 @@ } .openerp .oe_followers .oe_edit_subtype{ cursor: pointer; - line-height: 26px; position: absolute; right: 12px; + margin-top: 6px; + width: 10px !important; + height: 12px !important; } .openerp .oe_followers .oe_show_more{ diff --git a/addons/mail/static/src/img/icon-edit.gif b/addons/mail/static/src/img/icon-edit.gif new file mode 100644 index 00000000000..6e9aa5ef659 Binary files /dev/null and b/addons/mail/static/src/img/icon-edit.gif differ diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index c22d253b1f7..1e88deb7960 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,7 +32,7 @@
- Edit + X
-- cgit v1.2.3 From 14317130c38bb254de5398c40847d293b9f51b32 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Mar 2013 12:50:39 +0530 Subject: [IMP] added method for checking the group technical features is added or not. bzr revid: psa@tinyerp.com-20130308072039-6iau8anuckonc6ps --- addons/mail/static/src/js/mail_followers.js | 16 +++++++++++++++- addons/mail/static/src/xml/mail_followers.xml | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index ba776995d5b..5c6d3bc3347 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -31,6 +31,7 @@ openerp_mail_followers = function(session, mail) { this.ds_model = new session.web.DataSetSearch(this, this.view.model); this.ds_follow = new session.web.DataSetSearch(this, this.field.relation); this.ds_users = new session.web.DataSetSearch(this, 'res.users'); + this.check_access = false; this.value = []; this.followers = []; @@ -149,7 +150,20 @@ openerp_mail_followers = function(session, mail) { return this.ds_follow.call('read', [this.value, ['name', 'user_ids']]) .then(this.proxy('display_followers'), this.proxy('fetch_generic')) .then(this.proxy('display_buttons')) - .then(this.proxy('fetch_subtypes')); + .then(this.proxy('fetch_subtypes')) + .then(this.proxy('check_group_tech_feature')); + }, + + check_group_tech_feature: function(){ + var self = this; + var edit_subtypes = new session.web.Model("res.groups"); + edit_subtypes.query(["name","users"]) + .filter([["name","=","Technical Features"], ["users","in",self.session.uid]]).first() + .then(function(res) { + if (res) { + self.check_access = true; + } + }); }, /** Read on res.partner failed: fall back on a generic case diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 1e88deb7960..18404c4ec05 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,7 +32,7 @@
- + X
-- cgit v1.2.3 From 0b62a6858f52a6d2e3edfaabdb64a71d2e0686fa Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Mar 2013 15:59:49 +0530 Subject: [IMP] 1) Added code for opening the dialog box of edit followers, 2) Added an image in the mail.message.subtype template which is visible when the Technical Features menu is selected true . 3) On clicking on the edit pencil which is with the followers name gives the subtypes of the specific followers on which the user had clicked rather than the current form. bzr revid: psa@tinyerp.com-20130314102949-4v9l6xpz5u1jeq10 --- addons/mail/static/src/js/mail_followers.js | 59 +++++++++++++++++++++++++-- addons/mail/static/src/xml/mail_followers.xml | 3 +- 2 files changed, 57 insertions(+), 5 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 5c6d3bc3347..031aeddb7d7 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -80,22 +80,72 @@ openerp_mail_followers = function(session, mail) { this.$el.on('click', '.oe_show_more', self.on_show_more_followers) }, - on_edit_subtype: function() { + on_edit_subtype: function(event) { var self = this; + var records = []; + var partner_id = $(event.target).data('id'); + var id = this.view.datarecord.id; + var res_model = this.view.dataset.model; + console.log('thissssssssssssssss>>', this, id, partner_id); + var $dialog = session.web.dialog($('
'), { + modal: true, + title: partner_id, + buttons: [ + {text: _t("Apply"), click: function() { + // self.apply_subtype(id, partner_id); + $(this).dialog("close"); + } + }, + {text: _t("Cancel"), click: function() { $(this).dialog("close"); }} + ], + }); + this.ds_model.call('edit_followers_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) + .then(function (data) { + // console.log('then>>>>>', data, id, partner_id); + if (data[id]) { + records = data[id].message_subtype_data; + // console.log('records........', records); + } + _(records).each(function (record, record_name) { + record.name = record_name; + record.followed = record.followed || undefined; + console.log('record??????????????', record); + $(session.web.qweb.render("mail.followers.subtype", {'record': record})).appendTo($dialog); + }); + }); + + /* var partner_id = $(event.target).data('id'); + var context = new session.web.CompoundContext(this.build_context(), {}); + var action = { type: 'ir.actions.act_window', - res_model: 'mail.message.subtype', + res_model: 'mail.message.subtype', //'subtype.edit.wizard', domain: [['res_model','=', self.view.model]], view_mode: 'list', view_type: 'list', views: [[false, 'list']], target: 'new', + context: { + 'res_model': this.view.dataset.model, + 'res_id': this.view.datarecord.id, + 'partner_id': partner_id, + }, } + this.do_action(action, { on_close: function() { self.read_value(); }, - }); + });*/ + + }, + + apply_subtype: function(id, partner_id) { + console.log('id>>>partner_id>>> ', id, partner_id); + this.ds_model.call('apply_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) + .then(function (data) { + console.log('dataaaaaaaaaaaaa', data); + }); }, on_invite_follower: function (event) { @@ -154,7 +204,7 @@ openerp_mail_followers = function(session, mail) { .then(this.proxy('check_group_tech_feature')); }, - check_group_tech_feature: function(){ + check_group_tech_feature: function() { var self = this; var edit_subtypes = new session.web.Model("res.groups"); edit_subtypes.query(["name","users"]) @@ -276,6 +326,7 @@ openerp_mail_followers = function(session, mail) { .then(this.proxy('read_value')); _.each(this.$('.oe_subtype_list input'), function (record) { + console.log('do follow>', record); $(record).attr('checked', 'checked'); }); }, diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 18404c4ec05..7721b1beb22 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,7 +32,8 @@
- + + X
-- cgit v1.2.3 From f242c87c7e182dbe011bedb74b0fbfdecf89336a Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Mar 2013 19:11:22 +0530 Subject: [IMP] Now partner name is displayed as per the record and added a new template. bzr revid: psa@tinyerp.com-20130314134122-gedt3b9eq5kolnlt --- addons/mail/static/src/js/mail_followers.js | 7 +++---- addons/mail/static/src/xml/mail_followers.xml | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 031aeddb7d7..41f227b5881 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -84,12 +84,12 @@ openerp_mail_followers = function(session, mail) { var self = this; var records = []; var partner_id = $(event.target).data('id'); + var partner_name = $(event.target).siblings('a').text(); var id = this.view.datarecord.id; var res_model = this.view.dataset.model; - console.log('thissssssssssssssss>>', this, id, partner_id); var $dialog = session.web.dialog($('
'), { modal: true, - title: partner_id, + title: _t('Edit Subtypes of ') + '"' + partner_name + '"', buttons: [ {text: _t("Apply"), click: function() { // self.apply_subtype(id, partner_id); @@ -109,8 +109,7 @@ openerp_mail_followers = function(session, mail) { _(records).each(function (record, record_name) { record.name = record_name; record.followed = record.followed || undefined; - console.log('record??????????????', record); - $(session.web.qweb.render("mail.followers.subtype", {'record': record})).appendTo($dialog); + $(session.web.qweb.render("mail.followers.edit.subtype", {'record': record})).appendTo($dialog); }); }); diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 7721b1beb22..071205803bb 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -50,6 +50,15 @@ + + + + + + +
+
+
And more.
-- cgit v1.2.3 From 90868a808903c8f5812a4243092a448752f25100 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Mar 2013 14:22:45 +0530 Subject: [IMP] Add method for the apply button when the user click on the apply button of the dialog box the data will be updated Removed unwanted code and clean the code. bzr revid: psa@tinyerp.com-20130315085245-uhefj63na5z62of5 --- addons/mail/static/src/js/mail_followers.js | 62 +++++++++------------------ addons/mail/static/src/xml/mail_followers.xml | 5 +-- 2 files changed, 22 insertions(+), 45 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 41f227b5881..0eb864d02da 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -87,24 +87,21 @@ openerp_mail_followers = function(session, mail) { var partner_name = $(event.target).siblings('a').text(); var id = this.view.datarecord.id; var res_model = this.view.dataset.model; - var $dialog = session.web.dialog($('
'), { + var $dialog = session.web.dialog($('
'), { modal: true, title: _t('Edit Subtypes of ') + '"' + partner_name + '"', buttons: [ - {text: _t("Apply"), click: function() { - // self.apply_subtype(id, partner_id); - $(this).dialog("close"); - } - }, - {text: _t("Cancel"), click: function() { $(this).dialog("close"); }} + { text: _t("Apply"), click: function() { + self.on_apply_subtype(id, partner_id); + $(this).dialog("close"); + }}, + { text: _t("Cancel"), click: function() { $(this).dialog("close"); }} ], }); - this.ds_model.call('edit_followers_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) + this.ds_model.call('edit_followers_subtype', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})]) .then(function (data) { - // console.log('then>>>>>', data, id, partner_id); if (data[id]) { records = data[id].message_subtype_data; - // console.log('records........', records); } _(records).each(function (record, record_name) { record.name = record_name; @@ -112,39 +109,21 @@ openerp_mail_followers = function(session, mail) { $(session.web.qweb.render("mail.followers.edit.subtype", {'record': record})).appendTo($dialog); }); }); + }, - /* var partner_id = $(event.target).data('id'); - var context = new session.web.CompoundContext(this.build_context(), {}); - - var action = { - type: 'ir.actions.act_window', - res_model: 'mail.message.subtype', //'subtype.edit.wizard', - domain: [['res_model','=', self.view.model]], - view_mode: 'list', - view_type: 'list', - views: [[false, 'list']], - target: 'new', - context: { - 'res_model': this.view.dataset.model, - 'res_id': this.view.datarecord.id, - 'partner_id': partner_id, - }, + on_apply_subtype: function(id, partner_id) { + var checklist = new Array(); + _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { + if ($(record).is(':checked')) { + checklist.push(parseInt($(record).data('id'))); + } + }); + if (!checklist.length) { + this.do_unfollow(); + } else { + this.ds_model.call('apply_edited_subtypes', [[id], partner_id, checklist, new session.web.CompoundContext(this.build_context(), {})]) + .then(this.proxy('read_value')); } - - this.do_action(action, { - on_close: function() { - self.read_value(); - }, - });*/ - - }, - - apply_subtype: function(id, partner_id) { - console.log('id>>>partner_id>>> ', id, partner_id); - this.ds_model.call('apply_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) - .then(function (data) { - console.log('dataaaaaaaaaaaaa', data); - }); }, on_invite_follower: function (event) { @@ -325,7 +304,6 @@ openerp_mail_followers = function(session, mail) { .then(this.proxy('read_value')); _.each(this.$('.oe_subtype_list input'), function (record) { - console.log('do follow>', record); $(record).attr('checked', 'checked'); }); }, diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 071205803bb..7a615044af1 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,8 +32,7 @@
- - + X
@@ -53,7 +52,7 @@ - +
-- cgit v1.2.3 From b5df63291a0de2cbcd42a348db5ffa925f8e4efc Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Mar 2013 18:01:57 +0530 Subject: [IMP] Removed the dialog box on apply and close to open a new dialog box everytime. Removed unwanted code. bzr revid: psa@tinyerp.com-20130315123157-n0n3fdej014ysz7v --- addons/mail/static/src/js/mail_followers.js | 37 ++++++++++------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 0eb864d02da..0bfcbfc29e9 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -31,7 +31,6 @@ openerp_mail_followers = function(session, mail) { this.ds_model = new session.web.DataSetSearch(this, this.view.model); this.ds_follow = new session.web.DataSetSearch(this, this.field.relation); this.ds_users = new session.web.DataSetSearch(this, 'res.users'); - this.check_access = false; this.value = []; this.followers = []; @@ -87,15 +86,15 @@ openerp_mail_followers = function(session, mail) { var partner_name = $(event.target).siblings('a').text(); var id = this.view.datarecord.id; var res_model = this.view.dataset.model; - var $dialog = session.web.dialog($('
'), { + var $dialog = new session.web.dialog($('
'), { modal: true, title: _t('Edit Subtypes of ') + '"' + partner_name + '"', buttons: [ { text: _t("Apply"), click: function() { self.on_apply_subtype(id, partner_id); - $(this).dialog("close"); + $dialog.remove(); }}, - { text: _t("Cancel"), click: function() { $(this).dialog("close"); }} + { text: _t("Cancel"), click: function() { $dialog.remove(); }} ], }); this.ds_model.call('edit_followers_subtype', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})]) @@ -112,16 +111,17 @@ openerp_mail_followers = function(session, mail) { }, on_apply_subtype: function(id, partner_id) { - var checklist = new Array(); - _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { - if ($(record).is(':checked')) { - checklist.push(parseInt($(record).data('id'))); - } + var check_list = new Array(); + _($('.oe_edit_actions input[type="checkbox"]')).each(function (records) { + if ($(records).is(':checked')) { + check_list.push(parseInt($(records).data('id'))); + } }); - if (!checklist.length) { + + if (!check_list.length) { this.do_unfollow(); } else { - this.ds_model.call('apply_edited_subtypes', [[id], partner_id, checklist, new session.web.CompoundContext(this.build_context(), {})]) + return this.ds_model.call('apply_edited_subtypes', [[id], partner_id, check_list, new session.web.CompoundContext(this.build_context(), {})]) .then(this.proxy('read_value')); } }, @@ -178,20 +178,7 @@ openerp_mail_followers = function(session, mail) { return this.ds_follow.call('read', [this.value, ['name', 'user_ids']]) .then(this.proxy('display_followers'), this.proxy('fetch_generic')) .then(this.proxy('display_buttons')) - .then(this.proxy('fetch_subtypes')) - .then(this.proxy('check_group_tech_feature')); - }, - - check_group_tech_feature: function() { - var self = this; - var edit_subtypes = new session.web.Model("res.groups"); - edit_subtypes.query(["name","users"]) - .filter([["name","=","Technical Features"], ["users","in",self.session.uid]]).first() - .then(function(res) { - if (res) { - self.check_access = true; - } - }); + .then(this.proxy('fetch_subtypes')); }, /** Read on res.partner failed: fall back on a generic case -- cgit v1.2.3 From 0abe605544641bb0788f6b84f8df76603dd90b93 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Mar 2013 18:18:43 +0530 Subject: [IMP] Oops sorry forgot to remove the prints and improved code. bzr revid: psa@tinyerp.com-20130315124843-xtp19rbm2cvyfb67 --- addons/mail/static/src/js/mail_followers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 0bfcbfc29e9..b778f3bb6b2 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -112,9 +112,9 @@ openerp_mail_followers = function(session, mail) { on_apply_subtype: function(id, partner_id) { var check_list = new Array(); - _($('.oe_edit_actions input[type="checkbox"]')).each(function (records) { - if ($(records).is(':checked')) { - check_list.push(parseInt($(records).data('id'))); + _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { + if ($(record).is(':checked')) { + check_list.push(parseInt($(record).data('id'))); } }); -- cgit v1.2.3 From cf3415f0877affc7f26ad16cd6a47ba671a9d601 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 19 Mar 2013 13:03:19 +0530 Subject: [IMP]Changed the position of methods and improved code. bzr revid: psa@tinyerp.com-20130319073319-8myj2hx5iaqmi5xj --- addons/mail/static/src/js/mail_followers.js | 4 ++-- addons/mail/static/src/xml/mail_followers.xml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 9a9f5f2ba54..1ca65087316 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -92,9 +92,9 @@ openerp_mail_followers = function(session, mail) { buttons: [ { text: _t("Apply"), click: function() { self.on_apply_subtype(id, partner_id); - $dialog.remove(); + $(this).remove(); }}, - { text: _t("Cancel"), click: function() { $dialog.remove(); }} + { text: _t("Cancel"), click: function() { $(this).remove(); }} ], }); this.ds_model.call('edit_followers_subtype', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})]) diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 4a492cee713..ea11c26570b 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -48,6 +48,10 @@ + -- cgit v1.2.3 From e9065f77273a544c99b546bf58201ee9c08b4b73 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 21 Mar 2013 18:10:36 +0530 Subject: [IMP] Reduced code, deleted redundant code, deleted the edit template and used it in the existing by using 'mode' and improved code using the existing code and removed unwanted code. bzr revid: psa@tinyerp.com-20130321124036-0s4pv3oivzesmjh5 --- addons/mail/static/src/js/mail_followers.js | 53 +++++++++++++-------------- addons/mail/static/src/xml/mail_followers.xml | 17 +-------- 2 files changed, 28 insertions(+), 42 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 1ca65087316..155cd74ebeb 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -81,37 +81,27 @@ openerp_mail_followers = function(session, mail) { on_edit_subtype: function(event) { var self = this; - var records = []; var partner_id = $(event.target).data('id'); - var partner_name = $(event.target).siblings('a').text(); - var id = this.view.datarecord.id; - var res_model = this.view.dataset.model; - var $dialog = new session.web.dialog($('
'), { + var context = new session.web.CompoundContext(this.build_context(), {'partner_id': partner_id}); + self.$dialog = new session.web.dialog($('
'), { modal: true, - title: _t('Edit Subtypes of ') + '"' + partner_name + '"', + width: 'auto', + height: 'auto', + title: _t('Edit Subscriptions of ') + $(event.target).siblings('a').text(), buttons: [ { text: _t("Apply"), click: function() { - self.on_apply_subtype(id, partner_id); + self.on_apply_subtype(partner_id); $(this).remove(); }}, { text: _t("Cancel"), click: function() { $(this).remove(); }} ], }); - this.ds_model.call('edit_followers_subtype', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})]) - .then(function (data) { - if (data[id]) { - records = data[id].message_subtype_data; - } - _(records).each(function (record, record_name) { - record.name = record_name; - record.followed = record.followed || undefined; - $(session.web.qweb.render("mail.followers.edit.subtype", {'record': record})).appendTo($dialog); - }); - }); + return self.fetch_subtypes(context); }, - on_apply_subtype: function(id, partner_id) { + on_apply_subtype: function(partner_id) { var check_list = new Array(); + var id = this.view.datarecord.id; _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { if ($(record).is(':checked')) { check_list.push(parseInt($(record).data('id'))); @@ -256,25 +246,34 @@ openerp_mail_followers = function(session, mail) { }, /** Fetch subtypes, only if current user is follower */ - fetch_subtypes: function () { + fetch_subtypes: function (context) { var self = this; - var subtype_list_ul = this.$('.oe_subtype_list').empty(); - if (! this.message_is_follower) return; + var mode = ""; + if (context && context.eval('partner_id')) { + mode = "edit_follower"; + } else { + var subtype_list_ul = this.$('.oe_subtype_list').empty(); + if (! this.message_is_follower) return; + } var id = this.view.datarecord.id; - this.ds_model.call('message_get_subscription_data', [[id], new session.web.CompoundContext(this.build_context(), {})]) - .then(function (data) {self.display_subtypes(data, id);}); + this.ds_model.call('message_get_subscription_data', [[id],context]) + .then(function (data) {self.display_subtypes(data, id, mode);}); }, /** Display subtypes: {'name': default, followed} */ - display_subtypes:function (data, id) { + display_subtypes:function (data, id, mode) { var self = this; var $list = this.$('.oe_subtype_list'); - $list.empty().hide(); + if (mode.length == 0){ $list.empty().hide();} var records = data[this.view.datarecord.id || this.view.dataset.ids[0]].message_subtype_data; _(records).each(function (record, record_name) { record.name = record_name; record.followed = record.followed || undefined; - $(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo( self.$('.oe_subtype_list') ); + if (mode.length == 0) { + $(session.web.qweb.render('mail.followers.subtype', {'record': record,'mode': mode})).appendTo( self.$('.oe_subtype_list') ); + } else { + $(session.web.qweb.render('mail.followers.subtype', {'record': record,'mode': mode})).appendTo(self.$dialog); + } }); if (_.size(records) > 1) { $list.show(); diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index ea11c26570b..6420046477c 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -42,21 +42,8 @@
- - - -
-
- - - - - - - + +
-- cgit v1.2.3 From f1db1ed7783b664ac3b6cceb085edfdddb7b8ee2 Mon Sep 17 00:00:00 2001 From: "Vishmita Jadeja (openerp)" Date: Fri, 22 Mar 2013 13:52:06 +0530 Subject: [IMP]Add method for checking the group technical features. bzr revid: vja@tinyerp.com-20130322082206-x2490850o8qbkmk0 --- addons/mail/static/src/js/mail_followers.js | 9 +++++++-- addons/mail/static/src/xml/mail_followers.xml | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 155cd74ebeb..c615ceb35e5 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -210,14 +210,19 @@ openerp_mail_followers = function(session, mail) { var self = this; this.followers = records || this.followers; this.message_is_follower = this.set_is_follower(this.followers); + this.check_access = false; + // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { - record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); - $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); + self.ds_model.call('check_access_right', [self.session.uid]).then(function(r){ + self.check_access = r; + record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); + $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); + }) }); // FVA note: be sure it is correctly translated if (truncated.length < this.followers.length) { diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 6420046477c..bdcfd1e048c 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -31,7 +31,8 @@
- + console.log("dsfsdfd",d) + X
-- cgit v1.2.3 From bd6a436bbb04b8121e58ad8b547ba8d7c67c3584 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 22 Mar 2013 14:40:26 +0530 Subject: [IMP] Added css for the ' Close(X)' icon of the dialog box when the title size increases than overlap the title. bzr revid: psa@tinyerp.com-20130322091026-m0eqoqnt1t2p184v --- addons/mail/static/src/css/mail.css | 4 +++- addons/mail/static/src/js/mail_followers.js | 4 ++-- addons/mail/static/src/xml/mail_followers.xml | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 6d7d8875601..9805c9d3a61 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -646,7 +646,9 @@ width: 10px !important; height: 12px !important; } - +.openerp.ui-dialog .ui-dialog-titlebar .ui-dialog-title{ + padding-right: 20px; +} .openerp .oe_followers .oe_show_more{ cursor: pointer; } diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index c615ceb35e5..7e49a391bca 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -218,8 +218,8 @@ openerp_mail_followers = function(session, mail) { // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { - self.ds_model.call('check_access_right', [self.session.uid]).then(function(r){ - self.check_access = r; + self.ds_model.call('check_access_right', [self.session.uid]).then(function(result){ + self.check_access = result; record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); }) diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index bdcfd1e048c..081111a9afd 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -31,7 +31,6 @@
- console.log("dsfsdfd",d) X
-- cgit v1.2.3 From 038630657c8dcd3223bd6008c6e32728ccecdeb9 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 27 Mar 2013 16:41:48 +0100 Subject: [FIX] the created message is the last one in the thread list bzr revid: mat@openerp.com-20130327154148-sjia6b39yjix6fm1 --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index ad69f7e41c3..98b5c57d652 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -734,7 +734,7 @@ openerp.mail = function (session) { } // create object and attach to the thread object thread.message_fetch([["id", "=", message_id]], false, [message_id], function (arg, data) { - var message = thread.create_message_object( data[0] ); + var message = thread.create_message_object( data.slice(-1)[0] ); // insert the message on dom thread.insert_message( message, root ? undefined : self.$el, root ); }); -- cgit v1.2.3 From 5a112d8fa2f34d978e2580d706aef82b8e704e44 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 28 Mar 2013 17:16:34 +0100 Subject: [ADD] suggested groups bzr revid: mat@openerp.com-20130328161634-1fcmj0s67bofc6ra --- addons/mail/static/src/css/mail.css | 63 +++++++++++++++++++++++++++++ addons/mail/static/src/js/mail.js | 3 ++ addons/mail/static/src/js/mail_followers.js | 2 +- addons/mail/static/src/xml/mail.xml | 4 +- 4 files changed, 68 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 51306727a09..9604a052c5c 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -664,8 +664,71 @@ .openerp .oe_mail_wall .oe_mail{ margin: 16px; width: 600px; + display: inline-block; } .openerp .oe_mail .oe_view_nocontent > p { padding-left: 15px; } + + +/* ------------- WALL SIDEBAR ------------- */ + +.openerp .oe_mail_wall .oe_mail_wall_aside { + margin-left: 20px; + margin-top: 20px; + position: relative; + display: inline-block; + vertical-align: top; + width: 300px; +} + +.openerp .oe_mail_wall_aside > div { + background-color: #EDEDF6; + border-radius: 2px; + padding: 10px; +} +.openerp .oe_mail_wall_aside .oe_user_display { + font-size: 14px; + font-weight: bold; + margin-left: 10px; + color: #7C7BAD; +} +.openerp .oe_mail_wall_aside .oe_suggested_groups { + border-radius: 2px; + width: 100%; + margin-left: 10px; + height: 90px; +} +.openerp .oe_mail_wall_aside .oe_group_images { + width: 20%; + float: left; + padding-right: 20px; +} +.openerp .oe_mail_wall_aside .oe_group_image_content { + border-radius: 2px; + border: solid 1px rgba(0,0,0,0.03); +} +.openerp .oe_mail_wall_aside .oe_join_group { + margin-top: 10px; +} +.openerp .oe_mail_wall_aside .oe_follow_people { + margin-top: 10px; +} +.openerp .oe_mail_wall_aside .oe_remove_suggested_group { + visibility:hidden; + width:3%; + float:right; + margin-right:20px; +} +.openerp .oe_mail_wall_aside .oe_suggested_groups:hover .oe_remove_suggested_group > span { + visibility: visible; +} +.openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group { + width: 80%; +} +.openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group .oe_group_name { + text-overflow: ellipsis; + overflow: hidden; + width: 90%; +} \ No newline at end of file diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 98b5c57d652..0290eb1c82b 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -6,6 +6,7 @@ openerp.mail = function (session) { openerp_mail_followers(session, mail); // import mail_followers.js openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js + /** * ------------------------------------------------------------ @@ -1991,4 +1992,6 @@ openerp.mail = function (session) { }); }, }); + + openerp.mail.suggestions(session, mail); }; diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 6fc2f0fdfcd..79aa3f02dd3 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -3,7 +3,7 @@ openerp_mail_followers = function(session, mail) { _lt = session.web._lt; var mail_followers = session.mail_followers = {}; - + /** * ------------------------------------------------------------ * mail_followers Widget diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index b26ef06f5e4..c7681181c6a 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -195,6 +195,7 @@
+
-- cgit v1.2.3 From 3af8beb2b91217d229617c7b154f9456b0cdf3ea Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 29 Mar 2013 09:01:40 +0100 Subject: [ADD] suggestion js and xml files bzr revid: mat@openerp.com-20130329080140-t99dzeaiwikwjpsm --- addons/mail/static/src/js/suggestions.js | 86 ++++++++++++++++++++++++++++++ addons/mail/static/src/xml/suggestions.xml | 35 ++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 addons/mail/static/src/js/suggestions.js create mode 100644 addons/mail/static/src/xml/suggestions.xml (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js new file mode 100644 index 00000000000..23cc54a62a9 --- /dev/null +++ b/addons/mail/static/src/js/suggestions.js @@ -0,0 +1,86 @@ +openerp.mail.suggestions = function(session, mail) { + var _t = session.web._t; + var QWeb = session.web.qweb + + var suggestions = session.suggestions = {}; + + suggestions.Sidebar = session.web.Widget.extend({ + template: "mail.suggestions", + init: function (parent, action) { + var self = this; + this._super(parent, action); + this.res_user = new session.web.DataSetSearch(this, 'res.users'); + }, + }); + + var removed_suggested_group = session.removed_suggested_group = []; + suggestions.Groups = session.web.Widget.extend({ + init: function (parent, action) { + console.log("init"); + var self = this; + this._super(parent, action); + this.deferred = $.Deferred(); + this.mail_group = new session.web.DataSetSearch(this, 'mail.group'); + this.suggestions = []; + }, + start: function() { + var self = this; + var args = arguments; + var res = self.get_suggested_group(); + return $.when(res).done(function() {}); + }, + get_suggested_group: function () { + + var self = this; + var group = self.mail_group.call('get_suggested_thread', {'removed_suggested_threads':removed_suggested_group}).then(function(res) { + if(res.length<=0) {self.$(".oe_user_profile_group").hide();} + _(res).each(function(result) { + result['image']=self.session.url('/web/binary/image', {model: 'mail.group', field: 'image_small', id: result.id}); + }); + self.suggestions = res + }); + return $.when(group).done(function() { + self.$el.html( QWeb.render("mail.suggestions.groups", {'widget': self}) ); + self.bind_events(); + }); + }, + bind_events: function() { + var self = this; + this.$el.one('click', '.oe_remove_suggested_group', {data:this}, self.remove_suggested_group); + self.$el.one('click', '.oe_join_group', { data:self }, self.join_group); + }, + join_group:function(event) { + var self = this; + console.log("join"); + return event.data.data.mail_group.call('message_subscribe_users', [[$(self).attr('id')],[event.data.data.session.uid]]).then(function(res) { + event.data.data.get_suggested_group(); + }); + }, + remove_suggested_group: function(event) { + var self = this; + console.log("remove"); + removed_suggested_group.push($(self).attr('id')); + event.data.data.get_suggested_group(); + }, + }); + + mail.Wall.include({ + start: function(options) { + this._super(options); + var self = this; + var sidebar = new suggestions.Sidebar(self); + sidebar.appendTo(self.$el.find('.oe_mail_wall_aside')).then( function() { + + }); + + var sug_groups = new suggestions.Groups(self); + // sug_groups.replace(self.$el.find('.oe_suggestions_groups')); + $.when(sug_groups.start()).done(function() { + //self.$el.find('.oe_suggestions_groups').html(sug_groups.$el.html()); + sug_groups.replace( self.$el.find('.oe_suggestions_groups') ); + }); + + } + }); + +}; diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml new file mode 100644 index 00000000000..874226bb332 --- /dev/null +++ b/addons/mail/static/src/xml/suggestions.xml @@ -0,0 +1,35 @@ + + -- cgit v1.2.3 From 64dcc8db926e4c08959b3cd781467c7c43675035 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 3 Apr 2013 11:12:44 +0200 Subject: [IMP] CSS tweaks bzr revid: mat@openerp.com-20130403091244-l3snsoja4t8c41q6 --- addons/mail/static/src/css/mail.css | 8 +++----- addons/mail/static/src/css/mail_group.css | 1 - addons/mail/static/src/xml/suggestions.xml | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 9604a052c5c..8768675e4ce 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -22,7 +22,7 @@ width: 32px; height: 32px; padding: 0px; - margin: 0px + margin: 0px; border-radius: 0px; } @@ -688,20 +688,18 @@ border-radius: 2px; padding: 10px; } -.openerp .oe_mail_wall_aside .oe_user_display { +.openerp .oe_mail_wall_aside .oe_suggestion_display { font-size: 14px; font-weight: bold; margin-left: 10px; - color: #7C7BAD; } .openerp .oe_mail_wall_aside .oe_suggested_groups { border-radius: 2px; width: 100%; margin-left: 10px; - height: 90px; + min-height: 70px; /* image_small 66x66px */ } .openerp .oe_mail_wall_aside .oe_group_images { - width: 20%; float: left; padding-right: 20px; } diff --git a/addons/mail/static/src/css/mail_group.css b/addons/mail/static/src/css/mail_group.css index c1cefee9070..53f8b2fb010 100644 --- a/addons/mail/static/src/css/mail_group.css +++ b/addons/mail/static/src/css/mail_group.css @@ -44,7 +44,6 @@ text-align: center; overflow: hidden; -moz-border-radius: 3px; - border-collapse: separate; -webkit-border-radius: 3px; -o-border-radius: 3px; -ms-border-radius: 3px; diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index 874226bb332..515a3c2b497 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -7,7 +7,7 @@
-

Suggested Groups

+

Suggested Groups

-- cgit v1.2.3 From 851e6c1f5a5d9a8b206e115760c7f2ae484341ce Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 3 Apr 2013 14:24:08 +0200 Subject: [REF] cleaning js code bzr revid: mat@openerp.com-20130403122408-fbbybeczf6xqwjvc --- addons/mail/static/src/css/mail.css | 2 +- addons/mail/static/src/js/suggestions.js | 50 +++++++++++++++++------------- addons/mail/static/src/xml/suggestions.xml | 8 ++--- 3 files changed, 33 insertions(+), 27 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 8768675e4ce..54990d0ed5f 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -723,7 +723,7 @@ visibility: visible; } .openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group { - width: 80%; + width: 90%; } .openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group .oe_group_name { text-overflow: ellipsis; diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index 23cc54a62a9..eae7cafe79c 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -1,6 +1,6 @@ openerp.mail.suggestions = function(session, mail) { var _t = session.web._t; - var QWeb = session.web.qweb + var QWeb = session.web.qweb; var suggestions = session.suggestions = {}; @@ -10,13 +10,17 @@ openerp.mail.suggestions = function(session, mail) { var self = this; this._super(parent, action); this.res_user = new session.web.DataSetSearch(this, 'res.users'); - }, + } }); var removed_suggested_group = session.removed_suggested_group = []; suggestions.Groups = session.web.Widget.extend({ + events: { + 'click .oe_remove_suggested_group': "remove_suggested_group", + 'click .oe_join_group': "join_group", + 'click .oe_open_group': "open_group" + }, init: function (parent, action) { - console.log("init"); var self = this; this._super(parent, action); this.deferred = $.Deferred(); @@ -30,38 +34,44 @@ openerp.mail.suggestions = function(session, mail) { return $.when(res).done(function() {}); }, get_suggested_group: function () { - var self = this; var group = self.mail_group.call('get_suggested_thread', {'removed_suggested_threads':removed_suggested_group}).then(function(res) { - if(res.length<=0) {self.$(".oe_user_profile_group").hide();} _(res).each(function(result) { result['image']=self.session.url('/web/binary/image', {model: 'mail.group', field: 'image_small', id: result.id}); }); - self.suggestions = res + + self.suggestions = res; }); return $.when(group).done(function() { self.$el.html( QWeb.render("mail.suggestions.groups", {'widget': self}) ); - self.bind_events(); + if (self.suggestions.length === 0) { + self.$(".oe_sidebar_group").hide(); + } }); }, - bind_events: function() { + open_group:function(event) { var self = this; - this.$el.one('click', '.oe_remove_suggested_group', {data:this}, self.remove_suggested_group); - self.$el.one('click', '.oe_join_group', { data:self }, self.join_group); + var id = JSON.parse($(event.currentTarget).attr("id")); + action = { + type: 'ir.actions.act_window', + res_model: 'mail.group', + res_id: id, + views: [[false, 'form']], + target: 'current' + }; + this.do_action(action); }, join_group:function(event) { var self = this; - console.log("join"); - return event.data.data.mail_group.call('message_subscribe_users', [[$(self).attr('id')],[event.data.data.session.uid]]).then(function(res) { - event.data.data.get_suggested_group(); + return this.mail_group.call('message_subscribe_users', [[$(event.currentTarget).attr('id')],[this.session.uid]]).then(function(res) { + self.get_suggested_group(); }); }, remove_suggested_group: function(event) { var self = this; - console.log("remove"); - removed_suggested_group.push($(self).attr('id')); - event.data.data.get_suggested_group(); - }, + removed_suggested_group.push($(event.currentTarget).attr('id')); + self.get_suggested_group(); + } }); mail.Wall.include({ @@ -69,9 +79,7 @@ openerp.mail.suggestions = function(session, mail) { this._super(options); var self = this; var sidebar = new suggestions.Sidebar(self); - sidebar.appendTo(self.$el.find('.oe_mail_wall_aside')).then( function() { - - }); + sidebar.appendTo(self.$el.find('.oe_mail_wall_aside')); var sug_groups = new suggestions.Groups(self); // sug_groups.replace(self.$el.find('.oe_suggestions_groups')); @@ -79,7 +87,7 @@ openerp.mail.suggestions = function(session, mail) { //self.$el.find('.oe_suggestions_groups').html(sug_groups.$el.html()); sug_groups.replace( self.$el.find('.oe_suggestions_groups') ); }); - + } }); diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index 515a3c2b497..35ef62d8acd 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -12,15 +12,13 @@
- - - +
- + - + X
-- cgit v1.2.3 From 8d8eb553ceac3b3c4ca037c442c7f1714c0d9a12 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 3 Apr 2013 16:27:16 +0200 Subject: [ADD] suggestions for employees to follow bzr revid: mat@openerp.com-20130403142716-lmsz9hwkg7tathly --- addons/mail/static/src/css/mail.css | 19 ++++++++----------- addons/mail/static/src/js/mail_followers.js | 2 ++ addons/mail/static/src/js/suggestions.js | 1 - addons/mail/static/src/xml/suggestions.xml | 14 +++++++------- 4 files changed, 17 insertions(+), 19 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 54990d0ed5f..d22b58bde74 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -693,39 +693,36 @@ font-weight: bold; margin-left: 10px; } -.openerp .oe_mail_wall_aside .oe_suggested_groups { +.openerp .oe_mail_wall_aside .oe_suggested_item { border-radius: 2px; width: 100%; margin-left: 10px; min-height: 70px; /* image_small 66x66px */ } -.openerp .oe_mail_wall_aside .oe_group_images { +.openerp .oe_mail_wall_aside .oe_item_image { float: left; padding-right: 20px; } -.openerp .oe_mail_wall_aside .oe_group_image_content { +.openerp .oe_mail_wall_aside .oe_item_image_content { border-radius: 2px; border: solid 1px rgba(0,0,0,0.03); } -.openerp .oe_mail_wall_aside .oe_join_group { +.openerp .oe_mail_wall_aside .oe_suggestion_action { margin-top: 10px; } -.openerp .oe_mail_wall_aside .oe_follow_people { - margin-top: 10px; -} -.openerp .oe_mail_wall_aside .oe_remove_suggested_group { +.openerp .oe_mail_wall_aside .oe_remove_suggested_item { visibility:hidden; width:3%; float:right; margin-right:20px; } -.openerp .oe_mail_wall_aside .oe_suggested_groups:hover .oe_remove_suggested_group > span { +.openerp .oe_mail_wall_aside .oe_suggested_item:hover .oe_remove_suggested_item > span { visibility: visible; } -.openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group { +.openerp .oe_mail_wall_aside .oe_item { width: 90%; } -.openerp .oe_mail_wall_aside .oe_suggest_groups .oe_group .oe_group_name { +.openerp .oe_mail_wall_aside .oe_item .oe_item_name { text-overflow: ellipsis; overflow: hidden; width: 90%; diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 79aa3f02dd3..cf63b79e2ed 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -28,7 +28,9 @@ openerp_mail_followers = function(session, mail) { this.comment = this.node.attrs.help || false; this.displayed_limit = this.node.attrs.displayed_nb || 10; this.displayed_nb = this.displayed_limit; + console.log(this.displayed_nb); this.ds_model = new session.web.DataSetSearch(this, this.view.model); + console.log(this.ds_model); this.ds_follow = new session.web.DataSetSearch(this, this.field.relation); this.ds_users = new session.web.DataSetSearch(this, 'res.users'); diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index eae7cafe79c..137607a7643 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -29,7 +29,6 @@ openerp.mail.suggestions = function(session, mail) { }, start: function() { var self = this; - var args = arguments; var res = self.get_suggested_group(); return $.when(res).done(function() {}); }, diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index 35ef62d8acd..949e421143c 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -10,19 +10,19 @@

Suggested Groups

-
-
- +
+
+
-
- +
+ - + X
- +
-- cgit v1.2.3 From 46110fbf2995f3a8104f3f08007db4cf43000a85 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 3 Apr 2013 17:10:56 +0200 Subject: [ADD] option to globally stop showing group suggestions bzr revid: mat@openerp.com-20130403151056-4vjno2k9n77drm6y --- addons/mail/static/src/css/mail.css | 10 ++++++---- addons/mail/static/src/js/suggestions.js | 8 ++++++++ addons/mail/static/src/xml/suggestions.xml | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index d22b58bde74..9076ae0387e 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -683,7 +683,7 @@ width: 300px; } -.openerp .oe_mail_wall_aside > div { +.openerp .oe_mail_wall_aside .oe_sidebar_suggestion { background-color: #EDEDF6; border-radius: 2px; padding: 10px; @@ -710,16 +710,18 @@ .openerp .oe_mail_wall_aside .oe_suggestion_action { margin-top: 10px; } -.openerp .oe_mail_wall_aside .oe_remove_suggested_item { +.openerp .oe_mail_wall_aside .oe_remove_suggested_item, +.openerp .oe_mail_wall_aside .oe_remove_suggestion { visibility:hidden; width:3%; float:right; margin-right:20px; } -.openerp .oe_mail_wall_aside .oe_suggested_item:hover .oe_remove_suggested_item > span { +.openerp .oe_mail_wall_aside .oe_suggested_item:hover .oe_remove_suggested_item > span, +.openerp .oe_mail_wall_aside .oe_suggestion_display:hover .oe_remove_suggestion > span { visibility: visible; } -.openerp .oe_mail_wall_aside .oe_item { +.openerp .oe_mail_wall_aside .oe_item,.oe_suggestion_display { width: 90%; } .openerp .oe_mail_wall_aside .oe_item .oe_item_name { diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index 137607a7643..ad0867f4930 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -16,6 +16,7 @@ openerp.mail.suggestions = function(session, mail) { var removed_suggested_group = session.removed_suggested_group = []; suggestions.Groups = session.web.Widget.extend({ events: { + 'click .oe_remove_suggestion_employees': "remove_employee_suggestions", 'click .oe_remove_suggested_group': "remove_suggested_group", 'click .oe_join_group': "join_group", 'click .oe_open_group': "open_group" @@ -25,6 +26,7 @@ openerp.mail.suggestions = function(session, mail) { this._super(parent, action); this.deferred = $.Deferred(); this.mail_group = new session.web.DataSetSearch(this, 'mail.group'); + this.res_users = new session.web.DataSetSearch(this, 'res.users'); this.suggestions = []; }, start: function() { @@ -70,6 +72,12 @@ openerp.mail.suggestions = function(session, mail) { var self = this; removed_suggested_group.push($(event.currentTarget).attr('id')); self.get_suggested_group(); + }, + remove_employee_suggestions: function(event) { + var self = this; + return this.res_users.call('stop_showing_group_suggestions', [this.session.uid]).then(function(res) { + self.$(".oe_sidebar_group").hide(); + }); } }); diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index 949e421143c..1ebd2f6276c 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -6,8 +6,13 @@ -
-

Suggested Groups

+
+

+ Suggested Groups + + X + +

-- cgit v1.2.3 From 52ddce88f338d8c904efe6b652f1a236da2763fc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 3 Apr 2013 17:24:43 +0200 Subject: [ADD] option to globally stop showing employeep suggestions bzr revid: mat@openerp.com-20130403152443-3jqg0v182mcqsk0f --- addons/mail/static/src/js/suggestions.js | 6 +++--- addons/mail/static/src/xml/suggestions.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index ad0867f4930..205f8b2f27d 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -16,7 +16,7 @@ openerp.mail.suggestions = function(session, mail) { var removed_suggested_group = session.removed_suggested_group = []; suggestions.Groups = session.web.Widget.extend({ events: { - 'click .oe_remove_suggestion_employees': "remove_employee_suggestions", + 'click .oe_remove_suggestion_groups': "remove_suggestion_groups", 'click .oe_remove_suggested_group': "remove_suggested_group", 'click .oe_join_group': "join_group", 'click .oe_open_group': "open_group" @@ -73,9 +73,9 @@ openerp.mail.suggestions = function(session, mail) { removed_suggested_group.push($(event.currentTarget).attr('id')); self.get_suggested_group(); }, - remove_employee_suggestions: function(event) { + remove_suggestion_groups: function(event) { var self = this; - return this.res_users.call('stop_showing_group_suggestions', [this.session.uid]).then(function(res) { + return this.res_users.call('stop_showing_groups_suggestions', [this.session.uid]).then(function(res) { self.$(".oe_sidebar_group").hide(); }); } diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index 1ebd2f6276c..d90e6b12b03 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -9,7 +9,7 @@

Suggested Groups - + X

-- cgit v1.2.3 From b32cc3b4427c6d59581da13d039bde931ce82a5c Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 4 Apr 2013 12:37:23 +0530 Subject: [IMP] Improved code 1) Edit Subscriptions of -> Edit Subscription (without 's') of 2) Instead of defining a new 'apply_edited_subtype', you can use 'message_subscribe' that has an optional 'subtype_ids' parameter that already allows to manage subtypes of a subscription. 3) In _get_subscription_data: do not use context when it is not necessary. Please add a parameter user_id=None that will be used instead of uid to find user_pid. 4) Instead of defining a new 'on_apply_subtype', can't you reuse 'do_update_subscription' with maybe some update to handle the classic use / edit widget ? The above changes has been done. bzr revid: psa@tinyerp.com-20130404070723-5v1v35fte6vl2b2j --- addons/mail/static/src/js/mail_followers.js | 55 ++++++++++++----------------- 1 file changed, 22 insertions(+), 33 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 7e49a391bca..bc15eed3fd9 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -82,38 +82,20 @@ openerp_mail_followers = function(session, mail) { on_edit_subtype: function(event) { var self = this; var partner_id = $(event.target).data('id'); - var context = new session.web.CompoundContext(this.build_context(), {'partner_id': partner_id}); - self.$dialog = new session.web.dialog($('
'), { + self.$dialog = new session.web.dialog($('
'), { modal: true, width: 'auto', height: 'auto', - title: _t('Edit Subscriptions of ') + $(event.target).siblings('a').text(), + title: _t('Edit Subscription of ') + $(event.target).siblings('a').text(), buttons: [ { text: _t("Apply"), click: function() { - self.on_apply_subtype(partner_id); + self.do_update_subscription(event, partner_id); $(this).remove(); }}, { text: _t("Cancel"), click: function() { $(this).remove(); }} ], }); - return self.fetch_subtypes(context); - }, - - on_apply_subtype: function(partner_id) { - var check_list = new Array(); - var id = this.view.datarecord.id; - _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { - if ($(record).is(':checked')) { - check_list.push(parseInt($(record).data('id'))); - } - }); - - if (!check_list.length) { - this.do_unfollow(); - } else { - return this.ds_model.call('apply_edited_subtypes', [[id], partner_id, check_list, new session.web.CompoundContext(this.build_context(), {})]) - .then(this.proxy('read_value')); - } + return self.fetch_subtypes(partner_id); }, on_invite_follower: function (event) { @@ -251,17 +233,17 @@ openerp_mail_followers = function(session, mail) { }, /** Fetch subtypes, only if current user is follower */ - fetch_subtypes: function (context) { + fetch_subtypes: function (partner_id) { var self = this; var mode = ""; - if (context && context.eval('partner_id')) { + if (partner_id) { mode = "edit_follower"; } else { var subtype_list_ul = this.$('.oe_subtype_list').empty(); if (! this.message_is_follower) return; } var id = this.view.datarecord.id; - this.ds_model.call('message_get_subscription_data', [[id],context]) + this.ds_model.call('message_get_subscription_data', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})]) .then(function (data) {self.display_subtypes(data, id, mode);}); }, @@ -307,23 +289,30 @@ openerp_mail_followers = function(session, mail) { return false; }, - do_update_subscription: function (event) { + do_update_subscription: function (event, partner_id) { var self = this; var checklist = new Array(); - _(this.$('.oe_actions input[type="checkbox"]')).each(function (record) { - if ($(record).is(':checked')) { - checklist.push(parseInt($(record).data('id'))); - } - }); - + if (partner_id) { + _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { + if ($(record).is(':checked')) { + checklist.push(parseInt($(record).data('id'))); + } + }); + } else { + _(this.$('.oe_actions input[type="checkbox"]')).each(function (record) { + if ($(record).is(':checked')) { + checklist.push(parseInt($(record).data('id'))); + } + }); + } if (!checklist.length) { if (!this.do_unfollow()) { $(event.target).attr("checked", "checked"); } } else { var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], checklist, context]) + return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], partner_id, checklist, context]) .then(this.proxy('read_value')); } }, -- cgit v1.2.3 From 9a2a45c768b77fb829582f060221a90340445da1 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 4 Apr 2013 14:17:24 +0530 Subject: [IMP] Improved code and removed unwanted code. As suggested by tde in his comment >> **What's the purpose of defining a new 'check_access_right' ? Limiting to 'group_no_one' does not seems a viable solution. Instead, access rights on mail.followers entries should be correctly written (please check it is the case). I think having an asynchronous call just to check access rights is not necessary. In debug mode, always display the button.** bzr revid: psa@tinyerp.com-20130404084724-meqsx35jdvk56z2c --- addons/mail/static/src/js/mail_followers.js | 9 ++------- addons/mail/static/src/xml/mail_followers.xml | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index bc15eed3fd9..02cf01d9889 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -192,19 +192,14 @@ openerp_mail_followers = function(session, mail) { var self = this; this.followers = records || this.followers; this.message_is_follower = this.set_is_follower(this.followers); - this.check_access = false; - // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { - self.ds_model.call('check_access_right', [self.session.uid]).then(function(result){ - self.check_access = result; - record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); - $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); - }) + record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); + $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); }); // FVA note: be sure it is correctly translated if (truncated.length < this.followers.length) { diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 081111a9afd..960c399ecce 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -31,7 +31,7 @@
- + X
-- cgit v1.2.3 From e61d6bae165444015ef37f71ae1e3c13f42ec253 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 5 Apr 2013 19:14:25 +0530 Subject: [IMP] Improved code and passed user_id=None as optional field. bzr revid: psa@tinyerp.com-20130405134425-3xfbbv3vapq1un68 --- addons/mail/static/src/js/mail_followers.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 02cf01d9889..83b46f9f951 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -264,7 +264,7 @@ openerp_mail_followers = function(session, mail) { do_follow: function () { var context = new session.web.CompoundContext(this.build_context(), {}); - this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, context]) + this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, undefined, context]) .then(this.proxy('read_value')); _.each(this.$('.oe_subtype_list input'), function (record) { @@ -288,19 +288,15 @@ openerp_mail_followers = function(session, mail) { var self = this; var checklist = new Array(); - if (partner_id) { - _($('.oe_edit_actions input[type="checkbox"]')).each(function (record) { - if ($(record).is(':checked')) { - checklist.push(parseInt($(record).data('id'))); - } - }); - } else { - _(this.$('.oe_actions input[type="checkbox"]')).each(function (record) { - if ($(record).is(':checked')) { - checklist.push(parseInt($(record).data('id'))); - } - }); - } + var subtype_checkbox = _(this.$('.oe_actions input[type="checkbox"]')) + if (partner_id) { + subtype_checkbox = _($('.oe_edit_actions input[type="checkbox"]')) + } + subtype_checkbox.each(function (record) { + if ($(record).is(':checked')) { + checklist.push(parseInt($(record).data('id'))); + } + }); if (!checklist.length) { if (!this.do_unfollow()) { $(event.target).attr("checked", "checked"); -- cgit v1.2.3 From 1769067ddd9b4b7b51ae4c0d430587e1287af22d Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 9 Apr 2013 10:09:32 +0530 Subject: [IMP] Improved code and removed unwanted 'None'. bzr revid: psa@tinyerp.com-20130409043932-z5c8hupbhrednwa0 --- addons/mail/static/src/js/mail_followers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 83b46f9f951..93f8f995ec7 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -297,13 +297,14 @@ openerp_mail_followers = function(session, mail) { checklist.push(parseInt($(record).data('id'))); } }); + if (!checklist.length) { if (!this.do_unfollow()) { $(event.target).attr("checked", "checked"); } } else { var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], partner_id, checklist, context]) + return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], checklist, partner_id, context]) .then(this.proxy('read_value')); } }, -- cgit v1.2.3 From 5bbffbc39c899adb92d251a3c8ef7f06e39338a7 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 11 Apr 2013 18:05:37 +0530 Subject: [IMP] Improved code and made the EDIT followers visible when 'Technical Features' are given and it is in 'DEBUG mode'. bzr revid: psa@tinyerp.com-20130411123537-2wzb468o7o0dno8c --- addons/mail/static/src/js/mail_followers.js | 8 ++++++-- addons/mail/static/src/xml/mail_followers.xml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 93f8f995ec7..09f54f012ce 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -192,14 +192,18 @@ openerp_mail_followers = function(session, mail) { var self = this; this.followers = records || this.followers; this.message_is_follower = this.set_is_follower(this.followers); + this.check_access = false; // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { - record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); - $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); + self.ds_model.call('check_access_right', [self.session.uid]).then(function(result){ + self.check_access = result; + record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id); + $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); + }) }); // FVA note: be sure it is correctly translated if (truncated.length < this.followers.length) { diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 88f38146de3..ca0064cbc78 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -31,7 +31,7 @@
- + X
-- cgit v1.2.3 From c1a04891566456e18d869a9e0c55759f84d02d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 16 Apr 2013 15:44:05 +0200 Subject: [FIX] Chatter: fixed calls to refactored methos. bzr revid: tde@openerp.com-20130416134405-nxtwbvxbz77pxufx --- addons/mail/static/src/js/mail.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b1a579ba057..193fc25281f 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -620,10 +620,7 @@ openerp.mail = function (session) { // have unknown names -> call message_get_partner_info_from_emails to try to find partner_id var find_done = $.Deferred(); if (names_to_find.length > 0) { - var values = { - 'res_id': this.context.default_res_id, - } - find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [names_to_find], values); + find_done = self.parent_thread.ds_thread._model.call('message_partner_info_from_emails', [this.context.default_res_id, names_to_find]); } else { find_done.resolve([]); @@ -669,11 +666,7 @@ openerp.mail = function (session) { var new_names_to_find = _.difference(names_to_find, names_to_remove); find_done = $.Deferred(); if (new_names_to_find.length > 0) { - var values = { - 'link_mail': true, - 'res_id': self.context.default_res_id, - } - find_done = self.parent_thread.ds_thread._model.call('message_get_partner_info_from_emails', [new_names_to_find], values); + find_done = self.parent_thread.ds_thread._model.call('message_partner_info_from_emails', [self.context.default_res_id, new_names_to_find, true]); } else { find_done.resolve([]); -- cgit v1.2.3 From cbeb793c57b89b1d1d91b5f5d33912a0d966d825 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 17 Apr 2013 10:07:14 +0200 Subject: [IMP] remove manual subscription and better css bzr revid: mat@openerp.com-20130417080714-8taku42rc1eanz1q --- addons/mail/static/src/css/mail.css | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 9393337c15c..704ae4a3d83 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -679,12 +679,11 @@ /* ------------- WALL SIDEBAR ------------- */ .openerp .oe_mail_wall .oe_mail_wall_aside { - margin-left: 20px; - margin-top: 20px; + margin-top: 15px; position: relative; display: inline-block; vertical-align: top; - width: 300px; + width: 260px; } .openerp .oe_mail_wall_aside .oe_sidebar_suggestion { @@ -701,11 +700,11 @@ border-radius: 2px; width: 100%; margin-left: 10px; - min-height: 70px; /* image_small 66x66px */ + min-height: 67px; /* image_small 66x66px */ } .openerp .oe_mail_wall_aside .oe_item_image { float: left; - padding-right: 20px; + padding-right: 10px; } .openerp .oe_mail_wall_aside .oe_item_image_content { border-radius: 2px; @@ -716,10 +715,10 @@ } .openerp .oe_mail_wall_aside .oe_remove_suggested_item, .openerp .oe_mail_wall_aside .oe_remove_suggestion { - visibility:hidden; - width:3%; - float:right; - margin-right:20px; + visibility: hidden; + width: 3%; + float: right; + margin-right: 10px; } .openerp .oe_mail_wall_aside .oe_suggested_item:hover .oe_remove_suggested_item > span, .openerp .oe_mail_wall_aside .oe_suggestion_display:hover .oe_remove_suggestion > span { -- cgit v1.2.3 From 67bffc62c4d443b2b4315b10c1872d136e3a18ef Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 17 Apr 2013 17:17:21 +0200 Subject: [IMP] clean code bzr revid: mat@openerp.com-20130417151721-fmwd143gazkldvu3 --- addons/mail/static/src/xml/suggestions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/xml/suggestions.xml b/addons/mail/static/src/xml/suggestions.xml index d90e6b12b03..f868194ded6 100644 --- a/addons/mail/static/src/xml/suggestions.xml +++ b/addons/mail/static/src/xml/suggestions.xml @@ -2,7 +2,7 @@