##// END OF EJS Templates
static: bring back ver=XXX for proper flushing caches when version is upgraded....
marcink -
r537:6c4e8fd9 default
parent child Browse files
Show More
@@ -118,7 +118,8 b' def asset(path, ver=None):'
118 :param ver: optional version query param to append as ?ver=
118 :param ver: optional version query param to append as ?ver=
119 """
119 """
120 request = get_current_request()
120 request = get_current_request()
121 return request.static_url('rhodecode:public/{}'.format(path), ver=ver)
121 return request.static_url(
122 'rhodecode:public/{}'.format(path), _query={'ver': ver})
122
123
123
124
124 def html_escape(text, html_escape_table=None):
125 def html_escape(text, html_escape_table=None):
@@ -85,8 +85,8 b" c.template_context['visual']['default_re"
85 <![endif]-->
85 <![endif]-->
86 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
86 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
87 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
87 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
88 ## avoide esaping the %N
88 ## avoide escaping the %N
89 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js'}";</script>
89 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
90
90
91
91
92 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
92 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
@@ -9,11 +9,11 b''
9 </%def>
9 </%def>
10
10
11 <%def name="js_extra()">
11 <%def name="js_extra()">
12 <script type="text/javascript" src="${h.asset('js/mergerly.js')}"></script>
12 <script type="text/javascript" src="${h.asset('js/mergerly.js', ver=c.rhodecode_version_hash)}"></script>
13 </%def>
13 </%def>
14
14
15 <%def name="css_extra()">
15 <%def name="css_extra()">
16 <link rel="stylesheet" type="text/css" href="${h.asset('css/mergerly.css')}"/>
16 <link rel="stylesheet" type="text/css" href="${h.asset('css/mergerly.css', ver=c.rhodecode_version_hash)}"/>
17 </%def>
17 </%def>
18
18
19
19
@@ -13,13 +13,13 b''
13 <meta http-equiv="refresh" content="${c.redirect_time}; url=${c.url_redirect}"/>
13 <meta http-equiv="refresh" content="${c.redirect_time}; url=${c.url_redirect}"/>
14 %endif
14 %endif
15
15
16 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css')}" media="screen"/>
16 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
17 <!--[if IE]>
17 <!--[if IE]>
18 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css')}" media="screen"/>
18 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css')}" media="screen"/>
19 <![endif]-->
19 <![endif]-->
20 <style>body { background:#eeeeee; }</style>
20 <style>body { background:#eeeeee; }</style>
21
21
22 <script type="text/javascript" src="${h.asset('js/scripts.js')}"></script>
22 <script type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
23 </head>
23 </head>
24 <body>
24 <body>
25 <%include file="/base/flash_msg.html"/>
25 <%include file="/base/flash_msg.html"/>
@@ -22,6 +22,7 b' import json'
22
22
23 from mock import patch
23 from mock import patch
24 import pytest
24 import pytest
25 from pylons import tmpl_context as c
25
26
26 import rhodecode
27 import rhodecode
27 from rhodecode.lib.utils import map_groups
28 from rhodecode.lib.utils import map_groups
@@ -49,6 +50,14 b' class TestHomeController(TestController)'
49 for repo in Repository.getAll():
50 for repo in Repository.getAll():
50 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
51 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
51
52
53 def test_index_contains_statics_with_ver(self):
54 self.log_user()
55 response = self.app.get(url(controller='home', action='index'))
56
57 rhodecode_version_hash = c.rhodecode_version_hash
58 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
59 response.mustcontain('scripts.js?ver={0}'.format(rhodecode_version_hash))
60
52 def test_index_contains_backend_specific_details(self, backend):
61 def test_index_contains_backend_specific_details(self, backend):
53 self.log_user()
62 self.log_user()
54 response = self.app.get(url(controller='home', action='index'))
63 response = self.app.get(url(controller='home', action='index'))
General Comments 0
You need to be logged in to leave comments. Login now