diff options
Diffstat (limited to 'addons/website_event/static/src/js/website_geolocation.js')
| -rw-r--r-- | addons/website_event/static/src/js/website_geolocation.js | 41 |
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); + } + }, +}); +}); |
