summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-01-18 14:06:52 +0100
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-01-18 14:06:52 +0100
commit4e14e6145d7130c84d76039198306ba5fcd1daed (patch)
tree518a6e542449ee7f1ecd407db7d1ea7800fa971b /addons
parent110e8262527d47786bef571ecd65e99bab6c3057 (diff)
[imp] setup new gantt view
bzr revid: nicolas.vanhoren@openerp.com-20120118130652-08nnz3rx1gtk2f3v
Diffstat (limited to 'addons')
-rw-r--r--addons/web/static/src/js/views.js6
-rw-r--r--addons/web_gantt/static/src/js/gantt.js14
-rw-r--r--addons/web_gantt/static/src/xml/web_gantt.xml20
3 files changed, 33 insertions, 7 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index cc108837f88..fe4579c8c25 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -1038,6 +1038,12 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
template: "EmptyComponent",
// name displayed in view switchers
display_name: '',
+ init: function(parent, dataset, view_id, options) {
+ this._super(parent);
+ this.dataset = dataset;
+ this.view_id = view_id;
+ this.set_default_options(options);
+ },
set_default_options: function(options) {
this.options = options || {};
_.defaults(this.options, {
diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js
index 77bb6df4397..1a748e9cf91 100644
--- a/addons/web_gantt/static/src/js/gantt.js
+++ b/addons/web_gantt/static/src/js/gantt.js
@@ -6,8 +6,20 @@ var _t = openerp.web._t,
_lt = openerp.web._lt;
var QWeb = openerp.web.qweb;
openerp.web.views.add('gantt', 'openerp.web_gantt.GanttView');
+
openerp.web_gantt.GanttView = openerp.web.View.extend({
display_name: _lt('Gantt'),
+ template: "GanttView",
+ start: function() {
+ return this.rpc("/web/view/load", {"model": this.dataset.model, "view_id": this.view_id, "view_type": "gantt"}, this.on_loaded);
+ },
+ on_loaded: function(data) {
+ this.fields_view = data;
+ },
+});
+
+openerp.web_gantt.GanttViewOld = openerp.web.View.extend({
+ display_name: _lt('Gantt'),
init: function(parent, dataset, view_id) {
this._super(parent);
@@ -52,7 +64,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
return;
}
- this.$element.html(QWeb.render("GanttView", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
+ this.$element.html(QWeb.render("GanttViewOld", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
this.has_been_loaded.resolve();
},
diff --git a/addons/web_gantt/static/src/xml/web_gantt.xml b/addons/web_gantt/static/src/xml/web_gantt.xml
index 302ac2cfef9..2376c6243d8 100644
--- a/addons/web_gantt/static/src/xml/web_gantt.xml
+++ b/addons/web_gantt/static/src/xml/web_gantt.xml
@@ -1,6 +1,14 @@
-<template>
-<t t-name="GanttView">
- <button class="oe_button" id="add_task">Create</button>
- <div t-att-style="'width:'+ width + 'px; height:' + height + 'px; padding-top:6px;position:relative;'" id="GanttView"/>
-</t>
-</template>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<templates>
+ <t t-name="GanttView">
+ <div>
+ <button class="oe_button oe-gantt-view-create">Create</button>
+ <div class="oe-gantt-view-view"/>
+ </div>
+ </t>
+ <t t-name="GanttViewOld">
+ <button class="oe_button" id="add_task">Create</button>
+ <div t-att-style="'width:'+ width + 'px; height:' + height + 'px; padding-top:6px;position:relative;'" id="GanttView"/>
+ </t>
+</templates>