[IMP] async require of raphael.js

bzr revid: fme@openerp.com-20140430142025-nbvwk5ggzo1bro0q
This commit is contained in:
Fabien Meghazi 2014-04-30 16:20:25 +02:00
parent 556c1404c2
commit 79ce95638d
2 changed files with 12 additions and 1 deletions

View File

@ -24,6 +24,15 @@ instance.web.DiagramView = instance.web.View.extend({
this.ids = this.dataset.ids;
this.on('pager_action_executed', self, self.pager_action_trigger);
},
start: function () {
return this._super().then(function () {
return $.when(
openerp.webclient.session.load_js(['/web/js/web_diagram.assets_raphael'])
);
}).fail(function () {
throw new Error("Could not load raphael.js");
});
},
view_loading: function(r) {
return this.load_diagram(r);

View File

@ -7,7 +7,6 @@
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_diagram/static/src/css/base_diagram.css"/>
<script type="text/javascript" src="/web_diagram/static/lib/js/raphael.js"></script>
<script type="text/javascript" src="/web_diagram/static/lib/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="/web_diagram/static/src/js/vec2.js"></script>
@ -15,5 +14,8 @@
<script type="text/javascript" src="/web_diagram/static/src/js/diagram.js"></script>
</xpath>
</template>
<template id="assets_raphael" name="raphael.js">
<script type="text/javascript" src="/web_diagram/static/lib/js/raphael.js"></script>
</template>
</data>
</openerp>