[FIX] render child using Qweb.

bzr revid: vda@tinyerp.com-20110517131703-jfsir3gu8h59xip7
This commit is contained in:
vda (OpenERP)
2011-05-17 18:47:03 +05:30
parent b510cb6ed8
commit 9b73b5b5b5
2 changed files with 18 additions and 38 deletions
@@ -39,41 +39,19 @@ openerp.base.form.Dashbar = openerp.base.form.Widget.extend({
init: function(view, node, dashboard) {
this._super(view, node, dashboard);
this.dashboard = dashboard;
this.template = 'Portlet'
},
start: function() {
var $dashboard = this.dashboard;
var children = this.node.children;
$dashboard.append(
jQuery('<div>',{
'class': 'column',
'id': this.node.tag
})
)
$dashboard.append(QWeb.render(this.template, {widget: this, 'children': children}))
for(var chld=0; chld < children.length;chld++) {
var child = children[chld];
var widget = new (openerp.base.form.widgets.get_object(child.tag)) (this.view, child);
widget.start()
$dashboard.find('#'+this.node.tag).append(
jQuery('<div>',{
'class': 'portlet',
'id': child.attrs.name
}
).append(
jQuery('<div>',{
'class': 'portlet-header'
}).html(child.attrs.string).append(
jQuery('<span>',{
'class': 'ui-icon ui-icon-minusthick'
})
),
jQuery('<div>',{
'class': 'portlet-content',
'id': child.attrs.name+'-portlet-content'
})
)
)
}
$( ".column" ).sortable({
connectWith: ".column"
});
@@ -83,14 +61,14 @@ openerp.base.form.Dashbar = openerp.base.form.Widget.extend({
.addClass( "ui-widget-header ui-corner-all" )
.end()
.find( ".portlet-content" );
$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
});
$( ".column" ).disableSelection();
},
}
})
openerp.base.form.Action = openerp.base.form.Widget.extend({
@@ -113,7 +91,7 @@ openerp.base.form.Action = openerp.base.form.Widget.extend({
views_switcher : false
}
var node_attrs = this.node.attrs;
var content_id = jQuery('#'+node_attrs.name).find('.portlet-content').attr('id')
var content_id = 'portlet-content-'+node_attrs.name;
var action_manager = new openerp.base.ActionManager(this.session, content_id);
action_manager.start();
action_manager.do_action(action);
@@ -1,15 +1,17 @@
<template>
<t t-name="Board">
<!--
<div id="dashboard" class="dashboard">
this HTML covers all layouts. The 5 different layouts are handled by setting another layout classname
<div class="layout">
<div id="column-first" class="column first column-first"></div>
<div id="column-second" class="column second column-second"></div>
<div id="column-third" class="column third column-third"></div>
</div>
</div>-->
<div id="dashboard" class="demo">
</div>
</t>
<t t-name="Portlet">
<div t-att-id="widget.node.tag" class="column">
<div class="portlet" t-foreach="children" t-as="child" t-att-id="child.attrs.name">
<div class="portlet-header">
<t t-esc="child.attrs.string"/>
<span class="ui-icon ui-icon-minusthick"></span>
</div>
<div class="portlet-content" t-att-id="'portlet-content-'+child.attrs.name"></div>
</div>
</div>
</t>
</template>