From 081b4ce84ba269b88ccfbdbb7d62985095183650 Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Tue, 21 Jun 2022 07:36:32 +0000 Subject: [PATCH] [FIX] website: split s_countdown templates into specific files The s_countdown snippet had 2 templates defined inside one file (000.xml): - One for showing a redirect message which is rendered in the public widget flow. - Another for showing an end message which is rendered and appended to the snippet in the option flow. The templates were loaded by the public widget, which means that even if no end message was shown, the template would be downloaded for a visitor. This commit fixes that by splitting the file in 2, one for the options and one for the public widget, ensuring that the option will load what it needs. (This is necessary for the task mentioned below, which moves the edition to the backend, preventing the option from relying on a public widget template.) task-2687506 closes odoo/odoo#94118 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/snippets/s_countdown/000.xml | 20 --------------- .../src/snippets/s_countdown/options.js | 1 + .../src/snippets/s_countdown/options.xml | 25 +++++++++++++++++++ 3 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 addons/website/static/src/snippets/s_countdown/options.xml diff --git a/addons/website/static/src/snippets/s_countdown/000.xml b/addons/website/static/src/snippets/s_countdown/000.xml index 91ee692de87..ba461dedf2b 100644 --- a/addons/website/static/src/snippets/s_countdown/000.xml +++ b/addons/website/static/src/snippets/s_countdown/000.xml @@ -3,24 +3,4 @@

Time's up! You can now visit this page.

- -
-
-
-
-

Happy Odoo Anniversary!

-

As promised, we will offer 4 free tickets to our next summit.
Visit our Facebook page to know if you are one of the lucky winners.

-


-
-
-
- Countdown is over - Firework -
-
-
-
-
-
-
-
diff --git a/addons/website/static/src/snippets/s_countdown/options.js b/addons/website/static/src/snippets/s_countdown/options.js index 6a8979ae2f8..77e88cc1933 100644 --- a/addons/website/static/src/snippets/s_countdown/options.js +++ b/addons/website/static/src/snippets/s_countdown/options.js @@ -8,6 +8,7 @@ const CountdownWidget = require('website.s_countdown'); const qweb = core.qweb; options.registry.countdown = options.Class.extend({ + xmlDependencies: ['/website/static/src/snippets/s_countdown/options.xml'], events: _.extend({}, options.Class.prototype.events || {}, { 'click .toggle-edit-message': '_onToggleEndMessageClick', }), diff --git a/addons/website/static/src/snippets/s_countdown/options.xml b/addons/website/static/src/snippets/s_countdown/options.xml new file mode 100644 index 00000000000..90c3b6bdaaf --- /dev/null +++ b/addons/website/static/src/snippets/s_countdown/options.xml @@ -0,0 +1,25 @@ + + + + +
+
+
+
+

Happy Odoo Anniversary!

+

As promised, we will offer 4 free tickets to our next summit.
Visit our Facebook page to know if you are one of the lucky winners.

+


+
+
+
+ Countdown is over - Firework +
+
+
+
+
+
+
+
+ +