From e89d52878814a05cce7d3af7ebd103e96d75fd82 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 11 Sep 2015 17:12:28 +0200 Subject: [PATCH] [IMP] web, web_planner: move 'Help' in systray * 'Help' has now its own dropdown, directly accessible in the systray, instead of being hidden in the Administrator dropdown * 'About' has been moved there also * We can access the planner through this dropdown, even if the planner is hidden (complete) --- addons/web/static/src/js/widgets/user_menu.js | 19 ------- addons/web/static/src/xml/base.xml | 41 --------------- .../static/src/js/web_planner_backend.js | 43 +++++++++++++-- .../static/src/xml/web_planner.xml | 52 +++++++++++++++++++ 4 files changed, 91 insertions(+), 64 deletions(-) diff --git a/addons/web/static/src/js/widgets/user_menu.js b/addons/web/static/src/js/widgets/user_menu.js index 9111a9a34ba..f9c658525a4 100644 --- a/addons/web/static/src/js/widgets/user_menu.js +++ b/addons/web/static/src/js/widgets/user_menu.js @@ -55,9 +55,6 @@ var SystrayMenu = Widget.extend({ }; this.update_promise = this.update_promise.then(fct, fct); }, - on_menu_help: function() { - window.open('http://help.odoo.com', '_blank'); - }, on_menu_logout: function() { this.trigger('user_logout'); }, @@ -91,22 +88,6 @@ var SystrayMenu = Widget.extend({ }); }); }, - on_menu_about: function() { - var self = this; - self.rpc("/web/webclient/version_info", {}).done(function(res) { - var $help = $(QWeb.render("UserMenu.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(); - }); - }, }); return SystrayMenu; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 435352efc16..78f9ffea42d 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -51,51 +51,10 @@ - - -
- -
- -
-
-
- Odoo (Formerly OpenERP) -
- -
-
-
-
-
diff --git a/addons/web_planner/static/src/js/web_planner_backend.js b/addons/web_planner/static/src/js/web_planner_backend.js index f0af8cff4ef..ca400ca89e5 100644 --- a/addons/web_planner/static/src/js/web_planner_backend.js +++ b/addons/web_planner/static/src/js/web_planner_backend.js @@ -2,12 +2,15 @@ odoo.define('web.planner', function (require) { "use strict"; var core = require('web.core'); +var Dialog = require('web.Dialog'); var Model = require('web.Model'); var SystrayMenu = require('web.SystrayMenu'); var Widget = require('web.Widget'); var planner = require('web.planner.common'); var webclient = require('web.web_client'); +var QWeb = core.qweb; +var _t = core._t; var PlannerDialog = planner.PlannerDialog; var PlannerLauncher = Widget.extend({ @@ -20,11 +23,14 @@ var PlannerLauncher = Widget.extend({ start: function() { var self = this; core.bus.on("change_menu_section", self, self.on_menu_clicked); + var res = self._super.apply(this, arguments).then(function() { 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); return self.fetch_application_planner(); }).then(function(apps) { - self.do_hide(); // hidden by default + self.$el.filter('.o_planner_systray').hide(); // hidden by default + self.$el.filter('.o_planner_help').find('.o_planner_link').hide(); self.$('.progress').tooltip({html: true, placement: 'bottom', delay: {'show': 500}}); self.planner_apps = apps; return apps; @@ -52,7 +58,8 @@ var PlannerLauncher = Widget.extend({ this.setup(this.planner_apps[menu_id]); this.need_reflow = true; } else { - this.do_hide(); + this.$el.filter('.o_planner_systray').hide(); + this.$el.filter('.o_planner_help').find('.o_planner_link').hide(); this.need_reflow = true; } if (this.need_reflow) { @@ -65,6 +72,33 @@ 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; @@ -77,6 +111,7 @@ var PlannerLauncher = Widget.extend({ this.dialog.appendTo($('
')); this.$('.progress').attr('data-original-title', this.planner.tooltip_planner); + this.$el.filter('.o_planner_help').find('.o_planner_link').show(); this.dialog.on("planner_progress_changed", this, function(percent){ self.update_parent_progress_bar(percent); @@ -88,13 +123,13 @@ var PlannerLauncher = Widget.extend({ } else { this.$(".progress").show(); } - this.do_show(); + this.$el.filter('.o_planner_systray').show(); this.$(".progress-bar").css('width', percent+"%"); }, show_dialog: function() { this.dialog.$el.appendTo(webclient.$el); this.dialog.$el.modal('show'); - } + }, }); SystrayMenu.Items.push(PlannerLauncher); diff --git a/addons/web_planner/static/src/xml/web_planner.xml b/addons/web_planner/static/src/xml/web_planner.xml index 29ce9d370d2..69f1d3e4df1 100644 --- a/addons/web_planner/static/src/xml/web_planner.xml +++ b/addons/web_planner/static/src/xml/web_planner.xml @@ -5,6 +5,57 @@ +
  • + + +
  • + + + +
    + +
    + +
    +
    +
    + Odoo (Formerly OpenERP) +
    + +
    +
    +
    +
    +