Show More
@@ -125,8 +125,8 b' rhodecode.api.url = /_admin/api' | |||
|
125 | 125 | |
|
126 | 126 | full_stack = true |
|
127 | 127 | |
|
128 | ## Serve static files via RhodeCode, disable to serve them via HTTP server | |
|
129 | static_files = true | |
|
128 | ## Return gzipped responses | |
|
129 | gzip_responses = true | |
|
130 | 130 | |
|
131 | 131 | # autogenerate javascript routes file on startup |
|
132 | 132 | generate_js_files = false |
@@ -289,23 +289,7 b' def includeme_last(config):' | |||
|
289 | 289 | The static file catchall needs to be last in the view configuration. |
|
290 | 290 | """ |
|
291 | 291 | settings = config.registry.settings |
|
292 | ||
|
293 | # Note: johbo: I would prefer to register a prefix for static files at some | |
|
294 | # point, e.g. move them under '_static/'. This would fully avoid that we | |
|
295 | # can have name clashes with a repository name. Imaging someone calling his | |
|
296 | # repo "css" ;-) Also having an external web server to serve out the static | |
|
297 | # files seems to be easier to set up if they have a common prefix. | |
|
298 | # | |
|
299 | # Example: config.add_static_view('_static', path='rhodecode:public') | |
|
300 | # | |
|
301 | # It might be an option to register both paths for a while and then migrate | |
|
302 | # over to the new location. | |
|
303 | ||
|
304 | # Serving static files with a catchall. | |
|
305 | if settings['static_files']: | |
|
306 | config.add_route('catchall_static', '/*subpath') | |
|
307 | config.add_view( | |
|
308 | static_view('rhodecode:public'), route_name='catchall_static') | |
|
292 | config.add_static_view('_static', path='rhodecode:public') | |
|
309 | 293 | |
|
310 | 294 | |
|
311 | 295 | def wrap_app_in_wsgi_middlewares(pyramid_app, config): |
@@ -331,10 +315,7 b' def wrap_app_in_wsgi_middlewares(pyramid' | |||
|
331 | 315 | pyramid_app, _ = wrap_in_appenlight_if_enabled( |
|
332 | 316 | pyramid_app, config.registry._pylons_compat_config) |
|
333 | 317 | |
|
334 | # TODO: johbo: Don't really see why we enable the gzip middleware when | |
|
335 | # serving static files, might be something that should have its own setting | |
|
336 | # as well? | |
|
337 | if settings['static_files']: | |
|
318 | if asbool(settings.get('gzip_responses', 'true')): | |
|
338 | 319 | pyramid_app = make_gzip_middleware( |
|
339 | 320 | pyramid_app, settings, compress_level=1) |
|
340 | 321 | |
@@ -377,7 +358,6 b' def sanitize_settings_and_apply_defaults' | |||
|
377 | 358 | settings.setdefault('rhodecode.api.url', '/_admin/api') |
|
378 | 359 | |
|
379 | 360 | _bool_setting(settings, 'vcs.server.enable', 'true') |
|
380 | _bool_setting(settings, 'static_files', 'true') | |
|
381 | 361 | _bool_setting(settings, 'is_test', 'false') |
|
382 | 362 | |
|
383 | 363 | return settings |
@@ -85,12 +85,15 b' from rhodecode.model.settings import Iss' | |||
|
85 | 85 | |
|
86 | 86 | log = logging.getLogger(__name__) |
|
87 | 87 | |
|
88 | ||
|
88 | 89 | DEFAULT_USER = User.DEFAULT_USER |
|
89 | 90 | DEFAULT_USER_EMAIL = User.DEFAULT_USER_EMAIL |
|
90 | 91 | |
|
92 | ||
|
91 | 93 | def url(*args, **kw): |
|
92 | 94 | return pylons_url(*args, **kw) |
|
93 | 95 | |
|
96 | ||
|
94 | 97 | def pylons_url_current(*args, **kw): |
|
95 | 98 | """ |
|
96 | 99 | This function overrides pylons.url.current() which returns the current |
@@ -105,6 +108,19 b' def pylons_url_current(*args, **kw):' | |||
|
105 | 108 | url.current = pylons_url_current |
|
106 | 109 | |
|
107 | 110 | |
|
111 | def asset(path, ver=None): | |
|
112 | """ | |
|
113 | Helper to generate a static asset file path for rhodecode assets | |
|
114 | ||
|
115 | eg. h.asset('images/image.png', ver='3923') | |
|
116 | ||
|
117 | :param path: path of asset | |
|
118 | :param ver: optional version query param to append as ?ver= | |
|
119 | """ | |
|
120 | request = get_current_request() | |
|
121 | return request.static_url('rhodecode:public/{}'.format(path), ver=ver) | |
|
122 | ||
|
123 | ||
|
108 | 124 | def html_escape(text, html_escape_table=None): |
|
109 | 125 | """Produce entities within text.""" |
|
110 | 126 | if not html_escape_table: |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | <div id="header-inner" class="wrapper"> |
|
8 | 8 | <div id="logo"> |
|
9 | 9 | <div class="logo-wrapper"> |
|
10 |
<a href="${h.url('home')}"><img src="${h. |
|
|
10 | <a href="${h.url('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> | |
|
11 | 11 | </div> |
|
12 | 12 | %if c.rhodecode_name: |
|
13 | 13 | <div class="branding">- ${h.branding(c.rhodecode_name)}</div> |
@@ -580,7 +580,7 b'' | |||
|
580 | 580 | % endif |
|
581 | 581 | |
|
582 | 582 | </script> |
|
583 |
<script src="${h. |
|
|
583 | <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script> | |
|
584 | 584 | </%def> |
|
585 | 585 | |
|
586 | 586 | <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
@@ -23,13 +23,13 b" c.template_context['visual']['default_re" | |||
|
23 | 23 | <meta name="robots" content="index, nofollow"/> |
|
24 | 24 | </%def> |
|
25 | 25 | ${self.robots()} |
|
26 |
<link rel="icon" href="${h. |
|
|
26 | <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" /> | |
|
27 | 27 | |
|
28 | 28 | ## CSS definitions |
|
29 | 29 | <%def name="css()"> |
|
30 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
30 | <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/> | |
|
31 | 31 | <!--[if lt IE 9]> |
|
32 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
32 | <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/> | |
|
33 | 33 | <![endif]--> |
|
34 | 34 | ## EXTRA FOR CSS |
|
35 | 35 | ${self.css_extra()} |
@@ -42,7 +42,7 b" c.template_context['visual']['default_re" | |||
|
42 | 42 | |
|
43 | 43 | ## JAVASCRIPT |
|
44 | 44 | <%def name="js()"> |
|
45 |
<script src="${h. |
|
|
45 | <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> | |
|
46 | 46 | <script type="text/javascript"> |
|
47 | 47 | // register templateContext to pass template variables to JS |
|
48 | 48 | var templateContext = ${h.json.dumps(c.template_context)|n}; |
@@ -78,11 +78,11 b" c.template_context['visual']['default_re" | |||
|
78 | 78 | </script> |
|
79 | 79 | |
|
80 | 80 | <!--[if lt IE 9]> |
|
81 |
<script language="javascript" type="text/javascript" src="${h. |
|
|
81 | <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script> | |
|
82 | 82 | <![endif]--> |
|
83 |
<script language="javascript" type="text/javascript" src="${h. |
|
|
84 |
<script language="javascript" type="text/javascript" src="${h. |
|
|
85 |
<script>CodeMirror.modeURL = "${h. |
|
|
83 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script> | |
|
84 | <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script> | |
|
85 | <script>CodeMirror.modeURL = "${h.asset('js/mode/%N/%N.js')}";</script> | |
|
86 | 86 | |
|
87 | 87 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
88 | 88 | ${self.js_extra()} |
@@ -202,7 +202,7 b'' | |||
|
202 | 202 | ${c.pagination.pager('$link_previous ~2~ $link_next')} |
|
203 | 203 | </div> |
|
204 | 204 | |
|
205 |
<script type="text/javascript" src="${h. |
|
|
205 | <script type="text/javascript" src="${h.asset('js/jquery.commits-graph.js')}"></script> | |
|
206 | 206 | <script type="text/javascript"> |
|
207 | 207 | var cache = {}; |
|
208 | 208 | $(function(){ |
@@ -9,11 +9,11 b'' | |||
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | 11 | <%def name="js_extra()"> |
|
12 |
<script type="text/javascript" src="${h. |
|
|
12 | <script type="text/javascript" src="${h.asset('js/mergerly.js')}"></script> | |
|
13 | 13 | </%def> |
|
14 | 14 | |
|
15 | 15 | <%def name="css_extra()"> |
|
16 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
16 | <link rel="stylesheet" type="text/css" href="${h.asset('css/mergerly.css')}"/> | |
|
17 | 17 | </%def> |
|
18 | 18 | |
|
19 | 19 |
@@ -507,7 +507,7 b'' | |||
|
507 | 507 | <td class="td-radio"><input type="radio" value="repository.admin" |
|
508 | 508 | name="u_perm_1" id="u_perm_1_repositoryadmin"></td> |
|
509 | 509 | <td> |
|
510 | <img class="gravatar" src="/images/user30.png" height="16" width="16"> | |
|
510 | <img class="gravatar" src="/_static/images/user30.png" height="16" width="16"> | |
|
511 | 511 | <span class="user">default</span> |
|
512 | 512 | </td> |
|
513 | 513 | <td></td> |
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | <title>Error - ${c.error_message}</title> |
|
6 | 6 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
|
7 | 7 | <meta name="robots" content="index, nofollow"/> |
|
8 |
<link rel="icon" href="${h. |
|
|
8 | <link rel="icon" href="${h.asset('images/favicon.ico')}" sizes="16x16 32x32" type="image/png" /> | |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
@@ -13,20 +13,20 b'' | |||
|
13 | 13 | <meta http-equiv="refresh" content="${c.redirect_time}; url=${c.url_redirect}"/> |
|
14 | 14 | %endif |
|
15 | 15 | |
|
16 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
16 | <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css')}" media="screen"/> | |
|
17 | 17 | <!--[if IE]> |
|
18 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
18 | <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css')}" media="screen"/> | |
|
19 | 19 | <![endif]--> |
|
20 | 20 | <style>body { background:#eeeeee; }</style> |
|
21 | 21 | |
|
22 |
<script type="text/javascript" src="${h. |
|
|
22 | <script type="text/javascript" src="${h.asset('js/scripts.js')}"></script> | |
|
23 | 23 | </head> |
|
24 | 24 | <body> |
|
25 | 25 | <%include file="/base/flash_msg.html"/> |
|
26 | 26 | |
|
27 | 27 | <div class="wrapper error_page"> |
|
28 | 28 | <div class="sidebar"> |
|
29 |
<a href="${h.url('home')}"><img class="error-page-logo" src="${h. |
|
|
29 | <a href="${h.url('home')}"><img class="error-page-logo" src="${h.asset('images/RhodeCode_Logo_Black.png')}" alt="RhodeCode"/></a> | |
|
30 | 30 | </div> |
|
31 | 31 | <div class="main-content"> |
|
32 | 32 | <h1> |
@@ -4,11 +4,11 b'' | |||
|
4 | 4 | <%namespace name="diff_block" file="/changeset/diff_block.html"/> |
|
5 | 5 | |
|
6 | 6 | <%def name="js_extra()"> |
|
7 |
<script type="text/javascript" src="${h. |
|
|
7 | <script type="text/javascript" src="${h.asset('js/mergerly.js')}"></script> | |
|
8 | 8 | </%def> |
|
9 | 9 | |
|
10 | 10 | <%def name="css_extra()"> |
|
11 |
<link rel="stylesheet" type="text/css" href="${h. |
|
|
11 | <link rel="stylesheet" type="text/css" href="${h.asset('css/mergerly.css')}"/> | |
|
12 | 12 | </%def> |
|
13 | 13 | |
|
14 | 14 | <%def name="title()"> |
@@ -14,7 +14,7 b'' | |||
|
14 | 14 | <div id="header-inner" class="title"> |
|
15 | 15 | <div id="logo"> |
|
16 | 16 | <div class="logo-wrapper"> |
|
17 |
<a href="${h.url('home')}"><img src="${h. |
|
|
17 | <a href="${h.url('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> | |
|
18 | 18 | </div> |
|
19 | 19 | %if c.rhodecode_name: |
|
20 | 20 | <div class="branding"> ${h.branding(c.rhodecode_name)}</div> |
@@ -25,7 +25,7 b'' | |||
|
25 | 25 | |
|
26 | 26 | <div class="loginwrapper"> |
|
27 | 27 | <div class="left-column"> |
|
28 |
<img class="sign-in-image" src="${h. |
|
|
28 | <img class="sign-in-image" src="${h.asset('images/sign-in.png')}" alt="RhodeCode"/> | |
|
29 | 29 | </div> |
|
30 | 30 | <%block name="above_login_button" /> |
|
31 | 31 | <div id="login" class="right-column"> |
@@ -14,7 +14,7 b'' | |||
|
14 | 14 | <div id="header-inner" class="title"> |
|
15 | 15 | <div id="logo"> |
|
16 | 16 | <div class="logo-wrapper"> |
|
17 |
<a href="${h.url('home')}"><img src="${h. |
|
|
17 | <a href="${h.url('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> | |
|
18 | 18 | </div> |
|
19 | 19 | %if c.rhodecode_name: |
|
20 | 20 | <div class="branding"> ${h.branding(c.rhodecode_name)}</div> |
@@ -25,7 +25,7 b'' | |||
|
25 | 25 | |
|
26 | 26 | <div class="loginwrapper"> |
|
27 | 27 | <div class="left-column"> |
|
28 |
<img class="sign-in-image" src="${h. |
|
|
28 | <img class="sign-in-image" src="${h.asset('images/sign-in.png')}" alt="RhodeCode"/> | |
|
29 | 29 | </div> |
|
30 | 30 | |
|
31 | 31 | <div id="register" class="right-column"> |
@@ -14,7 +14,7 b'' | |||
|
14 | 14 | <div id="header-inner" class="title"> |
|
15 | 15 | <div id="logo"> |
|
16 | 16 | <div class="logo-wrapper"> |
|
17 |
<a href="${h.url('home')}"><img src="${h. |
|
|
17 | <a href="${h.url('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> | |
|
18 | 18 | </div> |
|
19 | 19 | %if c.rhodecode_name: |
|
20 | 20 | <div class="branding"> ${h.branding(c.rhodecode_name)}</div> |
@@ -25,7 +25,7 b'' | |||
|
25 | 25 | |
|
26 | 26 | <div class="loginwrapper"> |
|
27 | 27 | <div class="left-column"> |
|
28 |
<img class="sign-in-image" src="${h. |
|
|
28 | <img class="sign-in-image" src="${h.asset('images/sign-in.png')}" alt="RhodeCode"/> | |
|
29 | 29 | </div> |
|
30 | 30 | <%block name="above_register_button" /> |
|
31 | 31 | <div id="register" class="right-column"> |
General Comments 0
You need to be logged in to leave comments.
Login now