diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-07-10 14:11:32 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-07-14 14:43:16 +0000 |
| commit | 20249d316edc4a9deb3d379587e072a413acd0a2 (patch) | |
| tree | cf6ebd2e87b5e7d3511ed6d334872d984f90867d /addons | |
| parent | b4ce6fbc01e9c49bfc00a64627a4ac1fac2c9ab2 (diff) | |
[IMP] website: remove animate scrolling option for table of content
Part of https://github.com/odoo/odoo/pull/53930
task-2157252
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website/static/src/snippets/s_table_of_content/options.js | 35 | ||||
| -rw-r--r-- | addons/website/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 @@ -29,22 +28,6 @@ options.registry.TableOfContent = options.Class.extend({ }, //-------------------------------------------------------------------------- - // 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 @@ <template id="s_table_of_content_options" inherit_id="website.snippet_options"> <xpath expr="." position="inside"> - <div data-js="TableOfContent" data-selector=".s_table_of_content"> - <we-checkbox string="Animate Scrolling" data-animate-scrolling="true" data-no-preview="true"/> - </div> + <div data-js="TableOfContent" data-selector=".s_table_of_content"/> <div data-js="TableOfContentNavbar" data-selector=".s_table_of_content_navbar_wrap"> <we-button-group string="Position"> <we-button title="Left" data-navbar-position="left"><i class="fa fa-fw fa-long-arrow-left"/></we-button> |
