diff options
| author | Foram Katharotiya (OpenERP) <fka@tinyerp.com> | 2012-11-22 10:52:13 +0530 |
|---|---|---|
| committer | Foram Katharotiya (OpenERP) <fka@tinyerp.com> | 2012-11-22 10:52:13 +0530 |
| commit | e4b6bb0fedcc9ae7db174b14642d79ebea70090b (patch) | |
| tree | 979973db34ad28872d62ae389d433cd072418a52 /addons/mail/static/src | |
| parent | 417b291dbb6dafdb3866760220d78e8dcf1a1ea2 (diff) | |
| parent | c0df907c29d37cef45b9955190c5ac8bcb5f9c2f (diff) | |
[MERGE] with trunk
bzr revid: fka@tinyerp.com-20121122052213-78oowcxyorcgalyi
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 18 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 99 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail_followers.js | 13 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 38 |
4 files changed, 75 insertions, 93 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index b0ce6d499b5..94a5c2d1f41 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -220,9 +220,8 @@ /* --------------------- ATTACHMENTS --------------------- */ .openerp .oe_mail .oe_msg_attachment_list{ - display: none; - margin-top: 12px; - margin-bottom: 12px; + margin-top: 4px; + margin-bottom: 4px; } .openerp .oe_mail .oe_msg_composer .oe_msg_attachment_list{ display: block; @@ -230,7 +229,7 @@ .openerp .oe_mail .oe_attachment{ display: inline-block; width: 100px; - margin: 2px; + margin: 4px 2px; min-height: 80px; position: relative; border-radius: 3px; @@ -243,7 +242,7 @@ padding: 1px 3px; margin-top: 50px; margin-bottom: 5px; - background: rgba(124, 123, 173, 0.13); + background: #F4F5FA; overflow: hidden; color: #4c4c4c; text-shadow: none; @@ -299,12 +298,13 @@ .openerp .oe_mail .oe_attachment.oe_preview .oe_name{ position: absolute; bottom: 0px; - margin: 0px; + margin: 3px; left: 0px; right: 0px; max-height: 64px; background: rgba(0,0,0,0.8); color: white; + border-radius: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; opacity: 0; @@ -333,9 +333,11 @@ position: relative; margin:0px; width: 100px; - height: 100px; - border-radius: 3px; + height: 80px; + border-radius: 1px; + border: solid 3px #FFF; margin-left: -50px; + box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.19); } .openerp .oe_mail .oe_attachment .oe_delete{ display: none; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index dc265a343d5..44bb4e9ae09 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -9,39 +9,6 @@ openerp.mail = function (session) { /** * ------------------------------------------------------------ - * FormView - * ------------------------------------------------------------ - * - * Override of formview do_action method, to catch all return action about - * mail.compose.message. The purpose is to bind 'Send by e-mail' buttons. - */ - - session.web.FormView = session.web.FormView.extend({ - do_action: function (action) { - if (action.res_model == 'mail.compose.message') { - /* hack for stop context propagation of wrong value - * delete this hack when a global method to clean context is create - */ - var context_keys = ['default_template_id', 'default_composition_mode', - 'default_use_template', 'default_partner_ids', 'default_model', - 'default_res_id', 'default_content_subtype', 'default_subject', - 'default_body', 'active_id', 'lang', 'bin_raw', 'tz', - 'active_model', 'edi_web_url_view', 'active_ids', - 'default_attachment_ids'] - for (var key in action.context) { - if (_.indexOf(context_keys, key) == -1) { - action.context[key] = null; - } - } - /* end hack */ - } - return this._super.apply(this, arguments); - }, - }); - - - /** - * ------------------------------------------------------------ * ChatterUtils * ------------------------------------------------------------ * @@ -251,7 +218,7 @@ openerp.mail = function (session) { this.format_data(); // record options and data - this.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.model != 'res.partner'; this.options.show_read = false; this.options.show_unread = false; if (this.options.show_read_unread_button) { @@ -591,17 +558,17 @@ openerp.mail = function (session) { //session.web.blockUI(); this.parent_thread.ds_thread.call('message_post_user_api', [ this.context.default_res_id, - mail.ChatterUtils.get_text2html(body), + body, false, this.context.default_parent_id, attachments, this.parent_thread.context ]).done(function (record) { var thread = self.parent_thread; + var root = thread == self.options.root_thread; if (self.options.display_indented_thread < self.thread_level && thread.parent_message) { var thread = thread.parent_message.parent_thread; } - var root = thread == self.options.root_thread; // create object and attach to the thread object thread.message_fetch([['id', 'child_of', [self.id]]], false, [record], function (arg, data) { var message = thread.create_message_object( data[0] ); @@ -734,7 +701,7 @@ openerp.mail = function (session) { if(this.thread_level < this.options.display_indented_thread) { this.create_thread(); } - this.$('.oe_msg_attachments, .oe_msg_images').addClass("oe_hidden"); + this.display_attachments(); this.ds_notification = new session.web.DataSetSearch(this, 'mail.notification'); this.ds_message = new session.web.DataSetSearch(this, 'mail.message'); @@ -752,8 +719,6 @@ 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_view_attachments').on('click', this.on_view_attachments); - }, /* Call the on_compose_message on the thread of this message. */ @@ -812,17 +777,6 @@ openerp.mail = function (session) { } }, - /* Call the on_compose_message on the thread of this message. */ - on_view_attachments:function (event) { - event.stopPropagation(); - var self = this; - if (!this.toggle_attachment) { - self.display_attachments(); - this.toggle_attachment = true; - } - this.$('.oe_msg_attachment_list').toggle(200); - }, - /** * Wait a confirmation for delete the message on the DB. * Make an animate destroy @@ -857,7 +811,10 @@ openerp.mail = function (session) { msg.animated_destroy(150); } else { msg.renderElement(); - msg.start() + msg.start(); + } + if( self.options.root_thread.__parentedParent.__parentedParent.do_reload_menu_emails ) { + self.options.root_thread.__parentedParent.__parentedParent.do_reload_menu_emails(); } }); @@ -997,10 +954,7 @@ openerp.mail = function (session) { init: function (parent, datasets, options) { this._super(parent, options); this.domain = options.domain || []; - this.context = _.extend({ - default_model: 'mail.thread', - default_res_id: 0, - default_parent_id: false }, options.context || {}); + this.context = _.extend(options.context || {}); this.options = options.options; this.options.root_thread = (options.options.root_thread != undefined ? options.options.root_thread : this); @@ -1243,6 +1197,7 @@ openerp.mail = function (session) { 'default_parent_id': self.id, }}); } else { + data.record_name= (data.record_name != '' && data.record_name) || (self.parent_message && self.parent_message.record_name); var message = new mail.ThreadMessage(self, data, {'context':{ 'default_model': data.model, 'default_res_id': data.res_id, @@ -1252,8 +1207,7 @@ openerp.mail = function (session) { // check if the message is already create for (var i in self.messages) { - if (self.messages[i] && self.messages[i].id == message.id) { - console.log('Reload message', message.id); + if (message.id && self.messages[i] && self.messages[i].id == message.id) { self.messages[i].destroy(); } } @@ -1280,10 +1234,9 @@ openerp.mail = function (session) { this.$('.oe_view_nocontent').remove(); - if (dom_insert_after) { message.insertAfter(dom_insert_after); - }if (prepend) { + } else if (prepend) { message.prependTo(self.$el); } else { message.appendTo(self.$el); @@ -1460,6 +1413,7 @@ openerp.mail = function (session) { 'show_record_name' : false, 'show_compose_message' : false, 'show_compact_message' : false, + 'compose_placeholder': false, 'view_inbox': false, 'message_ids': undefined, }, this.action.params); @@ -1524,14 +1478,18 @@ openerp.mail = function (session) { init: function (parent, node) { this._super.apply(this, arguments); this.node = _.clone(node); - this.node.params = _.extend({ 'display_indented_thread': -1, 'show_reply_button': false, 'show_read_unread_button': false, + 'show_record_name': false, 'show_compact_message': 1, }, this.node.params); + if (this.node.attrs.placeholder) { + this.node.params.compose_placeholder = this.node.attrs.placeholder; + } + this.domain = this.node.params && this.node.params.domain || []; }, @@ -1603,7 +1561,7 @@ openerp.mail = function (session) { this.action = _.clone(action); this.domain = this.action.params.domain || this.action.domain || []; - this.context = this.action.params.context || this.action.context || {}; + this.context = _.extend(this.action.params.context || {}, this.action.context || {}); this.defaults = {}; for (var key in this.context) { @@ -1617,6 +1575,7 @@ openerp.mail = function (session) { 'show_reply_button': true, 'show_read_unread_button': true, 'show_compose_message': true, + 'show_record_name': true, 'show_compact_message': this.action.params.view_mailbox ? false : 1, 'view_inbox': false, }, this.action.params); @@ -1629,7 +1588,23 @@ openerp.mail = function (session) { if (! this.searchview.has_defaults) { this.message_render(); } - + }, + + /** + * crete an object "related_menu" + * contain the menu widget and the the sub menu related of this wall + */ + do_reload_menu_emails: function () { + var menu = this.__parentedParent.__parentedParent.menu; + // return this.rpc("/web/menu/load", {'menu_id': 100}).done(function(r) { + // _.each(menu.data.data.children, function (val) { + // if (val.id == 100) { + // val.children = _.find(r.data.children, function (r_val) {return r_val.id == 100;}).children; + // } + // }); + // var r = menu.data; + // window.setTimeout(function(){menu.do_reload();}, 0); + // }); }, /** diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 7bb019cde4f..0645c2b9225 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -36,22 +36,22 @@ openerp_mail_followers = function(session, mail) { start: function() { // use actual_mode property on view to know if the view is in create mode anymore - this.view.on("change:actual_mode", this, this._check_visibility); - this._check_visibility(); + this.view.on("change:actual_mode", this, this.on_check_visibility_mode); + this.on_check_visibility_mode(); this.reinit(); this.bind_events(); this._super(); }, + on_check_visibility_mode: function () { + this.set({"force_invisible": this.view.get("actual_mode") == "create"}); + }, + set_value: function(_value) { this.value = _value; this._super(_value); }, - _check_visibility: function() { - this.$el.toggle(this.view.get("actual_mode") !== "create"); - }, - reinit: function() { this.message_is_follower == undefined; this.display_buttons(); @@ -194,6 +194,7 @@ openerp_mail_followers = function(session, mail) { display_subtypes:function (data) { var self = this; var subtype_list_ul = this.$('.oe_subtype_list'); + subtype_list_ul.empty(); 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; diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 89fbe45dc36..bb787c9a21b 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -39,8 +39,9 @@ </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.view_mailbox" class="field_text oe_compact" placeholder="Write to the followers of this docmuent..."/> - <textarea t-if="widget.options.view_mailbox" class="field_text oe_compact" placeholder="Write to my followers..."/> + <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..."/> </div> <span t-if="!(widget.show_compact_message and !widget.show_composer) and !widget.show_composer" class="oe_placeholder_compose"></span> </t> @@ -84,7 +85,7 @@ </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,100])"></img></a> + <a t-att-href='attachment.url'><img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img></a> <div class='oe_delete oe_e'>[</div> <div class='oe_name'><t t-raw='attachment.name' /></div> <div class='oe_progress_bar'> @@ -101,7 +102,13 @@ <t t-name="mail.thread.list_recipients"> <div class="oe_mail_list_recipients"> To: - <span t-if="!widget.is_private" class="oe_all_follower">Followers <t t-raw="' of ' + (widget.parent_thread.parent_message.record_name ? '"' + widget.parent_thread.parent_message.record_name + '"' : 'this document')"/></span> + <t t-if="!widget.is_private"> + <span class="oe_all_follower"> + Followers of + <t t-if="widget.parent_thread.parent_message.record_name" t-raw="'"' + widget.parent_thread.parent_message.record_name + '"'"/> + <t t-if="!widget.parent_thread.parent_message.record_name">this document</t> + </span> + </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"/> @@ -129,9 +136,15 @@ <td colspan="2"> <h2 class="oe_view_title"> <span class="oe_view_title_text"> - Email box + <t t-raw="widget.action.name"/> </span> </h2> + <t t-if="widget.action.params.header_description"> + <br/> + <span class="oe_view_subtitle_text"> + <t t-raw="widget.action.params.header_description"/> + </span> + </t> </td> <td><div class="oe_view_manager_view_search" t-opentag="true"/></td> </tr> @@ -192,13 +205,11 @@ </div> <!-- message itself --> <div class="oe_msg_content"> - <h1 t-if="widget.subject and !widget.thread_level" class="oe_msg_title"> - <t t-raw="widget.subject"/> + <h1 t-if="(widget.show_record_name or widget.subject) and !widget.thread_level" class="oe_msg_title"> + <a t-if="widget.show_record_name" class="oe_mail_action_model" t-attf-href="#model=#{widget.model}&id=#{widget.res_id}"><t t-raw="widget.record_name"/></a> + <t t-if="widget.subject" t-raw="widget.subject"/> </h1> <div class="oe_msg_body"> - <t t-if="widget.show_record_name"> - <a class="oe_mail_action_model" t-attf-href="#model=#{widget.model}&id=#{widget.res_id}"><t t-raw="widget.record_name"/></a> - </t> <t t-raw="widget.body"/> </div> </div> @@ -209,13 +220,6 @@ <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> <span class='oe_subtle'>•</span> <span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span> - <t t-if='widget.attachment_ids.length > 0'> - <span class='oe_subtle'>•</span> - <a class="oe_view_attachments"> - <t t-if="widget.attachment_ids.length == 1">1 Attachment</t> - <t t-if="widget.attachment_ids.length > 1"><t t-raw="widget.attachment_ids.length"/> Attachments</t> - </a> - </t> <span class='oe_subtle'>•</span> <t t-call="mail.thread.message.vote"/> </div> |
