summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/post_link.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website/static/src/js/post_link.js')
-rw-r--r--addons/website/static/src/js/post_link.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/website/static/src/js/post_link.js b/addons/website/static/src/js/post_link.js
new file mode 100644
index 00000000..222216e5
--- /dev/null
+++ b/addons/website/static/src/js/post_link.js
@@ -0,0 +1,25 @@
+odoo.define('website.post_link', function (require) {
+'use strict';
+
+const publicWidget = require('web.public.widget');
+const wUtils = require('website.utils');
+
+publicWidget.registry.postLink = publicWidget.Widget.extend({
+ selector: '.post_link',
+ events: {
+ 'click': '_onClickPost',
+ },
+ _onClickPost: function (ev) {
+ ev.preventDefault();
+ const url = this.el.dataset.post || this.el.href;
+ let data = {};
+ for (let [key, value] of Object.entries(this.el.dataset)) {
+ if (key.startsWith('post_')) {
+ data[key.slice(5)] = value;
+ }
+ };
+ wUtils.sendRequest(url, data);
+ },
+});
+
+});