Skip to content
Snippets Groups Projects
Commit f5b1d494 authored by Aaron Bohy's avatar Aaron Bohy Committed by Géry Debongnie
Browse files

[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).
parent d4b918f3
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment