##// END OF EJS Templates
polymer: initialize as soon as possible
ergo -
r690:a5fa0fb1 default
parent child Browse files
Show More
@@ -1,157 +1,158 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <!DOCTYPE html>
3 3
4 4 <%
5 5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6 6
7 7 if hasattr(c, 'rhodecode_db_repo'):
8 8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10 10
11 11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
12 12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
13 13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
14 14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
15 15
16 16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
17 17 %>
18 18 <html xmlns="http://www.w3.org/1999/xhtml">
19 19 <head>
20 20 <title>${self.title()}</title>
21 21 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
22 22 <%def name="robots()">
23 23 <meta name="robots" content="index, nofollow"/>
24 24 </%def>
25 25 ${self.robots()}
26 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 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 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()}
36 36 </%def>
37 37 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
38 38 <%def name="css_extra()">
39 39 </%def>
40 40
41 41 ${self.css()}
42 42
43 43 ## JAVASCRIPT
44 44 <%def name="js()">
45 <script>
46 // setup Polymer options
47 window.Polymer = {lazyRegister: true, dom: 'shadow'};
48
49 // load webcomponents polyfills
50 (function() {
51 if ('registerElement' in document
52 && 'import' in document.createElement('link')
53 && 'content' in document.createElement('template')) {
54 // browser has web components
55 } else {
56 // polyfill web components
57 var e = document.createElement('script');
58 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
59 document.head.appendChild(e);
60 }
61 })();
62 </script>
63 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}" async>
64
45 65 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
46 66 <script type="text/javascript">
47 67 // register templateContext to pass template variables to JS
48 68 var templateContext = ${h.json.dumps(c.template_context)|n};
49 69
50 70 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
51 71 %if hasattr(c, 'rhodecode_db_repo'):
52 72 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
53 73 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
54 74 %else:
55 75 var REPO_LANDING_REV = '';
56 76 var REPO_TYPE = '';
57 77 %endif
58 78 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
59 79 var ASSET_URL = "${h.asset('')}";
60 80 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
61 81 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
62 82 % if getattr(c, 'rhodecode_user', None):
63 83 var USER = {name:'${c.rhodecode_user.username}'};
64 84 % else:
65 85 var USER = {name:null};
66 86 % endif
67 87
68 88 var APPENLIGHT = {
69 89 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
70 90 key: '${getattr(c, "appenlight_api_public_key", "")}',
71 91 % if getattr(c, 'appenlight_server_url', None):
72 92 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
73 93 % endif
74 94 requestInfo: {
75 95 % if getattr(c, 'rhodecode_user', None):
76 96 ip: '${c.rhodecode_user.ip_addr}',
77 97 username: '${c.rhodecode_user.username}'
78 98 % endif
79 99 }
80 100 };
81 101 </script>
82 102 <!--[if lt IE 9]>
83 103 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
84 104 <![endif]-->
85 <script>
86 // setup Polymer options
87 window.Polymer = {lazyRegister: true, dom: 'shadow'};
88
89 // load webcomponents polyfills
90 (function() {
91 if ('registerElement' in document
92 && 'import' in document.createElement('link')
93 && 'content' in document.createElement('template')) {
94 // browser has web components
95 } else {
96 // polyfill web components
97 var e = document.createElement('script');
98 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
99 document.head.appendChild(e);
100 }
101 })();
102 </script>
103 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
104 105 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
105 106 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
106 107 ## avoide escaping the %N
107 108 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
108 109
109 110
110 111 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
111 112 ${self.js_extra()}
112 113
113 114 <script type="text/javascript">
114 115 $(document).ready(function(){
115 116 show_more_event();
116 117 timeagoActivate();
117 118 })
118 119 </script>
119 120
120 121 </%def>
121 122
122 123 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
123 124 <%def name="js_extra()"></%def>
124 125 ${self.js()}
125 126
126 127 <%def name="head_extra()"></%def>
127 128 ${self.head_extra()}
128 129 <%include file="/base/plugins_base.html"/>
129 130
130 131 ## extra stuff
131 132 %if c.pre_code:
132 133 ${c.pre_code|n}
133 134 %endif
134 135 </head>
135 136 <body id="body">
136 137 <noscript>
137 138 <div class="noscript-error">
138 139 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
139 140 </div>
140 141 </noscript>
141 142 ## IE hacks
142 143 <!--[if IE 7]>
143 144 <script>$(document.body).addClass('ie7')</script>
144 145 <![endif]-->
145 146 <!--[if IE 8]>
146 147 <script>$(document.body).addClass('ie8')</script>
147 148 <![endif]-->
148 149 <!--[if IE 9]>
149 150 <script>$(document.body).addClass('ie9')</script>
150 151 <![endif]-->
151 152
152 153 ${next.body()}
153 154 %if c.post_code:
154 155 ${c.post_code|n}
155 156 %endif
156 157 </body>
157 158 </html>
General Comments 0
You need to be logged in to leave comments. Login now