[IMP] mail: move 'New message' button from navbar to Inbox
This commit is contained in:
@@ -191,6 +191,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
chat_manager.mark_all_as_read();
|
||||
});
|
||||
this.$buttons.on('click', '.o_mail_chat_button_unstar_all', chat_manager.unstar_all);
|
||||
this.$buttons.on('click', '.o_mail_chat_button_new_message', this.on_click_new_message);
|
||||
|
||||
this.thread.on('redirect', this, function (res_model, res_id) {
|
||||
chat_manager.redirect(res_model, res_id, this.set_channel.bind(this));
|
||||
@@ -375,7 +376,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
.find('.o_mail_chat_button_invite, .o_mail_chat_button_unsubscribe, .o_mail_chat_button_settings')
|
||||
.toggle(channel.type !== "dm" && channel.type !== 'static');
|
||||
self.$buttons
|
||||
.find('.o_mail_chat_button_mark_read')
|
||||
.find('.o_mail_chat_button_mark_read, .o_mail_chat_button_new_message')
|
||||
.toggle(channel.id === "channel_inbox");
|
||||
self.$buttons
|
||||
.find('.o_mail_chat_button_unstar_all')
|
||||
@@ -591,6 +592,16 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
target: 'current'
|
||||
});
|
||||
},
|
||||
on_click_new_message: function () {
|
||||
this.do_action({
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'mail.compose.message',
|
||||
view_mode: 'form',
|
||||
view_type: 'form',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ odoo.define('mail.systray', function (require) {
|
||||
|
||||
var core = require('web.core');
|
||||
var SystrayMenu = require('web.SystrayMenu');
|
||||
var web_client = require('web.web_client');
|
||||
var Widget = require('web.Widget');
|
||||
|
||||
var chat_manager = require('mail.chat_manager');
|
||||
@@ -41,33 +40,4 @@ var NotificationTopButton = Widget.extend({
|
||||
|
||||
SystrayMenu.Items.push(NotificationTopButton);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* * Global ComposeMessage Top Button
|
||||
* *
|
||||
* * Add a link on the top user bar to write a full mail. It opens the form view
|
||||
* * of the mail.compose.message (in a modal).
|
||||
* */
|
||||
var ComposeMessageTopButton = Widget.extend({
|
||||
template:'mail.ComposeMessageTopButton',
|
||||
events: {
|
||||
"click": "on_compose_message",
|
||||
},
|
||||
on_compose_message: function (ev) {
|
||||
ev.preventDefault();
|
||||
web_client.action_manager.do_action({
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'mail.compose.message',
|
||||
view_mode: 'form',
|
||||
view_type: 'form',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Put the ComposeMessageTopButton widget in the systray menu
|
||||
SystrayMenu.Items.push(ComposeMessageTopButton);
|
||||
|
||||
});
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
<button type="button" class="btn btn-primary btn-sm o_mail_chat_button_detach hidden-xs" title="Detach the conversation">Detach</button>
|
||||
<button type="button" class="btn btn-primary btn-sm o_mail_chat_button_mark_read" title="Mark all as read">Mark all read</button>
|
||||
<button type="button" class="btn btn-primary btn-sm o_mail_chat_button_unstar_all" title="Unstar all messages">Unstar all</button>
|
||||
<button type="button" class="btn btn-default btn-sm o_mail_chat_button_new_message" title="Compose a new message">New message</button>
|
||||
<button type="button" class="btn btn-default btn-sm o_mail_chat_button_unsubscribe" title="Unsubscribe from channel">Unsubscribe</button>
|
||||
<button type="button" class="btn btn-default btn-sm o_mail_chat_button_settings" title="Open channel settings">Settings</button>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="mail.ComposeMessageTopButton">
|
||||
<li title='Compose new Message' class="oe_topbar_item oe_topbar_compose_full_email">
|
||||
<a href="#">
|
||||
<i class="fa fa-envelope-o fa-fw"></i>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
<t t-name="mail.chat.NotificationTopButton">
|
||||
<li title="Notifications">
|
||||
|
||||
Reference in New Issue
Block a user