diff libervia/server/pages.py @ 1293:de3b15d68bb6

pages: expose `templates_root_url` to scripts
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 16:47:51 +0200
parents 63328c793a9e
children 44da7b118b02
line wrap: on
line diff
--- a/libervia/server/pages.py	Fri Jun 19 16:47:51 2020 +0200
+++ b/libervia/server/pages.py	Fri Jun 19 16:47:51 2020 +0200
@@ -1388,9 +1388,14 @@
                     if key not in template_data:
                         template_data[key] = value
 
+        theme = session_data.theme or self.default_theme
+        self.exposeToScripts(
+            request,
+            templates_root_url=str(self.vhost_root.getFrontURL(theme)))
+
         return self.host.renderer.render(
             self.template,
-            theme=session_data.theme or self.default_theme,
+            theme=theme,
             site_themes=self.site_themes,
             page_url=self.getURL(),
             media_path=f"/{C.MEDIA_DIR}",