[IMP] website_links: add link tracker menu item
See merge commit for more information. task-2687506
This commit is contained in:
@@ -22,12 +22,12 @@ Those trackers can be used in Google Analytics to track clicks and visitors, or
|
||||
'website_links/static/src/js/website_links_charts.js',
|
||||
'website_links/static/src/css/website_links.css',
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'website_links/static/src/components/navbar/navbar.js',
|
||||
],
|
||||
'web.assets_tests': [
|
||||
'website_links/static/tests/**/*',
|
||||
],
|
||||
'website.assets_editor': [
|
||||
'website_links/static/src/components/navbar/navbar.js',
|
||||
],
|
||||
'web.assets_qweb': [
|
||||
'website_links/static/src/xml/*.xml',
|
||||
],
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
/**
|
||||
* The purpose of this script is to copy the current URL of the website
|
||||
* into the URL form of the URL shortener (module website_links)
|
||||
* when the user clicks the link "Share this page" on top of the page.
|
||||
*/
|
||||
/** @odoo-module */
|
||||
|
||||
odoo.define('website_links.website_links_menu', function (require) {
|
||||
'use strict';
|
||||
import { patch } from 'web.utils';
|
||||
import { NavBar } from '@web/webclient/navbar/navbar';
|
||||
|
||||
var publicWidget = require('web.public.widget');
|
||||
const { onWillStart } = owl;
|
||||
|
||||
const { registry } = require("@web/core/registry");
|
||||
patch(NavBar.prototype, 'website_links_navbar', {
|
||||
setup() {
|
||||
this._super();
|
||||
|
||||
var WebsiteLinksMenu = publicWidget.Widget.extend({
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
this.$el.attr('href', '/r?u=' + encodeURIComponent(window.location.href));
|
||||
return this._super.apply(this, arguments);
|
||||
onWillStart(() => {
|
||||
this.websiteEditingMenus['website_links.menu_link_tracker'] = {
|
||||
openWidget: () => this.websiteService.goToWebsite({ path: `/r?u=${encodeURIComponent(this.websiteService.contentWindow.location.href)}` }),
|
||||
isDisplayed: () => this.websiteService.currentWebsite,
|
||||
options: () => {},
|
||||
};
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
registry.category("website_navbar_widgets").add("WebsiteLinksMenu", {
|
||||
Widget: WebsiteLinksMenu,
|
||||
selector: '#o_website_links_share_page',
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -10,4 +10,10 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_link_tracker"
|
||||
name="Link Tracker"
|
||||
sequence="5"
|
||||
parent="website.menu_promote"
|
||||
action="website.website_preview"/>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user