summaryrefslogtreecommitdiff
path: root/addons/website_event/static/src/js/website_geolocation.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_event/static/src/js/website_geolocation.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_event/static/src/js/website_geolocation.js')
-rw-r--r--addons/website_event/static/src/js/website_geolocation.js41
1 files changed, 41 insertions, 0 deletions
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);
+ }
+ },
+});
+});