[imp] moved create button to another place to make it nicer

bzr revid: nicolas.vanhoren@openerp.com-20120125131208-hulto9nh0t23atdz
This commit is contained in:
niv-openerp 2012-01-25 14:12:08 +01:00
parent 299e777808
commit f9c1bb2bf4
3 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,9 @@
.oe-gantt-view-view {
.openerp .oe-gantt-view-view {
min-height: 500px;
}
.openerp .oe-gantt-view-view .oe-gantt-view-create {
position: absolute;
top: 5px;
}

View File

@ -16,7 +16,6 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
this.chart_id = _.uniqueId();
},
start: function() {
$(".oe-gantt-view-create", this.$element).click(this.on_task_create);
return $.when(this.rpc("/web/view/load", {"model": this.dataset.model, "view_id": this.view_id, "view_type": "gantt"}),
this.rpc("/web/searchview/fields_get", {"model": this.dataset.model})).pipe(this.on_loaded);
},
@ -175,6 +174,12 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
self.on_task_display(task_info.internal_task);
}
});
// insertion of create button
var td = $($("table td", self.$element)[0]);
var rendered = QWeb.render("GanttView-create-button");
$(rendered).prependTo(td);
$(".oe-gantt-view-create", this.$element).click(this.on_task_create);
},
on_task_changed: function(task_obj) {
var self = this;

View File

@ -3,8 +3,10 @@
<templates>
<t t-name="GanttView">
<div>
<button class="oe_button oe-gantt-view-create">Create</button>
<div t-att-id="widget.chart_id" class="oe-gantt-view-view"/>
</div>
</t>
<t t-name="GanttView-create-button">
<button class="oe_button oe-gantt-view-create">Create</button>
</t>
</templates>