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