Show More
@@ -640,8 +640,8 b' class PullrequestsController(BaseRepoCon' | |||
|
640 | 640 | pull_request_id = safe_int(pull_request_id) |
|
641 | 641 | c.pull_request = PullRequest.get_or_404(pull_request_id) |
|
642 | 642 | |
|
643 | if hasattr(c, 'pylons_dispatch_info'): | |
|
644 | c.pylons_dispatch_info['extra']['pull_request'] = pull_request_id | |
|
643 | c.template_context['pull_request_data']['pull_request_id'] = \ | |
|
644 | pull_request_id | |
|
645 | 645 | |
|
646 | 646 | # pull_requests repo_name we opened it against |
|
647 | 647 | # ie. target_repo must match |
@@ -425,9 +425,29 b' class BaseController(WSGIController):' | |||
|
425 | 425 | _route_name = '.'.join([environ['pylons.routes_dict']['controller'], |
|
426 | 426 | environ['pylons.routes_dict']['action']]) |
|
427 | 427 | |
|
428 | c.pylons_dispatch_info = { | |
|
428 | c.template_context = { | |
|
429 | 'repo_name': None, | |
|
430 | 'repo_type': None, | |
|
431 | 'repo_landing_commit': None, | |
|
432 | 'rhodecode_user': { | |
|
433 | 'username': None, | |
|
434 | 'email': None, | |
|
435 | }, | |
|
436 | 'visual': { | |
|
437 | 'default_renderer': None | |
|
438 | }, | |
|
439 | 'commit_data': { | |
|
440 | 'commit_id': None | |
|
441 | }, | |
|
442 | 'pull_request_data': {'pull_request_id': None}, | |
|
443 | 'timeago': { | |
|
444 | 'refresh_time': 120 * 1000, | |
|
445 | 'cutoff_limit': 1000*60*60*24*7 | |
|
446 | }, | |
|
447 | 'pylons_dispatch':{ | |
|
429 | 448 | 'controller': environ['pylons.routes_dict']['controller'], |
|
430 | 449 | 'action': environ['pylons.routes_dict']['action'], |
|
450 | }, | |
|
431 | 451 | 'extra': {'plugins': {}} |
|
432 | 452 | } |
|
433 | 453 |
@@ -1,55 +1,19 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <!DOCTYPE html> |
|
3 | 3 | |
|
4 | <%def name="get_template_context()" filter="n, trim">{ | |
|
5 | ||
|
6 | ## repo data | |
|
7 | repo_name: "${getattr(c, 'repo_name', '')}", | |
|
8 | % if hasattr(c, 'rhodecode_db_repo'): | |
|
9 | repo_type: "${c.rhodecode_db_repo.repo_type}", | |
|
10 | repo_landing_commit: "${c.rhodecode_db_repo.landing_rev[1]}", | |
|
11 | % else: | |
|
12 | repo_type: null, | |
|
13 | repo_landing_commit: null, | |
|
14 | % endif | |
|
4 | <% | |
|
5 | c.template_context['repo_name'] = getattr(c, 'repo_name', '') | |
|
15 | 6 | |
|
16 | ## user data | |
|
17 | % if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id: | |
|
18 | rhodecode_user: { | |
|
19 | username: "${c.rhodecode_user.username}", | |
|
20 | email: "${c.rhodecode_user.email}", | |
|
21 | }, | |
|
22 | % else: | |
|
23 | rhodecode_user: { | |
|
24 | username: null, | |
|
25 | email: null, | |
|
26 | }, | |
|
27 | % endif | |
|
7 | if hasattr(c, 'rhodecode_db_repo'): | |
|
8 | c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type | |
|
9 | c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1] | |
|
28 | 10 | |
|
29 | ## visual settings | |
|
30 | visual: { | |
|
31 | default_renderer: "${h.get_visual_attr(c, 'default_renderer')}" | |
|
32 | }, | |
|
33 | ||
|
34 | ## current commit context, filled inside templates that expose that | |
|
35 | commit_data: { | |
|
36 | commit_id: null, | |
|
37 | }, | |
|
11 | if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id: | |
|
12 | c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username | |
|
13 | c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email | |
|
38 | 14 | |
|
39 | ## current pr context, filled inside templates that expose that | |
|
40 | pull_request_data: { | |
|
41 | pull_request_id: null, | |
|
42 | }, | |
|
43 | ||
|
44 | ## timeago settings, can be overwritten by custom user settings later | |
|
45 | timeago: { | |
|
46 | refresh_time: ${120 * 1000}, | |
|
47 | cutoff_limit: ${1000*60*60*24*7} | |
|
48 | }, | |
|
49 | dispatch_info: ${h.json.dumps(getattr(c, 'pylons_dispatch_info', {}))|n} | |
|
50 | } | |
|
51 | ||
|
52 | </%def> | |
|
15 | c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer') | |
|
16 | %> | |
|
53 | 17 | |
|
54 | 18 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
55 | 19 | <head> |
@@ -81,7 +45,7 b'' | |||
|
81 | 45 | <script src="${h.url('/js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> |
|
82 | 46 | <script type="text/javascript"> |
|
83 | 47 | // register templateContext to pass template variables to JS |
|
84 |
var templateContext = ${ |
|
|
48 | var templateContext = ${h.json.dumps(c.template_context)|n}; | |
|
85 | 49 | |
|
86 | 50 | var REPO_NAME = "${getattr(c, 'repo_name', '')}"; |
|
87 | 51 | %if hasattr(c, 'rhodecode_db_repo'): |
General Comments 0
You need to be logged in to leave comments.
Login now