[FIX] website: allow step to fill more than 9/12 of the page width

Prior to this commit, the steps block options could not support a column
that was more than nine out of twelve (bootstrap columns) wide.

Steps to reproduce the bug:
- Drop a block step on a page
- Set a width of 10 columns on the first step
- Set a width <= 2 columns on the second step

=> the connector is not well displayed.

task-3033126

closes odoo/odoo#108362

X-original-commit: 9c4e0eaa60ad89140661e3c297ea1b4e22d6faae
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Guillaume (gdi)
2022-12-21 09:58:54 +01:00
parent deacb8c94b
commit 82fff80020
@@ -135,8 +135,9 @@ options.registry.StepsConnector = options.Class.extend({
* @returns {integer}
*/
_getStepColSize(stepEl) {
const colClass = stepEl.className.split(' ').find(cl => cl.startsWith('col-lg'));
return parseInt(colClass[colClass.length - 1]);
const classPrefix = 'col-lg-';
const colClass = stepEl.className.split(' ').find(cl => cl.startsWith(classPrefix));
return parseInt(colClass.replace(classPrefix, ''));
},
/**
* Returns the padding of the step, as a number of bootstrap lg-col.
@@ -146,8 +147,10 @@ options.registry.StepsConnector = options.Class.extend({
* @returns {integer}
*/
_getStepColPadding(stepEl) {
const paddingClass = stepEl.className.split(' ').find(cl => cl.startsWith('offset-lg'));
return paddingClass ? parseInt(paddingClass[paddingClass.length - 1]) : 0;
const classPrefix = 'offset-lg-';
const paddingClass = stepEl.className.split(' ').find(cl => cl.startsWith(classPrefix));
return paddingClass ? parseInt(paddingClass.replace(classPrefix, '')) : 0;
},
/**
* Returns the svg path based on the type of connector.