Browse Source

[MIG] website_anchor_smooth_scroll: Migration to 11.0

pull/412/head
Nicolas JEUDY 1 year ago
parent
commit
efdbd02fd2

+ 2
- 1
website_anchor_smooth_scroll/__manifest__.py View File

@@ -5,11 +5,12 @@
'name': 'Smooth Scroll for Website Anchors',
'summary': 'Replace default behavior for internal links (anchor only) with'
' smooth scroll',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Website',
'website': 'https://www.tecnativa.com',
'author': 'Tecnativa, '
'LasLabs, '
'Nicolas JEUDY, '
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,

+ 15
- 9
website_anchor_smooth_scroll/demo/pages.xml View File

@@ -2,10 +2,9 @@
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<odoo>

<template id="demo_page" page="True" name="Anchor smooth scroll demo">
<template id="demo_page_view" name="Anchor smooth scroll demo">
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<section class="jumbotron mt16 mb16" id="top">
@@ -31,7 +30,7 @@
<img
alt="Odoo CMS - a big picture"
class="img img-responsive"
src="/website/static/src/img/big_picture.png"/>
src="/website/static/src/img/backgrounds/building-profile.jpg"/>
</div>
</div>
</div>
@@ -46,7 +45,7 @@
<img
alt="Odoo CMS - a big picture"
class="img img-responsive"
src="/website/static/src/img/big_picture.png"/>
src="/website/static/src/img/backgrounds/building-profile.jpg"/>
</div>
</div>
</div>
@@ -68,12 +67,19 @@
</t>
</template>

<record id="demo_page_link" model="website.menu">
<field name="name">Anchor smooth scroll demo</field>
<record id="demo_page" model="website.page">
<field name="website_published">True</field>
<field name="url">/page/website_anchor_smooth_scroll.demo_page</field>
<field name="view_id" ref="demo_page_view" />
</record>

<record id="menu_demo_page" model="website.menu">
<field name="name">Anchor smooth scroll demo</field>
<field name="url">page/website_anchor_smooth_scroll.demo_page</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">50</field>
<field name="website_id" ref="website.default_website"/>
<field name="page_id" ref="demo_page"/>
</record>

</data>
</openerp>
</odoo>

+ 6
- 5
website_anchor_smooth_scroll/static/src/js/website_anchor_smooth_scroll.js View File

@@ -1,11 +1,11 @@
/* © 2016 Antiun Ingeniería S.L. - Jairo Llopis
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('website_anchor_smooth_scroll.website_anchor_smooth_scroll', function (require) {

"use strict";

function website_anchor_smooth_scroll(event) {
event.preventDefault();

var target = $(event.target.hash);

return $('html, body')
@@ -19,7 +19,8 @@ function website_anchor_smooth_scroll(event) {
});
}

(function ($) {
// Apply to all links that start with `#`
$("a[href^='#']").live("click", website_anchor_smooth_scroll);
})(jQuery);
require('web.dom_ready');

$("a[href^='#']:not([href=#])").on("click", website_anchor_smooth_scroll);

});

+ 2
- 5
website_anchor_smooth_scroll/views/assets.xml View File

@@ -2,9 +2,7 @@
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<odoo>
<template id="assets_frontend"
name="Module name frontend assets"
inherit_id="website.assets_frontend">
@@ -14,5 +12,4 @@
</xpath>
</template>

</data>
</openerp>
</odoo>

Loading…
Cancel
Save