[FIX] Fix trunk-fp

bzr revid: fme@openerp.com-20120529151055-gc098pdvfvyh3dep
This commit is contained in:
Fabien Meghazi 2012-05-29 17:10:55 +02:00
parent efe2867330
commit bcb86755c0
4 changed files with 66 additions and 92 deletions

View File

@ -1591,9 +1591,6 @@
.openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master { .openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master {
width: 100%; width: 100%;
} }
.openerp .oe_form .oe_form_group_cell.oe_form_group_nested {
padding: 0;
}
.openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] { .openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] {
font-weight: bold; font-weight: bold;
white-space: nowrap; white-space: nowrap;

View File

@ -1286,8 +1286,6 @@ $colour4: #8a89ba
.oe_form_group_cell > div > .oe_datepicker_root, .oe_form_group_cell > div > .oe_datepicker_root,
.oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master
width: 100% width: 100%
.oe_form_group_cell.oe_form_group_nested
padding: 0
// }}} // }}}
// FormView.label {{{ // FormView.label {{{
.oe_form .oe_form

View File

@ -1061,34 +1061,31 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
return $label; return $label;
}, },
process_field: function($field, layout) { process_field: function($field, layout) {
// Note FP: No implicit labels for normal fields, only for <group> children if ($field.parent().is('group')) {
// var $label = this.preprocess_field($field); // No implicit labels for normal fields, only for <group> direct children
// if ($label) var $label = this.preprocess_field($field);
// this.process($label, layout); if ($label) {
this.process($label, layout);
}
}
this.fields_to_init.push($field); this.fields_to_init.push($field);
return $field; return $field;
}, },
process_group: function($group, layout) { process_group: function($group, layout) {
var self = this; var self = this;
// Note FP: not clean to do such a hack, commenting it
// if ($group.parent().is('.oe_form_group_cell')) {
// $group.parent().addClass('oe_form_group_nested');
// }
$group.children('field').each(function() { $group.children('field').each(function() {
self.preprocess_field($(this)); self.preprocess_field($(this));
}); });
var $new_group = this.render_element('FormRenderingGroup', layout, $group.getAttributes()), var $new_group = this.render_element('FormRenderingGroup', layout, $group.getAttributes());
$table; var $table;
if ($new_group.is('table')) { if ($new_group.first().is('table.oe_form_group')) {
$table = $new_group; $table = $new_group;
} else if ($new_group.filter('table.oe_form_group').length) {
$table = $new_group.filter('table.oe_form_group').first();
} else { } else {
$table = $new_group.find('table:first'); $table = $new_group.find('table.oe_form_group').first();
} }
// Note FP: why don't we put that in the QWeb template ?
$table.addClass('oe_form_group');
var $tr, $td, var $tr, $td,
cols = parseInt($group.attr('col') || 4, 10), cols = parseInt($group.attr('col') || 4, 10),
row_cols = cols; row_cols = cols;
@ -1101,7 +1098,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
var $td = $('<td/>').addClass('oe_form_group_cell').attr('colspan', colspan); var $td = $('<td/>').addClass('oe_form_group_cell').attr('colspan', colspan);
var newline = tagName === 'newline'; var newline = tagName === 'newline';
// Note FP: looks like a hack to avoid // Note FME: those classes are used in layout debug mode
if ($tr && row_cols > 0 && (newline || row_cols < colspan)) { if ($tr && row_cols > 0 && (newline || row_cols < colspan)) {
$tr.addClass('oe_form_group_row_incomplete'); $tr.addClass('oe_form_group_row_incomplete');
if (newline) { if (newline) {
@ -1131,59 +1128,57 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
} }
$group.before($new_group).remove(); $group.before($new_group).remove();
// Now compute width of cells $table.find('> tbody > tr').each(function() {
// Note FP: It would be better to remove this, using width="50%" rather than colspan="2" var to_compute = [],
// $table.find('> tbody > tr').each(function() { row_cols = cols,
// var to_compute = [], total = 100;
// row_cols = cols, $(this).children().each(function() {
// total = 100; var $td = $(this),
// $(this).children().each(function() { $child = $td.children(':first');
// var $td = $(this), switch ($child[0].tagName.toLowerCase()) {
// $child = $td.children(':first'); case 'separator':
// switch ($child[0].tagName.toLowerCase()) { if ($child.attr('orientation') === 'vertical') {
// case 'separator': $td.addClass('oe_vertical_separator').attr('width', '1');
// if ($child.attr('orientation') === 'vertical') { $td.empty();
// $td.addClass('oe_vertical_separator').attr('width', '1'); row_cols--;
// $td.empty(); }
// row_cols--; break;
// } case 'label':
// break; if ($child.attr('for')) {
// case 'label': $td.attr('width', '1%').addClass('oe_form_group_cell_label');
// if ($child.attr('for')) { row_cols--;
// $td.attr('width', '1%').addClass('oe_form_group_cell_label'); total--;
// row_cols--; }
// total--; break;
// } default:
// break; var width = _.str.trim($child.attr('width') || ''),
// default: iwidth = parseInt(width, 10);
// var width = _.str.trim($child.attr('width') || ''), if (iwidth) {
// iwidth = parseInt(width, 10); if (width.substr(-1) === '%') {
// if (iwidth) { total -= iwidth;
// if (width.substr(-1) === '%') { width = iwidth + '%';
// total -= iwidth; } else {
// width = iwidth + '%'; // Absolute width
// } else { $td.css('min-width', width + 'px');
// // Absolute width }
// $td.css('min-width', width + 'px'); $td.attr('width', width);
// } $child.removeAttr('width');
// $td.attr('width', width); row_cols--;
// $child.removeAttr('width'); } else {
// row_cols--; to_compute.push($td);
// } else { }
// to_compute.push($td);
// }
// } }
// }); });
// var unit = Math.floor(total / row_cols); var unit = Math.floor(total / row_cols);
// if (!$(this).is('.oe_form_group_row_incomplete')) { if (!$(this).is('.oe_form_group_row_incomplete')) {
// _.each(to_compute, function($td, i) { _.each(to_compute, function($td, i) {
// var width = parseInt($td.attr('colspan'), 10) * unit; var width = parseInt($td.attr('colspan'), 10) * unit;
// $td.attr('width', ((i == to_compute.length - 1) ? total : width) + '%'); $td.attr('width', ((i == to_compute.length - 1) ? total : width) + '%');
// total -= width; total -= width;
// }); });
// } }
// }); });
_.each(children, function(el) { _.each(children, function(el) {
self.process($(el)); self.process($(el));
}); });

View File

@ -786,10 +786,8 @@
<t t-name="FormRenderingSheet" t-extend="FormRenderingForm"> <t t-name="FormRenderingSheet" t-extend="FormRenderingForm">
</t> </t>
<t t-name="FormRenderingGroup"> <t t-name="FormRenderingGroup">
<t t-if="string"> <t t-call="FormRenderingSeparator"/>
<separator t-attf="#{string}"/> <table border="0" cellpadding="0" cellspacing="0" width="100%" t-attf-class="oe_form_group classnames"/>
</t>
<table border="0" cellpadding="0" cellspacing="0" width="100%" t-att-class="classnames"/>
</t> </t>
<t t-name="FormRenderingNotebook"> <t t-name="FormRenderingNotebook">
<div> <div>
@ -1066,20 +1064,6 @@
<span></span> <span></span>
</div> </div>
</t> </t>
<t t-name="FieldStatus.content">
<div class="oe_right">
<ul class="oe-arrow-list">
<t t-set="size" t-value="widget.to_show.length"/>
<t t-foreach="_.range(size)" t-as="i">
<li t-att-class="widget.to_show[i][0] === widget.selected_value ? 'oe-arrow-list-selected' : ''">
<span class="oe-arrow-list-before" t-if="i &gt; 0"></span><span><t t-esc="widget.to_show[i][1]"/></span><span class="oe-arrow-list-after" t-if="i &lt; size - 1"></span>
</li>
</t>
</ul>
</div>
<div class="oe_clear"/>
</t>
<t t-name="FieldStatus.content"> <t t-name="FieldStatus.content">
<div class="oe_right"> <div class="oe_right">
<ul class="oe_form_steps"> <ul class="oe_form_steps">