summaryrefslogtreecommitdiff
path: root/addons/website_links/static/src/js/website_links_menu.js
blob: 6f673223720c93c34623a57cb9b6929ffcab2121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * 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.define('website_links.website_links_menu', function (require) {
'use strict';

var publicWidget = require('web.public.widget');
var websiteNavbarData = require('website.navbar');

var WebsiteLinksMenu = publicWidget.Widget.extend({

    /**
     * @override
     */
    start: function () {
        this.$el.attr('href', '/r?u=' + encodeURIComponent(window.location.href));
        return this._super.apply(this, arguments);
    },
});

websiteNavbarData.websiteNavbarRegistry.add(WebsiteLinksMenu, '#o_website_links_share_page');

});