[FIX] website, web_planner: shared help comportement in frontend/backend
Help has been moved to web_planner, but only in backend. The comportement needs to be defined in website also so it is now shared in frontend and backend (mixin in common)
This commit is contained in:
@@ -13,7 +13,7 @@ var QWeb = core.qweb;
|
||||
var _t = core._t;
|
||||
var PlannerDialog = planner.PlannerDialog;
|
||||
|
||||
var PlannerLauncher = Widget.extend({
|
||||
var PlannerLauncher = Widget.extend(planner.PlannerHelpMixin, {
|
||||
template: "PlannerLauncher",
|
||||
init: function(parent) {
|
||||
this._super(parent);
|
||||
@@ -72,33 +72,6 @@ var PlannerLauncher = Widget.extend({
|
||||
this.dialog.$el.detach();
|
||||
}
|
||||
},
|
||||
on_menu_help: function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
var menu = $(ev.currentTarget).data('menu');
|
||||
if (menu === 'about') {
|
||||
var self = this;
|
||||
self.rpc("/web/webclient/version_info", {}).done(function(res) {
|
||||
var $help = $(QWeb.render("PlannerLauncher.about", {version_info: res}));
|
||||
$help.find('a.oe_activate_debug_mode').click(function (e) {
|
||||
e.preventDefault();
|
||||
window.location = $.param.querystring( window.location.href, 'debug');
|
||||
});
|
||||
new Dialog(this, {
|
||||
size: 'medium',
|
||||
dialogClass: 'o_act_window',
|
||||
title: _t("About"),
|
||||
$content: $help
|
||||
}).open();
|
||||
});
|
||||
} else if (menu === 'documentation') {
|
||||
window.open('https://www.odoo.com/documentation/user', '_blank');
|
||||
} else if (menu === 'planner') {
|
||||
if (this.dialog) this.show_dialog();
|
||||
} else if (menu === 'support') {
|
||||
window.open('https://www.odoo.com/pricing?noredirect=1', '_blank');
|
||||
}
|
||||
},
|
||||
setup: function(planner) {
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@ odoo.define('web.planner.common', function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require('web.core');
|
||||
var Dialog = require('web.Dialog');
|
||||
var Model = require('web.Model');
|
||||
var Widget = require('web.Widget');
|
||||
var utils = require('web.utils');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
var Page = core.Class.extend({
|
||||
init: function (dom, page_index) {
|
||||
var $dom = $(dom);
|
||||
@@ -403,8 +406,40 @@ var PlannerDialog = Widget.extend({
|
||||
}
|
||||
});
|
||||
|
||||
var PlannerHelpMixin = {
|
||||
|
||||
on_menu_help: function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
var menu = $(ev.currentTarget).data('menu');
|
||||
if (menu === 'about') {
|
||||
var self = this;
|
||||
self.rpc("/web/webclient/version_info", {}).done(function(res) {
|
||||
var $help = $(QWeb.render("PlannerLauncher.about", {version_info: res}));
|
||||
$help.find('a.oe_activate_debug_mode').click(function (e) {
|
||||
e.preventDefault();
|
||||
window.location = $.param.querystring( window.location.href, 'debug');
|
||||
});
|
||||
new Dialog(this, {
|
||||
size: 'medium',
|
||||
dialogClass: 'o_act_window',
|
||||
title: _t("About"),
|
||||
$content: $help
|
||||
}).open();
|
||||
});
|
||||
} else if (menu === 'documentation') {
|
||||
window.open('https://www.odoo.com/documentation/user', '_blank');
|
||||
} else if (menu === 'planner') {
|
||||
if (this.dialog) this.show_dialog();
|
||||
} else if (menu === 'support') {
|
||||
window.open('https://www.odoo.com/pricing?noredirect=1', '_blank');
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
PlannerDialog: PlannerDialog,
|
||||
PlannerHelpMixin: PlannerHelpMixin,
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -14,13 +14,14 @@ if(!$('#oe_systray').length) {
|
||||
return $.Deferred().reject("DOM doesn't contain '#oe_systray'");
|
||||
}
|
||||
|
||||
var WebsitePlannerLauncher = Widget.extend({
|
||||
var WebsitePlannerLauncher = Widget.extend(planner.PlannerHelpMixin, {
|
||||
template: "PlannerLauncher",
|
||||
start: function() {
|
||||
var self = this;
|
||||
var res = this._super.apply(this, arguments);
|
||||
return res.then(this.get_website_planner.bind(this)).then(function(planner) {
|
||||
self.$el.filter('.o_planner_systray').on('click', self, self.show_dialog.bind(self));
|
||||
self.$el.filter('.o_planner_help').on('click', '.dropdown-menu li a[data-menu]', self.on_menu_help);
|
||||
if (planner.length) {
|
||||
self.planner = planner[0];
|
||||
self.planner.data = $.parseJSON(planner[0].data) || {};
|
||||
|
||||
Reference in New Issue
Block a user