[11.0][MIG] website snippet anchor#420
Conversation
Remove unused keys from manifest. Enable the posibility to link only to an anchor. Update all dependencies from an anchor too. This makes carousels work again when changing their anchor, and makes Odoo save changed anchors even when no visible changes are made on the elements.
website_snippet_anchor/README.rst
Outdated
|
|
||
| .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
| :alt: Try me on Runbot | ||
| :target: https://runbot.odoo-community.org/runbot/186/10.0 |
| "summary": "Allow to reach a concrete section in the page", | ||
| "version": "11.0.1.0.0", | ||
| "category": "Website", | ||
| "website": "https://www.tecnativa.com", |
|
@simahawk Thanks, I've applied your comments. |
|
LGTM 👍 |
yajo
left a comment
There was a problem hiding this comment.
Functionally tested and it works.
Some migration remarks though.
| var url = this.data.url || "", | ||
| url_parts = url.split("#", 2); | ||
| if (url_parts.length > 1) { | ||
| console.log(url_parts); |
| <li data-anchor_ask="" | ||
| data-only="click" | ||
| title="Use anchors to go directly to a section of your page, appending #anchor to the URL"> | ||
| <li title="Use anchors to go directly to a section of your page, appending #anchor to the URL"> |
There was a problem hiding this comment.
I prefer the previous way, since it just follows the standard for snippet options. Please restore it if possible.
yajo
left a comment
There was a problem hiding this comment.
I think you're changing things because of taste before understanding how the snippet options api works... 🤔
| <xpath expr="//div[@id='snippet_options']" position="inside"> | ||
| <div data-js="anchor" | ||
| data-selector="section, .carousel"> | ||
| <li data-anchor_ask="" |
There was a problem hiding this comment.
There was a data-only="click" here before. Leave it as it was if you want to avoid hover events.
There was a problem hiding this comment.
No, this attribute is not implemented anymore. I'll use the new data-no-preview="true" instead.
|
|
||
| anchor_ask: function(type) { | ||
| if(type !== false) { | ||
| return; |
There was a problem hiding this comment.
Since the good result is a deferred, it makes more sense to return $.Deferred().reject() when failing. Leave as it was please.
| options.registry.anchor = options.Class.extend({ | ||
|
|
||
| anchor_ask: function(type) { | ||
| if(type !== false) { |
There was a problem hiding this comment.
type is the event type. You want to react only in click event, so leave it as it was: if (type !== "event")
There was a problem hiding this comment.
No, when on click type is in 11.0 false. I'll remove it when I apply the attribute data-no-preview
|
@yajo I know how the options for snippets work... Do not try to assume things next time. |
|
Yikes, then it was me that didn't know the api changes on v11! Thanks, didn't want to bother you 😇 |
yajo
left a comment
There was a problem hiding this comment.
Perfect. Please squash migration commits to merge 😊
[FIX] Fixed minor template / migration issues [IMP] Use standard Odoo options mechanic [REM] unused start function [IMP] Use data-no-preview [FIX] new line after list (README)
No description provided.