[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)
This commit is contained in:
Martin Geubelle
2015-09-24 11:25:43 +02:00
parent bacd60dc1d
commit e89d528788
4 changed files with 91 additions and 64 deletions
@@ -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;
-41
View File
@@ -51,51 +51,10 @@
<ul class="dropdown-menu">
<li><a href="#" data-menu="settings">Preferences</a></li>
<li><a href="#" data-menu="account">My Odoo.com account</a></li>
<li><a href="#" data-menu="about">About Odoo</a></li>
<li><a href="#" data-menu="help">Help</a></li>
<li><a href="#" data-menu="logout">Log out</a></li>
</ul>
</li>
</t>
<t t-name="UserMenu.about">
<div class="oe_about">
<div class="container-fluid">
<div class="row">
<a class="oe_activate_debug_mode oe_right label label-primary" href="?debug" >Activate the developer mode</a>
</div>
<div class="row">
<div class="col-sm-offset-2 col-md-offset-2 col-sm-8 col-md-8 user-details">
<div class="user-image">
<img src="/web/static/src/img/logo2.png" alt="Odoo (Formerly OpenERP)" title="Odoo (Formerly OpenERP)" class="img-circle"/>
</div>
<div class="user-info-block">
<div class="user-heading">
<h3>Version <t t-esc="version_info.server_version"/></h3>
</div>
<div class="user-body">
<div class="tab-content">
<div id="settings" class="tab-pane active">
<h4>Copyright © 2004-2015 Odoo S.A.</h4>
<p>Odoo is a trademark of <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">Odoo S.A.</a></p>
<p>Licenced under the terms of <a target="_blank" href="http://www.gnu.org/licenses/lgpl.html" style="text-decoration: underline;">GNU Lesser General Public License</a></p>
<p>For more information visit <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">Odoo.com</a></p>
<p>
<a href="https://www.odoo.com/web/about/facebook"><i class="fa fa-facebook-square fa-3x social-fb"></i></a>
<a href="https://www.odoo.com/web/about/twitter"><i class="fa fa-twitter-square fa-3x social-tw"></i></a>
<a href="https://www.odoo.com/web/about/googleplus"><i class="fa fa-google-plus-square fa-3x social-gp"></i></a>
<a href="https://www.odoo.com/web/about/linkedin"><i class="fa fa-linkedin-square fa-3x social-lk"></i></a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
<t t-name="WebClient.timezone_warning">
<i class="fa fa-exclamation-triangle oe_tz_warning"></i>
@@ -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($('<div>'));
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);
@@ -5,6 +5,57 @@
<li class="o_planner_systray hidden-xs">
<div class="progress"><div class="progress-bar"/></div>
</li>
<li class="o_planner_help">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="Open Help Menu" aria-expanded="false">
<span class="fa fa-question-circle"/>
<b class="caret"/>
</a>
<ul class="dropdown-menu" role="menu">
<li class="o_planner_link"><a href="#" data-menu="planner">Planner</a></li>
<li><a href="#" data-menu="documentation">Documentation</a></li>
<li><a href="#" data-menu="support">Support</a></li>
<li><a href="#" data-menu="about">About</a></li>
</ul>
</li>
</t>
<t t-name="PlannerLauncher.about">
<div class="oe_about">
<div class="container-fluid">
<div class="row">
<a class="oe_activate_debug_mode oe_right label label-primary" href="?debug" >Activate the developer mode</a>
</div>
<div class="row">
<div class="col-sm-offset-2 col-md-offset-2 col-sm-8 col-md-8 user-details">
<div class="user-image">
<img src="/web/static/src/img/logo2.png" alt="Odoo (Formerly OpenERP)" title="Odoo (Formerly OpenERP)" class="img-circle"/>
</div>
<div class="user-info-block">
<div class="user-heading">
<h3>Version <t t-esc="version_info.server_version"/></h3>
</div>
<div class="user-body">
<div class="tab-content">
<div id="settings" class="tab-pane active">
<h4>Copyright © 2004-2015 Odoo S.A.</h4>
<p>Odoo is a trademark of <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">Odoo S.A.</a></p>
<p>Licenced under the terms of <a target="_blank" href="http://www.gnu.org/licenses/lgpl.html" style="text-decoration: underline;">GNU Lesser General Public License</a></p>
<p>For more information visit <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">Odoo.com</a></p>
<p>
<a href="https://www.odoo.com/web/about/facebook"><i class="fa fa-facebook-square fa-3x social-fb"></i></a>
<a href="https://www.odoo.com/web/about/twitter"><i class="fa fa-twitter-square fa-3x social-tw"></i></a>
<a href="https://www.odoo.com/web/about/googleplus"><i class="fa fa-google-plus-square fa-3x social-gp"></i></a>
<a href="https://www.odoo.com/web/about/linkedin"><i class="fa fa-linkedin-square fa-3x social-lk"></i></a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
<div t-name="PlannerDialog" class="modal" id="PlannerDialog" tabindex="-1" role="dialog" aria-labelledby="PlannerDialogLabel" aria-hidden="true">
@@ -41,6 +92,7 @@
</div>
</div>
<t t-name="PlannerMenu">
<li t-foreach="orphan_pages" t-as="orphan_page">
<a t-att-href="'#' + menu_item_page_map[orphan_page]"><span class="fa fa-fw"/><t t-esc="orphan_page"/></a>