From 82fff8002076c22bff075c4697a4c0d3a9dca92e Mon Sep 17 00:00:00 2001 From: "Guillaume (gdi)" Date: Wed, 19 Oct 2022 12:36:05 +0000 Subject: [PATCH] [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) --- .../static/src/snippets/s_process_steps/options.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/website/static/src/snippets/s_process_steps/options.js b/addons/website/static/src/snippets/s_process_steps/options.js index ac45a6be25f..1e6581d9345 100644 --- a/addons/website/static/src/snippets/s_process_steps/options.js +++ b/addons/website/static/src/snippets/s_process_steps/options.js @@ -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.