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/js/mail_followers.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'addons/mail/static/src/js') 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 = { -- 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 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') 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 -- 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 +++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src/js') 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'); }); }, -- 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 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src/js') 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); }); }); -- 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 ++++++++++------------------- 1 file changed, 20 insertions(+), 42 deletions(-) (limited to 'addons/mail/static/src/js') 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'); }); }, -- 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/js') 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/js') 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 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') 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(), {})]) -- 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 ++++++++++++++--------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'addons/mail/static/src/js') 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(); -- 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 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') 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) { -- 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/js/mail_followers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') 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); }) -- 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/js') 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/js/mail.js | 3 +++ addons/mail/static/src/js/mail_followers.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') 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 -- 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 ++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 addons/mail/static/src/js/suggestions.js (limited to 'addons/mail/static/src/js') 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') ); + }); + + } + }); + +}; -- 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/js/suggestions.js | 50 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'addons/mail/static/src/js') 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') ); }); - + } }); -- 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/js/mail_followers.js | 2 ++ addons/mail/static/src/js/suggestions.js | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') 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() {}); }, -- 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/js/suggestions.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'addons/mail/static/src/js') 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(); + }); } }); -- 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 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/js') 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(); }); } -- 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/js') 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 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'addons/mail/static/src/js') 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) { -- 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/js') 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/js') 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 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') 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) { -- 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/js') 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 fe8cfcceba85ed63d21e861282958cb9f5027b15 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 18 Apr 2013 09:53:49 +0200 Subject: [IMP] use related field on author's image for mail messages bzr revid: mat@openerp.com-20130418075349-l71lf8kdw1er2tzs --- addons/mail/static/src/js/mail.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 55b8e4b4451..fe298b3ac65 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -257,15 +257,16 @@ openerp.mail = function (session) { /* Convert date, timerelative and avatar in displayable data. */ format_data: function () { + //formating and add some fields for render this.date = this.date ? session.web.str_to_datetime(this.date) : false; if (this.date && new Date().getTime()-this.date.getTime() < 7*24*60*60*1000) { this.timerelative = $.timeago(this.date); - } + } if (this.type == 'email' && (!this.author_id || !this.author_id[0])) { this.avatar = ('/mail/static/src/img/email_icon.png'); } else if (this.author_id && this.template != 'mail.compose_message') { - this.avatar = mail.ChatterUtils.get_image(this.session, 'res.partner', 'image_small', this.author_id[0]); + this.avatar = mail.ChatterUtils.get_image(this.session, 'mail.message', 'image_small', this.id); } else { this.avatar = mail.ChatterUtils.get_image(this.session, 'res.users', 'image_small', this.session.uid); } -- cgit v1.2.3 From a965a8b5b84bae83888d787726a032b7cfb3369e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 Apr 2013 09:34:38 +0200 Subject: [IMP] remove console.log bzr revid: mat@openerp.com-20130419073438-qud2vnbh6zx85dcl --- addons/mail/static/src/js/mail_followers.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index ea9cc0475b9..328f818ed74 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -28,9 +28,7 @@ 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'); -- cgit v1.2.3 From 85a807a5153d357e83a0f01d4940b5c6c2582403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 23 Apr 2013 17:36:45 +0200 Subject: [REF] Chatter: refactored system for read more / read less, now based on html_email_clean instead of the expander library. bzr revid: tde@openerp.com-20130423153645-k8vcb9hiuapzf7sg --- addons/mail/static/src/js/mail.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b1a579ba057..5ab6d2380a0 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -224,6 +224,7 @@ openerp.mail = function (session) { this.name = datasets.name || false, this.record_name = datasets.record_name || false, this.body = datasets.body || '', + this.body_short = datasets.body_short || '', this.vote_nb = datasets.vote_nb || 0, this.has_voted = datasets.has_voted || false, this.is_favorite = datasets.is_favorite || false, @@ -939,7 +940,6 @@ openerp.mail = function (session) { start: function () { this._super.apply(this, arguments); - this.expender(); this.bind_events(); if(this.thread_level < this.options.display_indented_thread) { this.create_thread(); @@ -962,6 +962,8 @@ openerp.mail = function (session) { this.$('.oe_reply').on('click', this.on_message_reply); this.$('.oe_star').on('click', this.on_star); this.$('.oe_msg_vote').on('click', this.on_vote); + this.$('.oe_mail_expand').on('click', this.on_expand); + this.$('.oe_mail_reduce').on('click', this.on_expand); }, /* Call the on_compose_message on the thread of this message. */ @@ -972,15 +974,9 @@ openerp.mail = function (session) { return false; }, - expender: function () { - this.$('.oe_msg_body:first').expander({ - slicePoint: this.options.truncate_limit, - expandText: 'read more', - userCollapseText: 'read less', - detailClass: 'oe_msg_tail', - moreClass: 'oe_mail_expand', - lessClass: 'oe_mail_reduce', - }); + on_expand: function (event) { + this.$('.oe_msg_body_short:first').toggle(); + this.$('.oe_msg_body_long:first').toggle(); }, /** -- cgit v1.2.3 From e0ea2dbdcb7af84f2f3bdab228bb4805ce9a56f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 25 Apr 2013 12:43:36 +0200 Subject: [IMP] Chatter: first message is truncated after 100 characters, other messages after 300 characters; cleaned code about expan management. bzr revid: tde@openerp.com-20130425104336-3xvdwgwanrutzinp --- addons/mail/static/src/js/mail.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 5ab6d2380a0..81a800b7357 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -975,8 +975,10 @@ openerp.mail = function (session) { }, on_expand: function (event) { + event.stopPropagation(); this.$('.oe_msg_body_short:first').toggle(); this.$('.oe_msg_body_long:first').toggle(); + return false; }, /** -- cgit v1.2.3 From 0525c965a9aa4f86d77c76ec272f864e3614ff51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 15 May 2013 12:35:18 +0200 Subject: [CLEAN] [REF] mail, hr: cleaned JS/CSS/XML code for suggestion widgets. Those are now 2 widgets extending web.Widget, included inside a Sidebar widget. bzr revid: tde@openerp.com-20130515103518-2djzogjdtjh0n7rl --- addons/mail/static/src/js/mail.js | 33 ++++++++-- addons/mail/static/src/js/suggestions.js | 110 ++++++++++++------------------- 2 files changed, 72 insertions(+), 71 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index fe298b3ac65..b8720e8f1c7 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -4,9 +4,8 @@ openerp.mail = function (session) { var mail = session.mail = {}; - openerp_mail_followers(session, mail); // import mail_followers.js - openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js - + openerp_mail_followers(session, mail); // import mail_followers.js + openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js /** * ------------------------------------------------------------ @@ -1818,6 +1817,19 @@ openerp.mail = function (session) { }); + /** + * ------------------------------------------------------------ + * Aside Widget + * ------------------------------------------------------------ + * + * This widget handles the display of a sidebar on the Wall. Its main use + * is to display group and employees suggestion (if hr is installed). + */ + mail.WallSidebar = session.web.Widget.extend({ + template: 'mail.wall.sidebar', + }); + + /** * ------------------------------------------------------------ * Wall Widget @@ -1871,6 +1883,9 @@ openerp.mail = function (session) { if (! this.searchview.has_defaults) { this.message_render(); } + // render sidebar + var wall_sidebar = new mail.WallSidebar(this); + wall_sidebar.appendTo(this.$el.find('.oe_mail_wall_aside')); }, /** @@ -2006,5 +2021,15 @@ openerp.mail = function (session) { }, }); - openerp.mail.suggestions(session, mail); + + /** + * ------------------------------------------------------------ + * Sub-widgets loading + * ------------------------------------------------------------ + * + * Load here widgets that could depend on widgets defined in mail.js + */ + + openerp.mail.suggestions(session, mail); // import suggestion.js (suggestion widget) + }; diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index 205f8b2f27d..4d0fcec32bf 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -3,99 +3,75 @@ openerp.mail.suggestions = function(session, mail) { var QWeb = session.web.qweb; var suggestions = session.suggestions = {}; + var removed_suggested_group = session.suggestions.removed_suggested_group = []; - 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({ events: { - '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" + 'click .oe_suggestion_remove.oe_suggestion_group': 'stop_group_suggestion', + 'click .oe_suggestion_remove_item.oe_suggestion_group': 'remove_group_suggestion', + 'click .oe_suggestion_join': 'join_group', }, - init: function (parent, action) { - var self = this; - this._super(parent, action); - this.deferred = $.Deferred(); + + init: function () { + this._super.apply(this, arguments); this.mail_group = new session.web.DataSetSearch(this, 'mail.group'); this.res_users = new session.web.DataSetSearch(this, 'res.users'); - this.suggestions = []; + this.groups = []; }, - start: function() { - var self = this; - var res = self.get_suggested_group(); - return $.when(res).done(function() {}); + + start: function () { + this._super.apply(this, arguments); + return this.fetch_suggested_groups(); }, - get_suggested_group: function () { + + fetch_suggested_groups: function () { var self = this; - var group = self.mail_group.call('get_suggested_thread', {'removed_suggested_threads':removed_suggested_group}).then(function(res) { - _(res).each(function(result) { + var group = self.mail_group.call('get_suggested_thread', {'removed_suggested_threads': removed_suggested_group}).then(function (res) { + _(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}) ); - if (self.suggestions.length === 0) { - self.$(".oe_sidebar_group").hide(); - } + self.groups = res; }); + return $.when(group).then(this.proxy('display_suggested_groups')); }, - open_group:function(event) { - var self = this; - 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); + + display_suggested_groups: function () { + var suggested_groups = this.$('.oe_sidebar_suggestion.oe_suggestion_group'); + if (suggested_groups) { + suggested_groups.empty(); + } + if (this.groups.length === 0) { + return this.$el.empty(); + } + return this.$el.empty().html(QWeb.render('mail.suggestions.groups', {'widget': this})); }, - join_group:function(event) { + + join_group: function (event) { var self = this; return this.mail_group.call('message_subscribe_users', [[$(event.currentTarget).attr('id')],[this.session.uid]]).then(function(res) { - self.get_suggested_group(); + self.fetch_suggested_groups(); }); }, - remove_suggested_group: function(event) { - var self = this; + + remove_group_suggestion: function (event) { removed_suggested_group.push($(event.currentTarget).attr('id')); - self.get_suggested_group(); + return this.fetch_suggested_groups(); }, - remove_suggestion_groups: function(event) { + + stop_group_suggestion: function (event) { var self = this; return this.res_users.call('stop_showing_groups_suggestions', [this.session.uid]).then(function(res) { - self.$(".oe_sidebar_group").hide(); + self.$(".oe_sidebar_suggestion.oe_suggestion_group").hide(); }); } }); - 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')); - - 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') ); - }); - - } + session.mail.WallSidebar.include({ + start: function () { + this._super.apply(this, arguments); + var sug_groups = new suggestions.Groups(this); + return sug_groups.appendTo(this.$('.oe_suggestions_groups')); + }, }); }; -- cgit v1.2.3 From 89896f32bbf6aeecfbddc0f7e8397781fce2a99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 15 May 2013 17:31:59 +0200 Subject: [IMP] [CLEAN] [REF] mail, res_partner, res_users, hr: cleaned partner / employee profile following last specifications. Partner profile is now classic, no more email-routing. Writing on res.users, basically, begins a private discussion. With HR, emails on res.users are private discussions, other are post on employee profile. Some cleaning in Chatter about Followers of ... , now talking about partner or employee profile. bzr revid: tde@openerp.com-20130515153159-cm52byvb7w6m1sxs --- addons/mail/static/src/js/mail.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b8720e8f1c7..3338954d417 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -236,8 +236,15 @@ openerp.mail = function (session) { this.format_data(); + // update record_name: Partner profile + if (this.model == 'res.partner') { + this.record_name = 'Partner Profile of ' + this.record_name; + } + else if (this.model == 'hr.employee') { + this.record_name = 'News from ' + this.record_name; + } // record options and data - this.show_record_name = this.options.show_record_name && this.record_name && !this.thread_level && this.model != 'res.partner'; + this.show_record_name = this.options.show_record_name && this.record_name && !this.thread_level; this.options.show_read = false; this.options.show_unread = false; if (this.options.show_read_unread_button) { -- cgit v1.2.3 From c61329943a702f88003bf4001806f3f23f744a89 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 27 May 2013 14:18:23 +0200 Subject: [IMP] mail: add breadcrumb from inbox bzr revid: chm@openerp.com-20130527121823-tfjevhu5zl5at4ar --- addons/mail/static/src/js/mail.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 21b0f5a9a87..5d54a6acc48 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -967,6 +967,24 @@ openerp.mail = function (session) { this.$('.oe_reply').on('click', this.on_message_reply); this.$('.oe_star').on('click', this.on_star); this.$('.oe_msg_vote').on('click', this.on_vote); + this.$('.oe_mail_action_model').on('click', this.on_record_clicked); + }, + + on_record_clicked: function (event) { + event.stopPropagation(); + var state = { + 'model': this.model, + 'id': this.res_id, + 'title': this.record_name + }; + session.webclient.action_manager.do_push_state(state); + this.do_action({ + res_model: state.model, + res_id: state.id, + type: 'ir.actions.act_window', + views: [[false, 'form']] + }); + return false; }, /* Call the on_compose_message on the thread of this message. */ -- cgit v1.2.3 From 133ad0b97c0029e5902a836d821112b4928c465c Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 30 May 2013 10:10:37 +0530 Subject: [IMP] Improved code for removing the div of dialog everytime when the dialog box is created. bzr revid: psa@tinyerp.com-20130530044037-02cw9gap03qhz087 --- addons/mail/static/src/js/mail_followers.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 7a4052e123b..d40f135d7db 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -82,6 +82,7 @@ openerp_mail_followers = function(session, mail) { on_edit_subtype: function(event) { var self = this; var partner_id = $(event.target).data('id'); + $('div.oe_edit_actions').remove(); self.$dialog = new session.web.dialog($('
'), { modal: true, width: 'auto', -- cgit v1.2.3 From 872a688fbe4fba647f51169f2d3fe7d8715974fd Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Mon, 3 Jun 2013 18:02:27 +0530 Subject: [IMP] Added code for the access right on specific model. bzr revid: psa@tinyerp.com-20130603123227-76kykft5jl3u5egl --- addons/mail/static/src/js/mail_followers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index d40f135d7db..c43b557e982 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -91,9 +91,9 @@ openerp_mail_followers = function(session, mail) { buttons: [ { text: _t("Apply"), click: function() { self.do_update_subscription(event, partner_id); - $(this).remove(); + $(this).dialog("close"); }}, - { text: _t("Cancel"), click: function() { $(this).remove(); }} + { text: _t("Cancel"), click: function() { $(this).dialog("close"); }} ], }); return self.fetch_subtypes(partner_id); @@ -291,6 +291,7 @@ openerp_mail_followers = function(session, mail) { var self = this; var checklist = new Array(); + this.ds_model.call('check_access_rights', ['write','read']) var subtype_checkbox = _(this.$('.oe_actions input[type="checkbox"]')) if (partner_id) { subtype_checkbox = _($('.oe_edit_actions input[type="checkbox"]')) -- cgit v1.2.3 From 388a3e14a15c9d18cc179cee0779a07e45424b82 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 4 Jun 2013 15:17:22 +0530 Subject: [ImP] method name change and removed the access call which is not needed bcz the system is calling it self. bzr revid: psa@tinyerp.com-20130604094722-2b8i6ba7blz1g2rc --- addons/mail/static/src/js/mail_followers.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index c43b557e982..74a59d5abba 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -198,7 +198,7 @@ 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(result){ + self.ds_model.call('check_technical_rights', [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); @@ -291,7 +291,6 @@ openerp_mail_followers = function(session, mail) { var self = this; var checklist = new Array(); - this.ds_model.call('check_access_rights', ['write','read']) var subtype_checkbox = _(this.$('.oe_actions input[type="checkbox"]')) if (partner_id) { subtype_checkbox = _($('.oe_edit_actions input[type="checkbox"]')) -- cgit v1.2.3 From 9fd2e7297ffb0fe9cb96767bcb8ad686a66d064b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 5 Jun 2013 12:13:00 +0200 Subject: [IMP] Chatter: better display of date bzr revid: tde@openerp.com-20130605101300-t1lwykg3d6lp7au2 --- addons/mail/static/src/js/mail.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 2cd9c7c077d..70e93e2957c 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -259,6 +259,7 @@ openerp.mail = function (session) { format_data: function () { //formating and add some fields for render this.date = this.date ? session.web.str_to_datetime(this.date) : false; + this.display_date = this.date.toString('ddd MMM dd yyyy HH:mm'); if (this.date && new Date().getTime()-this.date.getTime() < 7*24*60*60*1000) { this.timerelative = $.timeago(this.date); } -- cgit v1.2.3 From 52b02c879b0e2b23194f6c08fc30e38a22b42c4a Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 5 Jun 2013 18:40:31 +0530 Subject: [IMP] Improved code without disturbing the others methods and solved the issue of unfollowing the specific user by specific id. bzr revid: psa@tinyerp.com-20130605131031-bppkpzdwmi8sp4f7 --- addons/mail/static/src/js/mail_followers.js | 46 ++++++++++++++++++----------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 74a59d5abba..8b4f044740d 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -81,7 +81,7 @@ openerp_mail_followers = function(session, mail) { on_edit_subtype: function(event) { var self = this; - var partner_id = $(event.target).data('id'); + var user_pid = $(event.target).data('id'); $('div.oe_edit_actions').remove(); self.$dialog = new session.web.dialog($('
'), { modal: true, @@ -90,13 +90,13 @@ openerp_mail_followers = function(session, mail) { title: _t('Edit Subscription of ') + $(event.target).siblings('a').text(), buttons: [ { text: _t("Apply"), click: function() { - self.do_update_subscription(event, partner_id); + self.do_update_subscription(event, user_pid); $(this).dialog("close"); }}, { text: _t("Cancel"), click: function() { $(this).dialog("close"); }} ], }); - return self.fetch_subtypes(partner_id); + return self.fetch_subtypes(user_pid); }, on_invite_follower: function (event) { @@ -231,17 +231,17 @@ openerp_mail_followers = function(session, mail) { }, /** Fetch subtypes, only if current user is follower */ - fetch_subtypes: function (partner_id) { + fetch_subtypes: function (user_pid) { var self = this; var mode = ""; - if (partner_id) { + if (user_pid) { 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], partner_id, new session.web.CompoundContext(this.build_context(), {})]) + this.ds_model.call('message_get_subscription_data', [[id], user_pid, new session.web.CompoundContext(this.build_context(), {})]) .then(function (data) {self.display_subtypes(data, id, mode);}); }, @@ -267,7 +267,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, undefined, context]) + this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, context]) .then(this.proxy('read_value')); _.each(this.$('.oe_subtype_list input'), function (record) { @@ -275,39 +275,49 @@ openerp_mail_followers = function(session, mail) { }); }, - do_unfollow: function () { + do_unfollow: function (user_pid) { if (confirm(_t("Warning! \nYou won't be notified of any email or discussion on this document. Do you really want to unfollow this document ?"))) { _(this.$('.oe_msg_subtype_check')).each(function (record) { $(record).attr('checked',false); }); + var unsubscribe = 'message_unsubscribe_users'; + var follower_ids = [this.session.uid]; + if (user_pid) { + unsubscribe = 'message_unsubscribe'; + follower_ids = [user_pid]; + } var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]) - .then(this.proxy('read_value')); + return this.ds_model.call(unsubscribe, [[this.view.datarecord.id], follower_ids, context]) + .then(this.proxy('read_value')); } return false; }, - do_update_subscription: function (event, partner_id) { + do_update_subscription: function (event, user_pid) { var self = this; + var subscribe = 'message_subscribe_users'; + var follower_ids = [this.session.uid]; + var oe_action = this.$('.oe_actions input[type="checkbox"]'); + if (user_pid) { + subscribe = 'message_subscribe'; + follower_ids = [user_pid]; + oe_action = $('.oe_edit_actions input[type="checkbox"]'); + } var checklist = new Array(); - 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) { + _(oe_action).each(function (record) { if ($(record).is(':checked')) { checklist.push(parseInt($(record).data('id'))); } }); if (!checklist.length) { - if (!this.do_unfollow()) { + if (!this.do_unfollow(user_pid)) { $(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, partner_id, context]) + return this.ds_model.call(subscribe, [[this.view.datarecord.id], follower_ids, checklist, context]) .then(this.proxy('read_value')); } }, -- cgit v1.2.3 From da775672ea6742a40d5827a30e49761e05868f94 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 6 Jun 2013 11:18:17 +0530 Subject: [IMP] Improved code. bzr revid: psa@tinyerp.com-20130606054817-k3bbkb4j1u9rolpi --- addons/mail/static/src/js/mail_followers.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 8b4f044740d..6394ccf27c8 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -249,16 +249,13 @@ openerp_mail_followers = function(session, mail) { display_subtypes:function (data, id, mode) { var self = this; var $list = this.$('.oe_subtype_list'); - if (mode.length == 0){ $list.empty().hide();} + if (mode.length != 0){ $list = self.$dialog; } + $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; - 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); - } + $(session.web.qweb.render('mail.followers.subtype', {'record': record,'mode': mode})).appendTo( $list ); }); if (_.size(records) > 1) { $list.show(); -- cgit v1.2.3 From 52379022dbd3857fef51c6ce03b83c909707901c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 6 Jun 2013 18:18:37 +0200 Subject: [FIX] OPW 586673: mail: make `read more/less` labels translatable lp bug: https://launchpad.net/bugs/1165321 fixed bzr revid: odo@openerp.com-20130606161837-1loqbdr269cr1udl --- addons/mail/static/src/js/mail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 1e58dc47e22..2f6cfbdd708 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -975,8 +975,8 @@ openerp.mail = function (session) { expender: function () { this.$('.oe_msg_body:first').expander({ slicePoint: this.options.truncate_limit, - expandText: 'read more', - userCollapseText: 'read less', + expandText: _t('read more'), + userCollapseText: _t('read less'), detailClass: 'oe_msg_tail', moreClass: 'oe_mail_expand', lessClass: 'oe_mail_reduce', -- cgit v1.2.3 From b2ce2ae9bc4724a2bf5dba414d6e86c7042768d3 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 12 Jun 2013 10:56:45 +0530 Subject: [IMP] variable name improvements added action_ ahead of subscribe and unsubscribe to clearly understad the work of it. bzr revid: psa@tinyerp.com-20130612052645-x1wv4e1t2zyig4t2 --- addons/mail/static/src/js/mail_followers.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 2f010d6812b..faab16947d5 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -280,14 +280,14 @@ openerp_mail_followers = function(session, mail) { _(this.$('.oe_msg_subtype_check')).each(function (record) { $(record).attr('checked',false); }); - var unsubscribe = 'message_unsubscribe_users'; + var action_unsubscribe = 'message_unsubscribe_users'; var follower_ids = [this.session.uid]; if (user_pid) { - unsubscribe = 'message_unsubscribe'; + action_unsubscribe = 'message_unsubscribe'; follower_ids = [user_pid]; } var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call(unsubscribe, [[this.view.datarecord.id], follower_ids, context]) + return this.ds_model.call(action_unsubscribe, [[this.view.datarecord.id], follower_ids, context]) .then(this.proxy('read_value')); } return false; @@ -296,11 +296,11 @@ openerp_mail_followers = function(session, mail) { do_update_subscription: function (event, user_pid) { var self = this; - var subscribe = 'message_subscribe_users'; + var action_subscribe = 'message_subscribe_users'; var follower_ids = [this.session.uid]; var oe_action = this.$('.oe_actions input[type="checkbox"]'); if (user_pid) { - subscribe = 'message_subscribe'; + action_subscribe = 'message_subscribe'; follower_ids = [user_pid]; oe_action = $('.oe_edit_actions input[type="checkbox"]'); } @@ -317,7 +317,7 @@ openerp_mail_followers = function(session, mail) { } } else { var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call(subscribe, [[this.view.datarecord.id], follower_ids, checklist, context]) + return this.ds_model.call(action_subscribe, [[this.view.datarecord.id], follower_ids, checklist, context]) .then(this.proxy('read_value')); } }, -- cgit v1.2.3 From 7d2344bc36740a98708bb58abc4c404a41031481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 12 Jun 2013 11:59:44 +0200 Subject: [FIX] Chatter: fixed avatar management as this should be fixed in trunk bzr revid: tde@openerp.com-20130612095944-2aa2mezzbb47uk6g --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 230655cd364..0bc24ac4264 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -275,7 +275,7 @@ openerp.mail = function (session) { } else if (this.type == 'email' && (!this.author_id || !this.author_id[0])) { this.avatar = ('/mail/static/src/img/email_icon.png'); } else if (this.author_id && this.template != 'mail.compose_message') { - this.avatar = mail.ChatterUtils.get_image(this.session, 'mail.message', 'image_small', this.id); + this.avatar = mail.ChatterUtils.get_image(this.session, 'res.partner', 'image_small', this.author_id[0]); } else { this.avatar = mail.ChatterUtils.get_image(this.session, 'res.users', 'image_small', this.session.uid); } -- cgit v1.2.3 From 14f157e395304c288e116e1759fdaf74128d8877 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 12 Jun 2013 17:15:38 +0530 Subject: [IMP] When the subtypes are not displayed in subtype list below the follow button than the edit subtype pencil will also not displayed. bzr revid: psa@tinyerp.com-20130612114538-21ohwb0l50or62fe --- addons/mail/static/src/js/mail_followers.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index faab16947d5..6bcc0bb2a4e 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -252,6 +252,8 @@ openerp_mail_followers = function(session, mail) { if (mode.length != 0){ $list = self.$dialog; } $list.empty().hide(); var records = data[this.view.datarecord.id || this.view.dataset.ids[0]].message_subtype_data; + this.records_length = $.map(records, function(value, index) { return index; }).length; + if (this.records_length > 1) { self.display_followers(); } _(records).each(function (record, record_name) { record.name = record_name; record.followed = record.followed || undefined; -- cgit v1.2.3 From ae8302a3d6108d305c38190214b348a5e6715b7f Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 19 Jun 2013 19:18:17 +0530 Subject: [IMP] Now the edit_subtype pencil will be visible when the cursor goes on to the follower_list. And made the edit_subtype icon visible without debug mode. bzr revid: psa@tinyerp.com-20130619134817-n390r4dsgmpo33nb --- addons/mail/static/src/js/mail_followers.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 6bcc0bb2a4e..24dadec25ab 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -195,6 +195,15 @@ openerp_mail_followers = function(session, mail) { // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); + // On mouseenter it will show the edit_subtype penil + this.$el.on('mouseenter', 'div.oe_follower_list', function() { + $("img.oe_edit_subtype").removeClass("hidden"); + $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); + }).on('mouseleave', 'div.oe_follower_list', function(){ + $("img.oe_edit_subtype").addClass("hidden"); + $('div.oe_follower_list').find('.oe_partner').removeClass('oe_partner_name'); + }); + // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { -- cgit v1.2.3 From 4180da8a406acc8a55c329e6d90e4df377aba170 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 20 Jun 2013 10:30:26 +0530 Subject: [IMP] Improved code and removed unwanted code. bzr revid: psa@tinyerp.com-20130620050026-3kwfmowqfa9f4quz --- addons/mail/static/src/js/mail_followers.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 24dadec25ab..351031b9711 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -195,14 +195,6 @@ openerp_mail_followers = function(session, mail) { // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); - // On mouseenter it will show the edit_subtype penil - this.$el.on('mouseenter', 'div.oe_follower_list', function() { - $("img.oe_edit_subtype").removeClass("hidden"); - $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); - }).on('mouseleave', 'div.oe_follower_list', function(){ - $("img.oe_edit_subtype").addClass("hidden"); - $('div.oe_follower_list').find('.oe_partner').removeClass('oe_partner_name'); - }); // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); @@ -211,6 +203,16 @@ openerp_mail_followers = function(session, mail) { 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); + // On mouseenter it will show the edit_subtype penil + if (self.check_access == true) { + self.$el.on('mouseenter', 'div.oe_follower_list', function() { + $("img.oe_edit_subtype").removeClass("hidden"); + $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); + }).on('mouseleave', 'div.oe_follower_list', function(){ + $("img.oe_edit_subtype").addClass("hidden"); + $('div.oe_follower_list').find('.oe_partner').removeClass('oe_partner_name'); + }); + } }) }); // FVA note: be sure it is correctly translated @@ -271,9 +273,6 @@ openerp_mail_followers = function(session, mail) { if (_.size(records) > 1) { $list.show(); } - if (this.check_access && this.session.debug) { - $('div.oe_follower_list').find('.oe_partner').css('margin-right', '28px'); - } }, do_follow: function () { -- cgit v1.2.3 From cc05ab11dfd7e2070d2af9642808de34ec031add Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 26 Jun 2013 16:17:22 +0530 Subject: [IMP] Little Improvement. bzr revid: psa@tinyerp.com-20130626104722-jpzcu0gnbbggitv8 --- addons/mail/static/src/js/mail_followers.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index eafbb3ac4e1..b7862564732 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -74,6 +74,7 @@ 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); + // event: click on 'edit_subtype(pencil)' button to edit subscription 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) @@ -81,13 +82,14 @@ openerp_mail_followers = function(session, mail) { on_edit_subtype: function(event) { var self = this; - var user_pid = $(event.target).data('id'); + var $currentTarget = $(event.currentTarget); + var user_pid = $currentTarget.data('id'); $('div.oe_edit_actions').remove(); self.$dialog = new session.web.dialog($('
'), { modal: true, width: 'auto', height: 'auto', - title: _t('Edit Subscription of ') + $(event.target).siblings('a').text(), + title: _t('Edit Subscription of ') + $currentTarget.siblings('a').text(), buttons: [ { text: _t("Apply"), click: function() { self.do_update_subscription(event, user_pid); @@ -96,7 +98,7 @@ openerp_mail_followers = function(session, mail) { { text: _t("Cancel"), click: function() { $(this).dialog("close"); }} ], }); - return self.fetch_subtypes(user_pid); + return self.fetch_subtypes(user_pid); }, on_invite_follower: function (event) { -- cgit v1.2.3 From 39151ca2af306adb202394c54fffba26d2e53d40 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 28 Jun 2013 19:07:12 +0530 Subject: [IMP] Improved code for the followers which are visually duplicated when you click on a follower's name and get back to the sales order form. bzr revid: psa@tinyerp.com-20130628133712-tcfoaisr3o9wdv7x --- addons/mail/static/src/js/mail_followers.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index b7862564732..260ff6092ea 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -36,6 +36,7 @@ openerp_mail_followers = function(session, mail) { this.followers = []; this.view_is_editable = this.__parentedParent.is_action_enabled('edit'); + this.check_access = false; }, start: function() { @@ -45,6 +46,7 @@ openerp_mail_followers = function(session, mail) { this.reinit(); this.bind_events(); this._super(); + this.check_group_tech_feature(); }, on_check_visibility_mode: function () { @@ -188,33 +190,36 @@ openerp_mail_followers = function(session, mail) { this.$('.oe_follower_title').html(this._format_followers(this.value.length)); }, + check_group_tech_feature: function(){ + var self = this; + self.ds_model.call('check_technical_rights', [self.session.uid]).then(function(result){ + self.check_access = result; + }); + }, + /** Display the followers */ display_followers: function (records) { 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_technical_rights', [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); - // On mouseenter it will show the edit_subtype penil - if (self.check_access == true) { - self.$el.on('mouseenter', 'div.oe_follower_list', function() { - $("img.oe_edit_subtype").removeClass("hidden"); - $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); + 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); + // On mouseenter it will show the edit_subtype penil + if (self.check_access == true) { + self.$el.on('mouseenter', 'div.oe_follower_list', function() { + $("img.oe_edit_subtype").removeClass("hidden"); + $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); }).on('mouseleave', 'div.oe_follower_list', function(){ $("img.oe_edit_subtype").addClass("hidden"); $('div.oe_follower_list').find('.oe_partner').removeClass('oe_partner_name'); }); } - }) }); // FVA note: be sure it is correctly translated if (truncated.length < this.followers.length) { -- cgit v1.2.3 From 6694183dcb7b95947eea4931bc76cc3e2e1dcee8 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 12 Jul 2013 19:09:20 +0530 Subject: [IMP] Improved code and added {'is_editable': True/False, 'is_uid': True/False} -- where is_editable will be True if uid is in technical group -- where is_uid will be True if uid is in partner.user_ids. bzr revid: psa@tinyerp.com-20130712133920-96l6axns7yynyz9e --- addons/mail/static/src/js/mail_followers.js | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 260ff6092ea..99c2a629f5d 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -29,7 +29,6 @@ openerp_mail_followers = function(session, mail) { this.displayed_limit = this.node.attrs.displayed_nb || 10; this.displayed_nb = this.displayed_limit; 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.value = []; @@ -37,6 +36,7 @@ openerp_mail_followers = function(session, mail) { this.view_is_editable = this.__parentedParent.is_action_enabled('edit'); this.check_access = false; + this.is_follower = false; }, start: function() { @@ -46,7 +46,6 @@ openerp_mail_followers = function(session, mail) { this.reinit(); this.bind_events(); this._super(); - this.check_group_tech_feature(); }, on_check_visibility_mode: function () { @@ -154,11 +153,14 @@ openerp_mail_followers = function(session, mail) { }, fetch_followers: function (value_) { + var self = this; this.value = value_ || {}; - 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')); + return this.ds_model.call('read_followers_data', [this.value]).then(function(result) { + self.result = result; + self.display_followers(result), self.proxy('fetch_generic'); + self.display_buttons(); + self.fetch_subtypes(); + }); }, /** Read on res.partner failed: fall back on a generic case @@ -190,18 +192,16 @@ openerp_mail_followers = function(session, mail) { this.$('.oe_follower_title').html(this._format_followers(this.value.length)); }, - check_group_tech_feature: function(){ - var self = this; - self.ds_model.call('check_technical_rights', [self.session.uid]).then(function(result){ - self.check_access = result; - }); - }, - /** Display the followers */ display_followers: function (records) { var self = this; this.followers = records || this.followers; - this.message_is_follower = this.set_is_follower(this.followers); + _.each(this.result, function (record) { + if (self.session.uid == record.user_ids[0]) { + if (record.is_editable == true) { self.check_access = true; } + } + }); + this.message_is_follower = this.set_is_follower(this.followers); // self.is_follower // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); this.$('.oe_follower_title').html(this._format_followers(this.followers.length)); @@ -210,7 +210,7 @@ openerp_mail_followers = function(session, mail) { _(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); - // On mouseenter it will show the edit_subtype penil + // On mouse-enter it will show the edit_subtype pencil. if (self.check_access == true) { self.$el.on('mouseenter', 'div.oe_follower_list', function() { $("img.oe_edit_subtype").removeClass("hidden"); -- cgit v1.2.3 From 670710b88eb596ab9f6e8587de3d43ac133c0e18 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Mon, 15 Jul 2013 13:31:06 +0530 Subject: [IMP] Improved code and passed the data according to the format as suggest (partner_id, partner_name, {'is_editable': True/False, 'is_uid': True/False}) and done changes according this changes. bzr revid: psa@tinyerp.com-20130715080106-63dbeh3mhgiqppzv --- addons/mail/static/src/js/mail_followers.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 99c2a629f5d..4fec4ff3fd3 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -35,8 +35,6 @@ openerp_mail_followers = function(session, mail) { this.followers = []; this.view_is_editable = this.__parentedParent.is_action_enabled('edit'); - this.check_access = false; - this.is_follower = false; }, start: function() { @@ -196,22 +194,17 @@ openerp_mail_followers = function(session, mail) { display_followers: function (records) { var self = this; this.followers = records || this.followers; - _.each(this.result, function (record) { - if (self.session.uid == record.user_ids[0]) { - if (record.is_editable == true) { self.check_access = true; } - } - }); - this.message_is_follower = this.set_is_follower(this.followers); // self.is_follower // 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); + self.message_is_follower = record[2].is_uid; + record[2].avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record[0]); $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); // On mouse-enter it will show the edit_subtype pencil. - if (self.check_access == true) { + if (record[2].is_editable == true) { self.$el.on('mouseenter', 'div.oe_follower_list', function() { $("img.oe_edit_subtype").removeClass("hidden"); $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); @@ -227,12 +220,6 @@ openerp_mail_followers = function(session, mail) { } }, - /** Computes whether the current user is in the followers */ - set_is_follower: function (records) { - var user_ids = _.pluck(_.pluck(records, 'user_ids'), 0); - return _.indexOf(user_ids, this.session.uid) != -1; - }, - display_buttons: function () { if (this.message_is_follower) { this.$('button.oe_follower').removeClass('oe_notfollow').addClass('oe_following'); -- cgit v1.2.3 From 21e3d7cdc49fb2bf700ae8a0baa2d54cb39ac4c4 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Mon, 15 Jul 2013 14:19:07 +0530 Subject: [IMP] 2 little improvements when their is no subtype than no edit_subtype pencil will be visible and bydefault set the message_is_follower to false because when no followers are there than subtypes muzt not be visible. bzr revid: psa@tinyerp.com-20130715084907-nrd2oileuyr30nep --- addons/mail/static/src/js/mail_followers.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 4fec4ff3fd3..19b001f45a8 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -193,6 +193,7 @@ openerp_mail_followers = function(session, mail) { /** Display the followers */ display_followers: function (records) { var self = this; + this.message_is_follower = false; this.followers = records || this.followers; // clean and display title var node_user_list = this.$('.oe_follower_list').empty(); -- cgit v1.2.3 From 54837802acf9520e4971192f2a5eb3574bf89174 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Mon, 15 Jul 2013 17:07:36 +0530 Subject: Improved code. bzr revid: psa@tinyerp.com-20130715113736-ww4wffkajnwkk961 --- addons/mail/static/src/js/mail_followers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 19b001f45a8..528459fc058 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -201,7 +201,7 @@ 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.message_is_follower = record[2].is_uid; + if (record[2].is_uid == true) { self.message_is_follower = record[2].is_uid; } record[2].avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record[0]); $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); // On mouse-enter it will show the edit_subtype pencil. -- cgit v1.2.3 From 48dd55b1e8f5ef4708d161425b2648104c767ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 17 Jul 2013 10:59:25 +0200 Subject: [FIX] mail: fixed merge issue, forgottent conflict bzr revid: tde@openerp.com-20130717085925-l0u2nkvz91wm5kcy --- addons/mail/static/src/js/mail.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 7339ee6f452..456efa28425 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -967,10 +967,8 @@ openerp.mail = function (session) { this.$('.oe_reply').on('click', this.on_message_reply); this.$('.oe_star').on('click', this.on_star); this.$('.oe_msg_vote').on('click', this.on_vote); -<<<<<<< TREE this.$('.oe_mail_expand').on('click', this.on_expand); this.$('.oe_mail_reduce').on('click', this.on_expand); -======= this.$('.oe_mail_action_model').on('click', this.on_record_clicked); }, @@ -989,7 +987,6 @@ openerp.mail = function (session) { views: [[false, 'form']] }); return false; ->>>>>>> MERGE-SOURCE }, /* Call the on_compose_message on the thread of this message. */ -- cgit v1.2.3 From b7160bc1cf78636320f993e867ca7cf267600a72 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 17 Jul 2013 18:18:42 +0530 Subject: [IMP] Improved code for fetch_followers and done as was previously && added condition for the record in display_followers so that it never breaks && improve the mouse-enter and mouse-leave. bzr revid: psa@tinyerp.com-20130717124842-vuqct26jy6a7palb --- addons/mail/static/src/js/mail_followers.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 528459fc058..d40c000f53e 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -151,14 +151,11 @@ openerp_mail_followers = function(session, mail) { }, fetch_followers: function (value_) { - var self = this; this.value = value_ || {}; - return this.ds_model.call('read_followers_data', [this.value]).then(function(result) { - self.result = result; - self.display_followers(result), self.proxy('fetch_generic'); - self.display_buttons(); - self.fetch_subtypes(); - }); + return this.ds_model.call('read_followers_data', [this.value]) + .then(this.proxy('display_followers'), this.proxy('fetch_generic')) + .then(this.proxy('display_buttons')) + .then(this.proxy('fetch_subtypes')); }, /** Read on res.partner failed: fall back on a generic case @@ -201,19 +198,17 @@ openerp_mail_followers = function(session, mail) { // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { + if (record.length < 3) { return; } if (record[2].is_uid == true) { self.message_is_follower = record[2].is_uid; } record[2].avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record[0]); $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); // On mouse-enter it will show the edit_subtype pencil. if (record[2].is_editable == true) { - self.$el.on('mouseenter', 'div.oe_follower_list', function() { - $("img.oe_edit_subtype").removeClass("hidden"); - $('div.oe_follower_list').find('.oe_partner').addClass('oe_partner_name'); - }).on('mouseleave', 'div.oe_follower_list', function(){ - $("img.oe_edit_subtype").addClass("hidden"); - $('div.oe_follower_list').find('.oe_partner').removeClass('oe_partner_name'); - }); - } + self.$el.find('div.oe_follower_list').on('mouseenter mouseleave', function(e) { + self.$el.find('img.oe_edit_subtype').toggleClass('hidden', e.type == 'mouseleave'); + self.$el.find('div.oe_follower_list').find('.oe_partner').toggleClass('oe_partner_name', e.type == 'mouseenter'); + }); + } }); // FVA note: be sure it is correctly translated if (truncated.length < this.followers.length) { -- cgit v1.2.3 From 68d1c2928fc1d0307726ed4d32555d68c4f330c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 23 Jul 2013 11:55:09 +0200 Subject: [CLEAN] Cleaning befor merging No need to use an image for edition -> use webtypo font instead Small code cleaning in js / python bzr revid: tde@openerp.com-20130723095509-knp45uvmlfmr27v9 --- addons/mail/static/src/js/mail_followers.js | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index d40c000f53e..a0dad1fcdbc 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -169,6 +169,7 @@ openerp_mail_followers = function(session, mail) { self.message_is_follower = (_.indexOf(self.value, pid) != -1); }).then(self.proxy('display_generic')); }, + _format_followers: function(count){ var str = ''; if(count <= 0){ @@ -180,6 +181,7 @@ openerp_mail_followers = function(session, mail) { } return str; }, + /* Display generic info about follower, for people not having access to res_partner */ display_generic: function () { var self = this; @@ -198,15 +200,22 @@ openerp_mail_followers = function(session, mail) { // truncate number of displayed followers var truncated = this.followers.slice(0, this.displayed_nb); _(truncated).each(function (record) { - if (record.length < 3) { return; } - if (record[2].is_uid == true) { self.message_is_follower = record[2].is_uid; } - record[2].avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record[0]); - $(session.web.qweb.render('mail.followers.partner', {'record': record, 'widget': self})).appendTo(node_user_list); + partner = { + 'id': record[0], + 'name': record[1], + 'is_uid': record[2]['is_uid'], + 'is_editable': record[2]['is_editable'], + 'avatar_url': mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record[0]), + } + if (partner.is_uid) { + self.message_is_follower = partner.is_uid; + } + $(session.web.qweb.render('mail.followers.partner', {'record': partner, 'widget': self})).appendTo(node_user_list); // On mouse-enter it will show the edit_subtype pencil. - if (record[2].is_editable == true) { - self.$el.find('div.oe_follower_list').on('mouseenter mouseleave', function(e) { - self.$el.find('img.oe_edit_subtype').toggleClass('hidden', e.type == 'mouseleave'); - self.$el.find('div.oe_follower_list').find('.oe_partner').toggleClass('oe_partner_name', e.type == 'mouseenter'); + if (partner.is_editable) { + self.$('.oe_follower_list').on('mouseenter mouseleave', function(e) { + self.$('.oe_edit_subtype').toggleClass('oe_hidden', e.type == 'mouseleave'); + self.$('.oe_follower_list').find('.oe_partner').toggleClass('oe_partner_name', e.type == 'mouseenter'); }); } }); @@ -233,23 +242,27 @@ openerp_mail_followers = function(session, mail) { /** Fetch subtypes, only if current user is follower */ fetch_subtypes: function (user_pid) { var self = this; - var mode = ""; + var dialog = false; if (user_pid) { - mode = "edit_follower"; + dialog = true; } 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], user_pid, new session.web.CompoundContext(this.build_context(), {})]) - .then(function (data) {self.display_subtypes(data, id, mode);}); + .then(function (data) {self.display_subtypes(data, id, dialog);}); }, /** Display subtypes: {'name': default, followed} */ - display_subtypes:function (data, id, mode) { + display_subtypes:function (data, id, dialog) { var self = this; - var $list = this.$('.oe_subtype_list'); - if (mode.length != 0){ $list = self.$dialog; } + if (dialog) { + var $list = self.$dialog; + } + else { + var $list = this.$('.oe_subtype_list'); + } $list.empty().hide(); var records = data[this.view.datarecord.id || this.view.dataset.ids[0]].message_subtype_data; this.records_length = $.map(records, function(value, index) { return index; }).length; @@ -257,7 +270,7 @@ openerp_mail_followers = function(session, mail) { _(records).each(function (record, record_name) { record.name = record_name; record.followed = record.followed || undefined; - $(session.web.qweb.render('mail.followers.subtype', {'record': record,'mode': mode})).appendTo( $list ); + $(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo($list); }); if (_.size(records) > 1) { $list.show(); -- cgit v1.2.3 From ea92a186f5272c252b3645d0fc52ff1e275188d1 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 26 Jul 2013 14:19:38 +0200 Subject: [FIX] mail: minor potential problem with JavaScript module loading bzr revid: nicolas.vanhoren@openerp.com-20130726121938-b2uapok2dup56ol9 --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src/js') diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 5d54a6acc48..d0af3127404 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -2,7 +2,7 @@ openerp.mail = function (session) { var _t = session.web._t, _lt = session.web._lt; - var mail = session.mail = {}; + var mail = session.mail; openerp_mail_followers(session, mail); // import mail_followers.js openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js -- cgit v1.2.3