summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/backend
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2017-08-31 14:39:52 +0200
committerChristophe Matthieu <chm@odoo.com>2017-08-31 16:26:11 +0200
commit95c2bd33a2e4bc5995b77c64c961e97db809e7f2 (patch)
tree27c6d4104ae973ad293f0b8e5742f231f8362ff1 /addons/website/static/src/js/backend
parent6f60a9a1792f4390c883bc1dff5f595c84183e12 (diff)
[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset size
Diffstat (limited to 'addons/website/static/src/js/backend')
-rw-r--r--addons/website/static/src/js/backend/dashboard.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js
index 794ae0f932a..966c37b49f9 100644
--- a/addons/website/static/src/js/backend/dashboard.js
+++ b/addons/website/static/src/js/backend/dashboard.js
@@ -1,6 +1,7 @@
odoo.define('website.backend.dashboard', function (require) {
'use strict';
+var ajax = require('web.ajax');
var ControlPanelMixin = require('web.ControlPanelMixin');
var core = require('web.core');
var Dialog = require('web.Dialog');
@@ -16,6 +17,14 @@ var QWeb = core.qweb;
var Dashboard = Widget.extend(ControlPanelMixin, {
template: 'website.WebsiteDashboardMain',
+ cssLibs: [
+ '/web/static/lib/nvd3/nv.d3.css'
+ ],
+ jsLibs: [
+ '/web/static/lib/nvd3/d3.v3.js',
+ '/web/static/lib/nvd3/nv.d3.js',
+ '/web/static/src/js/libs/nvd3.js'
+ ],
events: {
'click .js_link_analytics_settings': 'on_link_analytics_settings',
'click .o_dashboard_action': 'on_dashboard_action',
@@ -37,10 +46,8 @@ var Dashboard = Widget.extend(ControlPanelMixin, {
willStart: function() {
var self = this;
- return this._super().then(function() {
- return $.when(
- self.fetch_data()
- );
+ return $.when(ajax.loadLibs(this), this._super()).then(function() {
+ return self.fetch_data();
});
},