diff options
| author | Aaron Bohy <aab@odoo.com> | 2015-11-02 16:10:13 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2015-11-03 16:19:35 +0100 |
| commit | 76c71e63e77cd0ec85e4668cad6af9659775266c (patch) | |
| tree | e09b08687c07a9b2be03fe6c9af88e99549b06a4 /addons/mail/static/src | |
| parent | f99231a8f4c84f79b40d3c4cc8a03d5bb536555c (diff) | |
[IMP] mail: client action: control panel buttons
Extract all buttons from 'Action' dropdown
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/client_action.js | 30 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/client_action.xml | 6 |
2 files changed, 14 insertions, 22 deletions
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index 1b28b53a02a..4f161f3d93c 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -16,7 +16,6 @@ var Model = require('web.Model'); var pyeval = require('web.pyeval'); var SearchView = require('web.SearchView'); var session = require('web.session'); -var Sidebar = require('web.Sidebar'); var Widget = require('web.Widget'); var QWeb = core.qweb; @@ -144,18 +143,6 @@ var ChatAction = Widget.extend(ControlPanelMixin, { this.searchview = new SearchView(this, dataset, view_id, {}, options); this.searchview.on('search_data', this, this.on_search); - this.sidebar = new Sidebar(this, { - sections: [ - {name: 'action', label: _t('Action')}, - ], - items: { - action: [ - {label: _t('Unsubscribe'), classname: 'o_mail_chat_button_unsubscribe', callback: this.on_click_button_unsubscribe}, - {label: _t('Settings'), classname: 'o_mail_chat_button_settings', callback: this.on_click_button_settings}, - ], - }, - }); - this.composer = new ChatComposer(this, { get_channel_info: function () { return { channel_id: self.channel.id }; @@ -169,6 +156,8 @@ var ChatAction = Widget.extend(ControlPanelMixin, { this.$buttons.find('button').css({display:"inline-block"}); this.$buttons.on('click', '.o_mail_chat_button_invite', this.on_click_button_invite); this.$buttons.on('click', '.o_mail_chat_button_detach', this.on_click_button_detach); + this.$buttons.on('click', '.o_mail_chat_button_unsubscribe', this.on_click_button_unsubscribe); + this.$buttons.on('click', '.o_mail_chat_button_settings', this.on_click_button_settings); this.$buttons.on('click', '.o_mail_toggle_channels', function () { self.$('.o_mail_chat_sidebar').slideToggle(200); }); @@ -189,11 +178,10 @@ var ChatAction = Widget.extend(ControlPanelMixin, { var def1 = this.thread.prependTo(this.$('.o_mail_chat_content')); var def2 = this.composer.appendTo(this.$('.o_mail_chat_content')); var def3 = this.searchview.appendTo($("<div>")); - var def4 = this.sidebar.appendTo($("<div>")); this.render_sidebar(); - return $.when(def1, def2, def3, def4) + return $.when(def1, def2, def3) .then(this.set_channel.bind(this, chat_manager.get_channel(default_channel_id))) .then(function () { chat_manager.bus.on('new_message', self, self.on_new_message); @@ -301,15 +289,19 @@ var ChatAction = Widget.extend(ControlPanelMixin, { } var new_channel_scrolltop = this.channels_scrolltop[channel.id]; this.channel = channel; + + // Update control panel this.set("title", channel.name); + // Hide 'detach' button in static channels this.$buttons .find('.o_mail_chat_button_detach') .toggle(channel.type !== "static"); + // Hide 'invite', 'unsubscribe' and 'settings' buttons in static channels and DM this.$buttons - .find('.o_mail_chat_button_invite') - .toggle(channel.type !== "dm" && channel.type !== 'static'); - + .find('.o_mail_chat_button_invite, .o_mail_chat_button_unsubscribe, .o_mail_chat_button_settings') + .toggle(channel.type !== "static" && channel.type !== "dm"); this.update_cp(); + this.action.context.active_id = channel.id; this.action.context.active_ids = [channel.id]; @@ -320,7 +312,6 @@ var ChatAction = Widget.extend(ControlPanelMixin, { .addClass('o_active'); this.$('.o_chat_composer').toggle(channel.type !== 'static'); - this.sidebar.$el.toggle(channel.type !== 'static'); return this.fetch_and_render_thread().then(function () { self.thread.scroll_to({offset: new_channel_scrolltop}); @@ -388,7 +379,6 @@ var ChatAction = Widget.extend(ControlPanelMixin, { $buttons: this.$buttons, $searchview: this.searchview.$el, $searchview_buttons: this.searchview.$buttons.contents(), - $sidebar: this.sidebar.$el, }, searchview: this.searchview, }); diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml index db2a3483913..a487cd741be 100644 --- a/addons/mail/static/src/xml/client_action.xml +++ b/addons/mail/static/src/xml/client_action.xml @@ -87,8 +87,10 @@ <t t-name="mail.chat.ControlButtons"> <div> <button type="button" class="btn btn-primary btn-sm o_mail_toggle_channels visible-xs-inline" t-att-title='_t("Toggle Channels")'>Channels</button> - <button type="button" class="btn btn-default btn-sm o_mail_chat_button_invite" t-att-title='_t("Invite people")'>Invite</button> - <button type="button" class="btn btn-default btn-sm o_mail_chat_button_detach hidden-xs" t-att-title='_t("Detach the conversation")'>Detach</button> + <button type="button" class="btn btn-primary btn-sm o_mail_chat_button_invite" t-att-title='_t("Invite people")'>Invite</button> + <button type="button" class="btn btn-primary btn-sm o_mail_chat_button_detach hidden-xs" t-att-title='_t("Detach the conversation")'>Detach</button> + <button type="button" class="btn btn-default btn-sm o_mail_chat_button_unsubscribe" t-att-title='_t("Unsubscribe from channel")'>Unsubscribe</button> + <button type="button" class="btn btn-default btn-sm o_mail_chat_button_settings" t-att-title='_t("Open channel settings")'>Settings</button> </div> </t> |
