From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../static/src/js/website_geolocation.js | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 addons/website_event/static/src/js/website_geolocation.js (limited to 'addons/website_event/static/src/js/website_geolocation.js') diff --git a/addons/website_event/static/src/js/website_geolocation.js b/addons/website_event/static/src/js/website_geolocation.js new file mode 100644 index 00000000..0c93dbbb --- /dev/null +++ b/addons/website_event/static/src/js/website_geolocation.js @@ -0,0 +1,41 @@ +odoo.define('website_event.geolocation', function (require) { +'use strict'; + +var publicWidget = require('web.public.widget'); + +publicWidget.registry.visitor = publicWidget.Widget.extend({ + selector: ".oe_country_events, .country_events", + disabledInEditableMode: false, + + /** + * @override + */ + start: function () { + var defs = [this._super.apply(this, arguments)]; + var self = this; + var $eventList = this.$('.country_events_list'); + this._originalContent = $eventList[0].outerHTML; + defs.push(this._rpc({route: '/event/get_country_event_list'}).then(function (data) { + if (data) { + self._$loadedContent = $(data); + + self._$loadedContent.attr('contentEditable', false); + self._$loadedContent.addClass('o_temp_auto_element'); + self._$loadedContent.attr('data-temp-auto-element-original-content', self._originalContent); + + $eventList.replaceWith(self._$loadedContent); + } + })); + return Promise.all(defs); + }, + /** + * @override + */ + destroy: function () { + this._super.apply(this, arguments); + if (this._$loadedContent) { + this._$loadedContent.replaceWith(this._originalContent); + } + }, +}); +}); -- cgit v1.2.3