[FIX] Fix form rendering engine with incomplete rows and newlines
bzr revid: fme@openerp.com-20120425142336-24bvwyjy8cz6f6my
This commit is contained in:
parent
c9c681ada9
commit
24312ab67c
|
@ -1814,6 +1814,17 @@
|
|||
.openerp .oe_layout_debugging .oe_form_group:hover, .openerp .oe_layout_debugging .oe_form_group_cell:hover {
|
||||
outline-color: red;
|
||||
}
|
||||
.openerp .oe_layout_debugging .oe_form_group_row_incomplete > td:last-child:after {
|
||||
content: "[Incomplete Row]";
|
||||
background: red;
|
||||
padding: 2px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
float: right;
|
||||
}
|
||||
.openerp .oe_layout_debugging .oe_form_group_row_incomplete.oe_form_group_row_newline > td:last-child:after {
|
||||
content: "[newline]";
|
||||
}
|
||||
.openerp .oe_debug_view {
|
||||
float: left;
|
||||
}
|
||||
|
|
|
@ -1515,6 +1515,15 @@ $colour4: #8a89ba
|
|||
outline: 1px solid blue
|
||||
.oe_form_group:hover, .oe_form_group_cell:hover
|
||||
outline-color: red
|
||||
.oe_form_group_row_incomplete > td:last-child:after
|
||||
content: "[Incomplete Row]"
|
||||
background: red
|
||||
padding: 2px
|
||||
font-weight: bold
|
||||
color: white
|
||||
float: right
|
||||
.oe_form_group_row_incomplete.oe_form_group_row_newline > td:last-child:after
|
||||
content: "[newline]"
|
||||
|
||||
.oe_debug_view
|
||||
float: left
|
||||
|
|
|
@ -1068,10 +1068,18 @@ instance.web.form.FormRenderingEngine = instance.web.Class.extend({
|
|||
|
||||
var children = [];
|
||||
$group.children().each(function(a,b,c) {
|
||||
var $child = $(this),
|
||||
colspan = parseInt($child.attr('colspan') || 1, 10),
|
||||
tagName = $child[0].tagName.toLowerCase();
|
||||
if (tagName === 'newline') {
|
||||
var $child = $(this);
|
||||
var colspan = parseInt($child.attr('colspan') || 1, 10);
|
||||
var tagName = $child[0].tagName.toLowerCase();
|
||||
var $td = $('<td/>').addClass('oe_form_group_cell').attr('colspan', colspan);
|
||||
var newline = tagName === 'newline';
|
||||
if ($tr && row_cols > 0 && (newline || row_cols < colspan)) {
|
||||
$tr.addClass('oe_form_group_row_incomplete');
|
||||
if (newline) {
|
||||
$tr.addClass('oe_form_group_row_newline');
|
||||
}
|
||||
}
|
||||
if (newline) {
|
||||
$tr = null;
|
||||
return;
|
||||
}
|
||||
|
@ -1081,7 +1089,6 @@ instance.web.form.FormRenderingEngine = instance.web.Class.extend({
|
|||
}
|
||||
row_cols -= colspan;
|
||||
|
||||
$td = $('<td/>').addClass('oe_form_group_cell').attr('colspan', colspan);
|
||||
// invisibility transfer
|
||||
var field_modifiers = JSON.parse($child.attr('modifiers') || '{}');
|
||||
var invisible = field_modifiers.invisible;
|
||||
|
@ -1138,11 +1145,13 @@ instance.web.form.FormRenderingEngine = instance.web.Class.extend({
|
|||
}
|
||||
});
|
||||
var unit = Math.floor(total / row_cols);
|
||||
_.each(to_compute, function($td, i) {
|
||||
var width = parseInt($td.attr('colspan'), 10) * unit;
|
||||
$td.attr('width', ((i == to_compute.length - 1) ? total : width) + '%');
|
||||
total -= width;
|
||||
});
|
||||
if (!$(this).is('.oe_form_group_row_incomplete')) {
|
||||
_.each(to_compute, function($td, i) {
|
||||
var width = parseInt($td.attr('colspan'), 10) * unit;
|
||||
$td.attr('width', ((i == to_compute.length - 1) ? total : width) + '%');
|
||||
total -= width;
|
||||
});
|
||||
}
|
||||
});
|
||||
_.each(children, function(el) {
|
||||
self.process($(el));
|
||||
|
|
Loading…
Reference in New Issue