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/mail.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 +++ 1 file changed, 3 insertions(+) (limited to 'addons/mail/static/src/js/mail.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); }; -- 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/mail.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/mail.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 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/mail.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/mail.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 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'addons/mail/static/src/js/mail.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) + }; -- 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/mail.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 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/mail.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 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/mail.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 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/mail.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 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/mail.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 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/mail.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 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/mail.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