[IMP] mail: top bar button

bzr revid: chm@openerp.com-20121012145320-tu28t0xgm5hcl304
This commit is contained in:
Christophe Matthieu 2012-10-12 16:53:20 +02:00
parent fea03dc5d4
commit cdff3ac73c
3 changed files with 79 additions and 1 deletions

View File

@ -422,3 +422,11 @@
position: absolute;
}
/* ------------------------------------------------------------ */
/* Topbar button
/* ------------------------------------------------------------ */
.openerp .oe_topbar .oe_topbar_compose_full_email {
float: right;
margin: 3px 25px 0 0;
}

View File

@ -49,7 +49,6 @@ openerp.mail = function(session) {
},
});
/**
* ------------------------------------------------------------
* ChatterUtils
@ -1278,4 +1277,65 @@ openerp.mail = function(session) {
this.$("button.oe_write_onwall:first").click(function(){ self.thread.ComposeMessage.$el.toggle(); });
}
});
/**
* ------------------------------------------------------------
* UserMenu
* ------------------------------------------------------------
*
* add a link on the top user bar for write a full mail
*/
session.web.ComposeMessageTopButton = session.web.Widget.extend({
template:'mail.compose_message.button_top_bar',
init: function (parent, options) {
this._super.apply(this, options);
this.options = this.options || {};
this.options.domain = this.options.domain || [];
this.options.context = {
'default_res_id': 0,
'default_model': 'mail.thread',
'default_is_private': true,
'default_res_model': false,
'default_res_id': 0,
'default_content_subtype': 'html',
'default_is_private': true,
'default_parent_id': 0
};
},
start: function(parent, params) {
var self = this;
this.$el.on('click', 'button', self.on_compose_message );
this._super(parent, params);
},
on_compose_message: function(event){
event.stopPropagation();
var action = {
type: 'ir.actions.act_window',
res_model: 'mail.compose.message',
view_mode: 'form',
view_type: 'form',
action_from: 'mail.ThreadComposeMessage',
views: [[false, 'form']],
target: 'new',
context: this.options.context,
};
session.client.action_manager.do_action(action);
},
});
session.web.UserMenu = session.web.UserMenu.extend({
start: function(parent, params) {
var render = new session.web.ComposeMessageTopButton();
render.insertAfter(this.$el);
this._super(parent, params);
}
});
};

View File

@ -251,6 +251,16 @@
</div>
</li>
<!--
mail.compose_message.button_top_bar
render of the button on the user bar for open wizard compose message
-->
<t t-name="mail.compose_message.button_top_bar">
<div class="oe_topbar_compose_full_email">
<button class="oe_button oe_highlight">Write an email</button>
</div>
</t>
<!-- mail.thread.message.vote
Template used to display Like/Unlike in a mail.message
-->