[REF] web: FormRenderer: INNER/OUTER_GROUP_COL params

This rev. extracts two rendering parameters for the groups
corresponding to the default col value to apply (for inner and for
outer groups). This allows to easily override those default values
in extentions of the FormRenderer (for instance, in the renderer
of the new Dashboard view).
This commit is contained in:
Aaron Bohy
2018-04-03 15:19:42 +02:00
committed by Géry Debongnie
parent d4b918f314
commit f5b1d4945c
@@ -15,6 +15,10 @@ var FormRenderer = BasicRenderer.extend({
'click .o_notification_box .oe_field_translate': '_onTranslate',
'click .oe_title, .o_inner_group': '_onClick',
}),
// default col attributes for the rendering of groups
INNER_GROUP_COL: 2,
OUTER_GROUP_COL: 2,
/**
* @override
*/
@@ -387,7 +391,7 @@ var FormRenderer = BasicRenderer.extend({
this._handleAttributes($result, node);
this._registerModifiers(node, this.state, $result);
var col = parseInt(node.attrs.col, 10) || 2;
var col = parseInt(node.attrs.col, 10) || this.INNER_GROUP_COL;
if (node.attrs.string) {
var $sep = $('<tr><td colspan="' + col + '" style="width: 100%;"><div class="o_horizontal_separator">' + node.attrs.string + '</div></td></tr>');
@@ -511,7 +515,8 @@ var FormRenderer = BasicRenderer.extend({
_renderOuterGroup: function (node) {
var self = this;
var $result = $('<div/>', {class: 'o_group'});
var colSize = Math.max(1, Math.round(12 / (parseInt(node.attrs.col, 10) || 2)));
var nbCols = parseInt(node.attrs.col, 10) || this.OUTER_GROUP_COL;
var colSize = Math.max(1, Math.round(12 / nbCols));
if (node.attrs.string) {
var $sep = $('<div/>', {class: 'o_horizontal_separator'}).text(node.attrs.string);
$result.append($sep);