From 20249d316edc4a9deb3d379587e072a413acd0a2 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 10 Jul 2020 14:11:32 +0000 Subject: [PATCH] [IMP] website: remove animate scrolling option for table of content Part of https://github.com/odoo/odoo/pull/53930 task-2157252 --- .../snippets/s_table_of_content/options.js | 35 +------------------ .../views/snippets/s_table_of_content.xml | 4 +-- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/addons/website/static/src/snippets/s_table_of_content/options.js b/addons/website/static/src/snippets/s_table_of_content/options.js index 2e3d533e92d..0aae9030dab 100644 --- a/addons/website/static/src/snippets/s_table_of_content/options.js +++ b/addons/website/static/src/snippets/s_table_of_content/options.js @@ -11,7 +11,6 @@ options.registry.TableOfContent = options.Class.extend({ this.targetedElements = 'h1, h2'; const $headings = this.$target.find(this.targetedElements); if ($headings.length > 0) { - this.isAnimateScrolling = this.$target.find(this.targetedElements)[0].dataset.anchor === 'true' ? true : false; this._generateNav(); } // Generate the navbar if the content changes @@ -28,22 +27,6 @@ options.registry.TableOfContent = options.Class.extend({ this._generateNav(); }, - //-------------------------------------------------------------------------- - // Options - //-------------------------------------------------------------------------- - - /** - * Animate (or not) scrolling. - * - * @see this.selectClass for parameters - */ - animateScrolling: function (previewMode, widgetValue, params) { - const $headings = this.$target.find(this.targetedElements); - const anchorValue = widgetValue ? 'true' : '0'; - _.each($headings, el => el.dataset.anchor = anchorValue); - this.isAnimateScrolling = !!widgetValue; - }, - //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- @@ -63,26 +46,10 @@ options.registry.TableOfContent = options.Class.extend({ .text($el.text()) .appendTo($nav); $el.attr('id', id); - $el[0].dataset.anchor = this.isAnimateScrolling === true ? 'true' : '0'; + $el[0].dataset.anchor = 'true'; }); $nav.find('a:first').addClass('active'); }, - /** - * @override - */ - _computeWidgetState: function (methodName, params) { - switch (methodName) { - case 'animateScrolling': { - const $headings = this.$target.find(this.targetedElements); - if ($headings.length > 0) { - return $headings[0].dataset.anchor === 'true' ? 'true' : '0'; - } else { - return 'true'; - } - } - } - return this._super(...arguments); - }, }); options.registry.TableOfContentNavbar = options.Class.extend({ diff --git a/addons/website/views/snippets/s_table_of_content.xml b/addons/website/views/snippets/s_table_of_content.xml index 288493da2aa..a0dfa8fc88b 100644 --- a/addons/website/views/snippets/s_table_of_content.xml +++ b/addons/website/views/snippets/s_table_of_content.xml @@ -50,9 +50,7 @@