Define BASE_URL and DATA_URL js variables in the login template. Closes #13385185
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 01 Jun 2016 15:17:09 +0200
changeset 11296 5153f6fd478e
parent 11295 00d42916f238
child 11297 ee57b07553f6
Define BASE_URL and DATA_URL js variables in the login template. Closes #13385185 Those are expected to be defined in almost every js files. They were not before this patch because login form doesn't use the regular main template.
web/views/basetemplates.py
--- a/web/views/basetemplates.py	Fri Jun 10 13:21:31 2016 +0200
+++ b/web/views/basetemplates.py	Wed Jun 01 15:17:09 2016 +0200
@@ -46,6 +46,8 @@
         w(u'</body>')
 
     def template_header(self, content_type, view=None, page_title='', additional_headers=()):
+        self._cw.html_headers.define_var('BASE_URL', self._cw.base_url())
+        self._cw.html_headers.define_var('DATA_URL', self._cw.datadir_url)
         w = self.whead
         # explictly close the <base> tag to avoid IE 6 bugs while browsing DOM
         w(u'<base href="%s"></base>' % xml_escape(self._cw.base_url()))