diff options
| author | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-11-29 14:04:33 +0100 |
|---|---|---|
| committer | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-11-29 14:04:33 +0100 |
| commit | d760fe7f99746125e48eccce500fe4c835a85f1d (patch) | |
| tree | 2f083a9e411d7913a9d16f12db7cbc89e6f7d3bd /addons/mail/static/src | |
| parent | b6997b7c74c4c90070439515bbbb666cda94988c (diff) | |
| parent | 93eddbd4a8e60522c209761da08b7b4d200e7f00 (diff) | |
[MERGE] trunk
bzr revid: qdp-launchpad@openerp.com-20121129130433-wbcix78s6tdwc3r0
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 34 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 48 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 34 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail_followers.xml | 2 |
4 files changed, 73 insertions, 45 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 94a5c2d1f41..638d016921b 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -48,7 +48,7 @@ .openerp .oe_mail .oe_msg{ position: relative; - background: #F4F5FA; + background: #EDEDF6; border-radius: 2px; margin-bottom: 2px; min-height: 42px; @@ -70,7 +70,7 @@ margin-left: 40px; } .openerp .oe_mail .oe_msg .oe_msg_footer{ - padding-left: 4px; + margin-left: 4px; padding-top: 3px; overflow: hidden; margin-bottom: 4px; @@ -94,6 +94,10 @@ .openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body p { margin-bottom: 0px; } +.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body * { + text-overflow:ellipsis; + word-wrap: break-word; +} /* a) Indented Messages */ @@ -380,6 +384,10 @@ line-height: 12px; vertical-align: middle; } +.openerp .oe_mail .oe_msg_footer button.oe_post{ + position: relative; + z-index: 2; +} .openerp .oe_mail .oe_msg_footer button.oe_attach{ width: 24px; overflow: hidden; @@ -387,8 +395,9 @@ } .openerp .oe_mail .oe_msg_footer button.oe_attach .oe_e{ position: relative; - top: -1px; - left: -9px; + top: -4px; + margin-left: -9px; + vertical-align: middle; filter:none; } .openerp .oe_mail .oe_hidden_input_file, .openerp .oe_mail .oe_hidden_input_file form{ @@ -402,8 +411,9 @@ } .openerp .oe_mail .oe_msg_footer button.oe_full .oe_e{ position: relative; - top: -1px; - left: -9px; + top: -4px; + margin-left: -9px; + vertical-align: middle; filter:none; } .openerp .oe_mail button.oe_attach, .openerp .oe_mail button.oe_full{ @@ -418,13 +428,17 @@ color: #7C7BAD; margin-left: -3px; } +.openerp .oe_mail .oe_msg_footer .oe_attachment_file{ + cursor: pointer; +} .openerp .oe_mail .oe_msg_footer .oe_attachment_file .oe_form_binary_file{ display: inline-block; - margin-left: -47px; - height: 28px; - width: 52px; - margin-top: -6px; + margin-left: -122px; + height: 22px; + width: 128px; + margin-top: -4px; filter:none; + cursor: pointer; } .openerp .oe_mail .oe_mail_list_recipients{ font-size: 12px; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 44bb4e9ae09..a5beaac229f 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -204,7 +204,7 @@ openerp.mail = function (session) { this.subject = datasets.subject || false, this.name = datasets.name || false, this.record_name = datasets.record_name || false, - this.body = datasets.body || false, + this.body = datasets.body || '', this.vote_nb = datasets.vote_nb || 0, this.has_voted = datasets.has_voted || false, this.is_favorite = datasets.is_favorite || false, @@ -508,7 +508,6 @@ openerp.mail = function (session) { res_model: 'mail.compose.message', view_mode: 'form', view_type: 'form', - action_from: 'mail.ThreadComposeMessage', views: [[false, 'form']], target: 'new', context: context, @@ -574,12 +573,7 @@ openerp.mail = function (session) { var message = thread.create_message_object( data[0] ); // insert the message on dom thread.insert_message( message, root ? undefined : self.$el, root ); - if (thread.parent_message) { - self.$el.remove(); - self.parent_thread.compose_message = null; - } else { - self.on_cancel(); - } + self.on_cancel(); }); //session.web.unblockUI(); }); @@ -591,11 +585,11 @@ openerp.mail = function (session) { */ on_compose_expandable: function (event) { - if (!this.stay_open && (!this.show_composer || !this.$('textarea:not(.oe_compact)').val().match(/\S+/))) { + if ((!this.stay_open || (event && event.type == 'click')) && (!this.show_composer || !this.$('textarea:not(.oe_compact)').val().match(/\S+/))) { this.show_composer = !this.show_composer || this.stay_open; this.reinit(); } - if (!this.stay_open && this.show_composer) { + if (!this.stay_open && this.show_composer && (!event || event.type != 'blur')) { this.$('textarea:not(.oe_compact):first').focus(); } return true; @@ -725,7 +719,7 @@ openerp.mail = function (session) { on_message_reply:function (event) { event.stopPropagation(); this.create_thread(); - this.thread.on_compose_message(); + this.thread.on_compose_message(event); return false; }, @@ -833,9 +827,10 @@ openerp.mail = function (session) { return false; }, - /*The selected thread and all childs (messages/thread) became read - * @param {object} mouse envent - */ + /* Set the selected thread and all childs as read or unread, based on + * read parameter. + * @param {boolean} read_value + */ on_message_read_unread: function (read_value) { var self = this; var messages = [this].concat(this.get_childs()); @@ -958,7 +953,7 @@ openerp.mail = function (session) { this.options = options.options; this.options.root_thread = (options.options.root_thread != undefined ? options.options.root_thread : this); - this.options.show_compose_message = this.options.show_compose_message && (this.options.display_indented_thread >= this.thread_level || !this.thread_level); + this.options.show_compose_message = this.options.show_compose_message && !this.thread_level; // record options and data this.parent_message= parent.thread!= undefined ? parent : false ; @@ -995,7 +990,7 @@ openerp.mail = function (session) { // add message composition form view if (!this.compose_message) { this.compose_message = new mail.ThreadComposeMessage(this, this, { - 'context': this.context, + 'context': this.options.compose_as_todo && !this.thread_level ? _.extend(this.context, { 'default_favorite_user_ids': [this.session.uid] }) : this.context, 'options': this.options, }); if (!this.thread_level || this.thread_level > this.options.display_indented_thread) { @@ -1136,9 +1131,9 @@ openerp.mail = function (session) { * Call the on_compose_expandable method to allow the user to write his message. * (Is call when a user click on "Reply" button) */ - on_compose_message: function () { + on_compose_message: function (event) { this.instantiate_compose_message(); - this.compose_message.on_compose_expandable(); + this.compose_message.on_compose_expandable(event); return false; }, @@ -1241,6 +1236,7 @@ openerp.mail = function (session) { } else { message.appendTo(self.$el); } + message.$el.hide().fadeIn(500); return message }, @@ -1262,6 +1258,9 @@ openerp.mail = function (session) { // insert the message on dom thread.insert_message( message, typeof dom_insert_after == 'object' ? dom_insert_after : false); }); + if (!records.length && this.options.root_thread == this) { + this.no_message(); + } }, /** @@ -1291,8 +1290,10 @@ openerp.mail = function (session) { var messages = _.sortBy( this.messages, function (val) { return val.id; }); var it = _.indexOf( messages, message ); - var msg_up = messages[it-1]; - var msg_down = messages[it+1]; + var msg_up = message.$el.prev('.oe_msg'); + var msg_down = message.$el.next('.oe_msg'); + var msg_up = msg_up.hasClass('oe_msg_expandable') ? _.find( this.messages, function (val) { return val.$el[0] == msg_up[0]; }) : false; + var msg_down = msg_down.hasClass('oe_msg_expandable') ? _.find( this.messages, function (val) { return val.$el[0] == msg_down[0]; }) : false; var message_dom = [ ["id", "=", message.id] ]; @@ -1397,6 +1398,8 @@ openerp.mail = function (session) { *... @param {Array} [message_ids] List of ids to fetch by the root thread. * When you use this option, the domain is not used for the fetch root. * @param {String} [no_message] Message to display when there are no message + * @param {Boolean} [show_link_partner] Display partner (authors, followers...) on link or not + * @param {Boolean} [compose_as_todo] The root composer mark automatically the message as todo */ init: function (parent, action) { this._super(parent, action); @@ -1414,8 +1417,10 @@ openerp.mail = function (session) { 'show_compose_message' : false, 'show_compact_message' : false, 'compose_placeholder': false, + 'show_link_partner': true, 'view_inbox': false, 'message_ids': undefined, + 'compose_as_todo' : false, }, this.action.params); this.action.params.help = this.action.help || false; @@ -1441,7 +1446,6 @@ openerp.mail = function (session) { }); this.thread.appendTo( this.$el ); - this.thread.no_message(); if (this.action.params.show_compose_message) { this.thread.instantiate_compose_message(); @@ -1632,7 +1636,7 @@ openerp.mail = function (session) { */ do_searchview_search: function (domains, contexts, groupbys) { var self = this; - this.rpc('/web/session/eval_domain_and_context', { + session.web.pyeval.eval_domains_and_contexts({ domains: domains || [], contexts: contexts || [], group_by_seq: groupbys || [] diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index bb787c9a21b..cca908a5d98 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -34,14 +34,14 @@ <button class="oe_post">Post</button> <t t-call="mail.compose_message.add_attachment"/> <!--<a class="oe_cancel oe_e">X</a>--> - <button class="oe_full"><span class='oe_e'>&ograve</span></button> + <button class="oe_full" title="Open the full mail composer"><span class='oe_e'>&ograve</span></button> </div> </div> </div> <div t-if="widget.show_compact_message and !widget.show_composer" t-attf-class="oe_msg oe_msg_composer_compact #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}"> <textarea t-if="widget.options.compose_placeholder" class="field_text oe_compact" t-att-placeholder="widget.options.compose_placeholder"/> - <textarea t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox" class="field_text oe_compact" placeholder="Write an internal note..."/> - <textarea t-if="!widget.options.compose_placeholder and widget.options.view_mailbox" class="field_text oe_compact" placeholder="Share to my followers..."/> + <textarea t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox" class="field_text oe_compact" placeholder="Write to the followers of this document..."/> + <textarea t-if="!widget.options.compose_placeholder and widget.options.view_mailbox" class="field_text oe_compact" placeholder="Share with my followers..."/> </div> <span t-if="!(widget.show_compact_message and !widget.show_composer) and !widget.show_composer" class="oe_placeholder_compose"></span> </t> @@ -75,9 +75,11 @@ <t t-foreach='widget.attachment_ids' t-as='attachment'> <t t-if="attachment.filetype !== 'webimage'"> <div t-attf-class="oe_attachment #{attachment.upload ? 'oe_uploading' : ''}"> - <a t-att-href='attachment.url'><img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.filetype + '.png'"></img></a> + <a t-att-href='attachment.url'> + <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.filetype + '.png'"></img> + <div class='oe_name'><t t-raw='attachment.name' /></div> + </a> <div class='oe_delete oe_e' title="Delete this attachment" t-attf-data-id="{attachment.id}">[</div> - <div class='oe_name'><t t-raw='attachment.name' /></div> <div class='oe_progress_bar'> uploading </div> @@ -85,9 +87,11 @@ </t> <t t-if="attachment.filetype === 'webimage'"> <div t-attf-class="oe_attachment oe_preview #{attachment.upload ? 'oe_uploading' : ''}"> - <a t-att-href='attachment.url'><img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img></a> + <a t-att-href='attachment.url'> + <img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img> + <div class='oe_name'><t t-raw='attachment.name' /></div> + </a> <div class='oe_delete oe_e'>[</div> - <div class='oe_name'><t t-raw='attachment.name' /></div> <div class='oe_progress_bar'> uploading </div> @@ -111,7 +115,11 @@ </t> <t t-if="!widget.is_private and widget.partner_ids.length"> and </t> <t t-set="inc" t-value="0"/> - <t t-if="widget.partner_ids.length" t-foreach="widget.partner_ids" t-as="partner"><span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/><a t-attf-href="#model=res.partner&id=#{partner[0]}"><t t-raw="partner[1]"/></a></span><t t-set="inc" t-value="inc+1"/> + <t t-if="widget.partner_ids.length" t-foreach="widget.partner_ids" t-as="partner"> + <span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/> + <a t-if="widget.options.show_link_partner" t-attf-href="#model=res.partner&id=#{partner[0]}"><t t-raw="partner[1]"/></a> + <t t-if="!widget.options.show_link_partner" t-raw="partner[1]"/> + </span><t t-set="inc" t-value="inc+1"/> </t> <t t-if="widget.partner_ids.length>=3"> <span class="oe_more">, <a><t t-raw="widget.partner_ids.length-3"/> others...</a></span> @@ -148,7 +156,7 @@ </td> <td><div class="oe_view_manager_view_search" t-opentag="true"/></td> </tr> - <tr class="oe_header_row" t-if="widget.action.params.view_inbox" > + <tr class="oe_header_row" t-if="widget.action.params.view_inbox and widget.action.params.show_compose_message" > <td colspan="2"> <button type="button" class="oe_write_full oe_highlight"> Compose a new message @@ -190,14 +198,15 @@ <div t-attf-class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} oe_msg_#{widget.type}"> <div class='oe_msg_left'> - <a t-attf-href="#model=res.partner&id=#{widget.author_id[0]}" t-att-title="widget.author_id[1]"> + <a t-if="widget.options.show_link_partner" t-attf-href="#model=res.partner&id=#{widget.author_id[0]}" t-att-title="widget.author_id[1]"> <img class="oe_msg_icon" t-att-src="widget.avatar"/> </a> + <img t-if="!widget.options.show_link_partner" class="oe_msg_icon" t-att-src="widget.avatar"/> </div> <div class="oe_msg_center"> <div class='oe_msg_icons'> - <span class='oe_read' t-if="widget.options.show_read"><a title="Done" class="oe_e">X</a></span> + <span class='oe_read' t-if="widget.options.show_read"><a title="Done" class="oe_e">W</a></span> <span class='oe_unread' t-if="widget.is_favorite and widget.options.show_unread"><a title="Set back to Todo" class="oe_e">v</a></span> <span class='oe_unread' t-if="!widget.is_favorite and widget.options.show_unread"><a title="Set back to Inbox" class="oe_e">v</a></span> <span class='oe_reply' t-if="widget.options.show_reply_button"><a title="Reply" class="oe_e">(</a></span> @@ -217,7 +226,8 @@ <t t-if="widget.attachment_ids.length > 0"> <div class="oe_msg_attachment_list"></div> </t> - <a t-if="widget.author_id" t-attf-href="#model=res.partner&id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a> + <a t-if="widget.author_id and widget.options.show_link_partner" t-attf-href="#model=res.partner&id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a> + <span t-if="widget.author_id and !widget.options.show_link_partner"><t t-raw="widget.author_id[1]"/></span> <span class='oe_subtle'>•</span> <span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span> <span class='oe_subtle'>•</span> diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 3dec4ef1dd2..11698c1fb62 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -5,7 +5,7 @@ followers main template Template used to display the followers, the actions and the subtypes in a record. --> - <div t-name="mail.followers" class="oe_followers"> + <div t-name="mail.followers" class="oe_followers"> <div class="oe_actions"> <button type="button" class="oe_follower oe_notfollow"> <span class="oe_follow">Follow</span> |
