Show More
@@ -1,187 +1,195 b'' | |||||
1 | module.exports = function(grunt) { |
|
1 | module.exports = function(grunt) { | |
2 | grunt.initConfig({ |
|
2 | grunt.initConfig({ | |
3 |
|
3 | |||
4 | dirs: { |
|
4 | dirs: { | |
5 | css: "rhodecode/public/css", |
|
5 | css: "rhodecode/public/css", | |
6 | js: { |
|
6 | js: { | |
7 | "src": "rhodecode/public/js/src", |
|
7 | "src": "rhodecode/public/js/src", | |
8 | "dest": "rhodecode/public/js" |
|
8 | "dest": "rhodecode/public/js" | |
9 | } |
|
9 | } | |
10 | }, |
|
10 | }, | |
11 | copy: { |
|
11 | copy: { | |
12 | main: { |
|
12 | main: { | |
13 | expand: true, |
|
13 | expand: true, | |
14 | cwd: 'bower_components', |
|
14 | cwd: 'bower_components', | |
15 | src: 'webcomponentsjs/webcomponents-lite.js', |
|
15 | src: 'webcomponentsjs/webcomponents-lite.js', | |
16 | dest: '<%= dirs.js.dest %>/vendors', |
|
16 | dest: '<%= dirs.js.dest %>/vendors', | |
17 | }, |
|
17 | }, | |
18 | }, |
|
18 | }, | |
19 | concat: { |
|
19 | concat: { | |
20 | polymercss:{ |
|
20 | polymercss:{ | |
21 | src: [ |
|
21 | src: [ | |
22 | // Base libraries |
|
22 | // Base libraries | |
23 | '<%= dirs.js.src %>/components/root-styles-prefix.html', |
|
23 | '<%= dirs.js.src %>/components/root-styles-prefix.html', | |
24 | '<%= dirs.css %>/style-polymer.css', |
|
24 | '<%= dirs.css %>/style-polymer.css', | |
25 | '<%= dirs.js.src %>/components/root-styles-suffix.html' |
|
25 | '<%= dirs.js.src %>/components/root-styles-suffix.html' | |
26 | ], |
|
26 | ], | |
27 | dest: '<%= dirs.js.dest %>/src/components/root-styles.gen.html', |
|
27 | dest: '<%= dirs.js.dest %>/src/components/root-styles.gen.html', | |
28 | nonull: true |
|
28 | nonull: true | |
29 | }, |
|
29 | }, | |
30 | dist: { |
|
30 | dist: { | |
31 | src: [ |
|
31 | src: [ | |
32 | // Base libraries |
|
32 | // Base libraries | |
33 | '<%= dirs.js.src %>/jquery-1.11.1.min.js', |
|
33 | '<%= dirs.js.src %>/jquery-1.11.1.min.js', | |
34 | '<%= dirs.js.src %>/logging.js', |
|
34 | '<%= dirs.js.src %>/logging.js', | |
35 | '<%= dirs.js.src %>/bootstrap.js', |
|
35 | '<%= dirs.js.src %>/bootstrap.js', | |
36 | '<%= dirs.js.src %>/mousetrap.js', |
|
36 | '<%= dirs.js.src %>/mousetrap.js', | |
37 | '<%= dirs.js.src %>/moment.js', |
|
37 | '<%= dirs.js.src %>/moment.js', | |
38 | '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js', |
|
38 | '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js', | |
39 | '<%= dirs.js.src %>/i18n_utils.js', |
|
39 | '<%= dirs.js.src %>/i18n_utils.js', | |
40 | '<%= dirs.js.src %>/deform.js', |
|
40 | '<%= dirs.js.src %>/deform.js', | |
41 |
|
41 | |||
42 | // Plugins |
|
42 | // Plugins | |
43 | '<%= dirs.js.src %>/plugins/jquery.pjax.js', |
|
43 | '<%= dirs.js.src %>/plugins/jquery.pjax.js', | |
44 | '<%= dirs.js.src %>/plugins/jquery.dataTables.js', |
|
44 | '<%= dirs.js.src %>/plugins/jquery.dataTables.js', | |
45 | '<%= dirs.js.src %>/plugins/flavoured_checkbox.js', |
|
45 | '<%= dirs.js.src %>/plugins/flavoured_checkbox.js', | |
46 | '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js', |
|
46 | '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js', | |
47 | '<%= dirs.js.src %>/plugins/jquery.autocomplete.js', |
|
47 | '<%= dirs.js.src %>/plugins/jquery.autocomplete.js', | |
48 | '<%= dirs.js.src %>/plugins/jquery.debounce.js', |
|
48 | '<%= dirs.js.src %>/plugins/jquery.debounce.js', | |
49 | '<%= dirs.js.src %>/plugins/jquery.mark.js', |
|
49 | '<%= dirs.js.src %>/plugins/jquery.mark.js', | |
50 | '<%= dirs.js.src %>/plugins/jquery.timeago.js', |
|
50 | '<%= dirs.js.src %>/plugins/jquery.timeago.js', | |
51 | '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js', |
|
51 | '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js', | |
52 |
|
52 | |||
53 | // Select2 |
|
53 | // Select2 | |
54 | '<%= dirs.js.src %>/select2/select2.js', |
|
54 | '<%= dirs.js.src %>/select2/select2.js', | |
55 |
|
55 | |||
56 | // Code-mirror |
|
56 | // Code-mirror | |
57 | '<%= dirs.js.src %>/codemirror/codemirror.js', |
|
57 | '<%= dirs.js.src %>/codemirror/codemirror.js', | |
58 | '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js', |
|
58 | '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js', | |
59 | '<%= dirs.js.src %>/codemirror/codemirror_hint.js', |
|
59 | '<%= dirs.js.src %>/codemirror/codemirror_hint.js', | |
60 | '<%= dirs.js.src %>/codemirror/codemirror_overlay.js', |
|
60 | '<%= dirs.js.src %>/codemirror/codemirror_overlay.js', | |
61 | '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js', |
|
61 | '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js', | |
62 | // TODO: mikhail: this is an exception. Since the code mirror modes |
|
62 | // TODO: mikhail: this is an exception. Since the code mirror modes | |
63 | // are loaded "on the fly", we need to keep them in a public folder |
|
63 | // are loaded "on the fly", we need to keep them in a public folder | |
64 | '<%= dirs.js.dest %>/mode/meta.js', |
|
64 | '<%= dirs.js.dest %>/mode/meta.js', | |
65 | '<%= dirs.js.dest %>/mode/meta_ext.js', |
|
65 | '<%= dirs.js.dest %>/mode/meta_ext.js', | |
66 | '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js', |
|
66 | '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js', | |
67 |
|
67 | |||
68 | // Rhodecode utilities |
|
68 | // Rhodecode utilities | |
69 | '<%= dirs.js.src %>/rhodecode/utils/array.js', |
|
69 | '<%= dirs.js.src %>/rhodecode/utils/array.js', | |
70 | '<%= dirs.js.src %>/rhodecode/utils/string.js', |
|
70 | '<%= dirs.js.src %>/rhodecode/utils/string.js', | |
71 | '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js', |
|
71 | '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js', | |
72 | '<%= dirs.js.src %>/rhodecode/utils/ajax.js', |
|
72 | '<%= dirs.js.src %>/rhodecode/utils/ajax.js', | |
73 | '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js', |
|
73 | '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js', | |
74 | '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js', |
|
74 | '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js', | |
75 | '<%= dirs.js.src %>/rhodecode/utils/ie.js', |
|
75 | '<%= dirs.js.src %>/rhodecode/utils/ie.js', | |
76 | '<%= dirs.js.src %>/rhodecode/utils/os.js', |
|
76 | '<%= dirs.js.src %>/rhodecode/utils/os.js', | |
77 | '<%= dirs.js.src %>/rhodecode/utils/topics.js', |
|
77 | '<%= dirs.js.src %>/rhodecode/utils/topics.js', | |
78 |
|
78 | |||
79 | // Rhodecode widgets |
|
79 | // Rhodecode widgets | |
80 | '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js', |
|
80 | '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js', | |
81 |
|
81 | |||
82 | // Rhodecode components |
|
82 | // Rhodecode components | |
83 | '<%= dirs.js.src %>/rhodecode/init.js', |
|
83 | '<%= dirs.js.src %>/rhodecode/init.js', | |
84 | '<%= dirs.js.src %>/rhodecode/connection_controller.js', |
|
84 | '<%= dirs.js.src %>/rhodecode/connection_controller.js', | |
85 | '<%= dirs.js.src %>/rhodecode/codemirror.js', |
|
85 | '<%= dirs.js.src %>/rhodecode/codemirror.js', | |
86 | '<%= dirs.js.src %>/rhodecode/comments.js', |
|
86 | '<%= dirs.js.src %>/rhodecode/comments.js', | |
87 | '<%= dirs.js.src %>/rhodecode/constants.js', |
|
87 | '<%= dirs.js.src %>/rhodecode/constants.js', | |
88 | '<%= dirs.js.src %>/rhodecode/files.js', |
|
88 | '<%= dirs.js.src %>/rhodecode/files.js', | |
89 | '<%= dirs.js.src %>/rhodecode/followers.js', |
|
89 | '<%= dirs.js.src %>/rhodecode/followers.js', | |
90 | '<%= dirs.js.src %>/rhodecode/menus.js', |
|
90 | '<%= dirs.js.src %>/rhodecode/menus.js', | |
91 | '<%= dirs.js.src %>/rhodecode/notifications.js', |
|
91 | '<%= dirs.js.src %>/rhodecode/notifications.js', | |
92 | '<%= dirs.js.src %>/rhodecode/permissions.js', |
|
92 | '<%= dirs.js.src %>/rhodecode/permissions.js', | |
93 | '<%= dirs.js.src %>/rhodecode/pjax.js', |
|
93 | '<%= dirs.js.src %>/rhodecode/pjax.js', | |
94 | '<%= dirs.js.src %>/rhodecode/pullrequests.js', |
|
94 | '<%= dirs.js.src %>/rhodecode/pullrequests.js', | |
95 | '<%= dirs.js.src %>/rhodecode/settings.js', |
|
95 | '<%= dirs.js.src %>/rhodecode/settings.js', | |
96 | '<%= dirs.js.src %>/rhodecode/select2_widgets.js', |
|
96 | '<%= dirs.js.src %>/rhodecode/select2_widgets.js', | |
97 | '<%= dirs.js.src %>/rhodecode/tooltips.js', |
|
97 | '<%= dirs.js.src %>/rhodecode/tooltips.js', | |
98 | '<%= dirs.js.src %>/rhodecode/users.js', |
|
98 | '<%= dirs.js.src %>/rhodecode/users.js', | |
99 | '<%= dirs.js.src %>/rhodecode/utils/notifications.js', |
|
99 | '<%= dirs.js.src %>/rhodecode/utils/notifications.js', | |
100 | '<%= dirs.js.src %>/rhodecode/appenlight.js', |
|
100 | '<%= dirs.js.src %>/rhodecode/appenlight.js', | |
101 |
|
||||
102 | // Rhodecode main module |
|
101 | // Rhodecode main module | |
103 | '<%= dirs.js.src %>/rhodecode.js' |
|
102 | '<%= dirs.js.src %>/rhodecode.js', | |
104 | ], |
|
103 | ], | |
105 | dest: '<%= dirs.js.dest %>/scripts.js', |
|
104 | dest: '<%= dirs.js.dest %>/scripts.js', | |
106 | nonull: true |
|
105 | nonull: true | |
107 | } |
|
106 | } | |
108 | }, |
|
107 | }, | |
109 |
|
108 | crisper: { | ||
|
109 | dist: { | |||
|
110 | options: { | |||
|
111 | cleanup: false, | |||
|
112 | onlySplit: true | |||
|
113 | }, | |||
|
114 | src: '<%= dirs.js.dest %>/rhodecode-components.html', | |||
|
115 | dest: '<%= dirs.js.dest %>/rhodecode-components.js' | |||
|
116 | } | |||
|
117 | }, | |||
110 | less: { |
|
118 | less: { | |
111 | development: { |
|
119 | development: { | |
112 | options: { |
|
120 | options: { | |
113 | compress: false, |
|
121 | compress: false, | |
114 | yuicompress: false, |
|
122 | yuicompress: false, | |
115 | optimization: 0 |
|
123 | optimization: 0 | |
116 | }, |
|
124 | }, | |
117 | files: { |
|
125 | files: { | |
118 | "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less", |
|
126 | "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less", | |
119 | "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less" |
|
127 | "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less" | |
120 | } |
|
128 | } | |
121 | }, |
|
129 | }, | |
122 | production: { |
|
130 | production: { | |
123 | options: { |
|
131 | options: { | |
124 | compress: true, |
|
132 | compress: true, | |
125 | yuicompress: true, |
|
133 | yuicompress: true, | |
126 | optimization: 2 |
|
134 | optimization: 2 | |
127 | }, |
|
135 | }, | |
128 | files: { |
|
136 | files: { | |
129 | "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less", |
|
137 | "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less", | |
130 | "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less" |
|
138 | "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less" | |
131 | } |
|
139 | } | |
132 | }, |
|
140 | }, | |
133 | components: { |
|
141 | components: { | |
134 | files: [{ |
|
142 | files: [{ | |
135 | cwd: '<%= dirs.js.src %>/components/', |
|
143 | cwd: '<%= dirs.js.src %>/components/', | |
136 | dest: '<%= dirs.js.src %>/components/', |
|
144 | dest: '<%= dirs.js.src %>/components/', | |
137 | src: ['**/*.less'], |
|
145 | src: ['**/*.less'], | |
138 | expand: true, |
|
146 | expand: true, | |
139 | ext: '.css' |
|
147 | ext: '.css' | |
140 | }] |
|
148 | }] | |
141 | } |
|
149 | } | |
142 | }, |
|
150 | }, | |
143 |
|
151 | |||
144 | watch: { |
|
152 | watch: { | |
145 | less: { |
|
153 | less: { | |
146 | files: ["<%= dirs.css %>/**/*.less"], |
|
154 | files: ["<%= dirs.css %>/**/*.less"], | |
147 | tasks: ["less:development", 'less:components', 'concat:polymercss', "vulcanize"] |
|
155 | tasks: ["less:development", 'less:components', 'concat:polymercss', "vulcanize"] | |
148 | }, |
|
156 | }, | |
149 | js: { |
|
157 | js: { | |
150 | files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/**/*.html"], |
|
158 | files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/**/*.html"], | |
151 | tasks: ['less:components', 'concat:polymercss', "vulcanize", "concat:dist"] |
|
159 | tasks: ['less:components', 'concat:polymercss', "vulcanize", 'crisper', "concat:dist"] | |
152 | } |
|
160 | } | |
153 | }, |
|
161 | }, | |
154 |
|
162 | |||
155 | jshint: { |
|
163 | jshint: { | |
156 | rhodecode: { |
|
164 | rhodecode: { | |
157 | src: '<%= dirs.js.src %>/rhodecode/**/*.js', |
|
165 | src: '<%= dirs.js.src %>/rhodecode/**/*.js', | |
158 | options: { |
|
166 | options: { | |
159 | jshintrc: '.jshintrc' |
|
167 | jshintrc: '.jshintrc' | |
160 | } |
|
168 | } | |
161 | } |
|
169 | } | |
162 | }, |
|
170 | }, | |
163 | vulcanize: { |
|
171 | vulcanize: { | |
164 | default: { |
|
172 | default: { | |
165 | options: { |
|
173 | options: { | |
166 | abspath: '', |
|
174 | abspath: '', | |
167 | inlineScripts: true, |
|
175 | inlineScripts: true, | |
168 | inlineCss: true, |
|
176 | inlineCss: true, | |
169 | stripComments: true |
|
177 | stripComments: true | |
170 | }, |
|
178 | }, | |
171 | files: { |
|
179 | files: { | |
172 | '<%= dirs.js.dest %>/rhodecode-components.html': '<%= dirs.js.src %>/components/shared-components.html' |
|
180 | '<%= dirs.js.dest %>/rhodecode-components.html': '<%= dirs.js.src %>/components/shared-components.html' | |
173 | } |
|
181 | } | |
174 | } |
|
182 | } | |
175 | } |
|
183 | } | |
176 | }); |
|
184 | }); | |
177 |
|
185 | |||
178 | grunt.loadNpmTasks('grunt-contrib-less'); |
|
186 | grunt.loadNpmTasks('grunt-contrib-less'); | |
179 | grunt.loadNpmTasks('grunt-contrib-concat'); |
|
187 | grunt.loadNpmTasks('grunt-contrib-concat'); | |
180 | grunt.loadNpmTasks('grunt-contrib-watch'); |
|
188 | grunt.loadNpmTasks('grunt-contrib-watch'); | |
181 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
|
189 | grunt.loadNpmTasks('grunt-contrib-jshint'); | |
182 | grunt.loadNpmTasks('grunt-vulcanize'); |
|
190 | grunt.loadNpmTasks('grunt-vulcanize'); | |
183 | grunt.loadNpmTasks('grunt-crisper'); |
|
191 | grunt.loadNpmTasks('grunt-crisper'); | |
184 | grunt.loadNpmTasks('grunt-contrib-copy'); |
|
192 | grunt.loadNpmTasks('grunt-contrib-copy'); | |
185 |
|
193 | |||
186 | grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'concat:dist']); |
|
194 | grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'crisper', 'concat:dist']); | |
187 | }; |
|
195 | }; |
@@ -1,160 +1,178 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> |
|
45 | <script> | |
46 | // setup Polymer options |
|
46 | // setup Polymer options | |
47 | window.Polymer = {lazyRegister: true, dom: 'shadow'}; |
|
47 | window.Polymer = {lazyRegister: true, dom: 'shadow'}; | |
48 |
|
48 | |||
49 |
// |
|
49 | // Load webcomponentsjs polyfill if browser does not support native Web Components | |
50 | (function() { |
|
50 | (function() { | |
51 |
|
|
51 | 'use strict'; | |
|
52 | var onload = function() { | |||
|
53 | // For native Imports, manually fire WebComponentsReady so user code | |||
|
54 | // can use the same code path for native and polyfill'd imports. | |||
|
55 | if (!window.HTMLImports) { | |||
|
56 | document.dispatchEvent( | |||
|
57 | new CustomEvent('WebComponentsReady', {bubbles: true}) | |||
|
58 | ); | |||
|
59 | } | |||
|
60 | }; | |||
|
61 | var webComponentsSupported = ( | |||
|
62 | 'registerElement' in document | |||
52 | && 'import' in document.createElement('link') |
|
63 | && 'import' in document.createElement('link') | |
53 |
&& 'content' in document.createElement('template') |
|
64 | && 'content' in document.createElement('template') | |
54 | // browser has web components |
|
65 | ); | |
55 |
|
|
66 | if (!webComponentsSupported) { | |
56 | // polyfill web components |
|
|||
57 | var e = document.createElement('script'); |
|
67 | var e = document.createElement('script'); | |
|
68 | e.async = true; | |||
58 | e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}'; |
|
69 | e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}'; | |
59 | document.head.appendChild(e); |
|
70 | document.head.appendChild(e); | |
|
71 | } else { | |||
|
72 | onload(); | |||
60 | } |
|
73 | } | |
61 | })(); |
|
74 | })(); | |
62 | </script> |
|
75 | </script> | |
63 |
|
76 | |||
64 | <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> |
|
77 | <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> | |
65 | <script type="text/javascript"> |
|
78 | <script type="text/javascript"> | |
66 | // register templateContext to pass template variables to JS |
|
79 | // register templateContext to pass template variables to JS | |
67 | var templateContext = ${h.json.dumps(c.template_context)|n}; |
|
80 | var templateContext = ${h.json.dumps(c.template_context)|n}; | |
68 |
|
81 | |||
69 | var REPO_NAME = "${getattr(c, 'repo_name', '')}"; |
|
82 | var REPO_NAME = "${getattr(c, 'repo_name', '')}"; | |
70 | %if hasattr(c, 'rhodecode_db_repo'): |
|
83 | %if hasattr(c, 'rhodecode_db_repo'): | |
71 | var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}'; |
|
84 | var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}'; | |
72 | var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}'; |
|
85 | var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}'; | |
73 | %else: |
|
86 | %else: | |
74 | var REPO_LANDING_REV = ''; |
|
87 | var REPO_LANDING_REV = ''; | |
75 | var REPO_TYPE = ''; |
|
88 | var REPO_TYPE = ''; | |
76 | %endif |
|
89 | %endif | |
77 | var APPLICATION_URL = "${h.url('home').rstrip('/')}"; |
|
90 | var APPLICATION_URL = "${h.url('home').rstrip('/')}"; | |
78 | var ASSET_URL = "${h.asset('')}"; |
|
91 | var ASSET_URL = "${h.asset('')}"; | |
79 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; |
|
92 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; | |
80 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; |
|
93 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; | |
81 | % if getattr(c, 'rhodecode_user', None): |
|
94 | % if getattr(c, 'rhodecode_user', None): | |
82 | var USER = {name:'${c.rhodecode_user.username}'}; |
|
95 | var USER = {name:'${c.rhodecode_user.username}'}; | |
83 | % else: |
|
96 | % else: | |
84 | var USER = {name:null}; |
|
97 | var USER = {name:null}; | |
85 | % endif |
|
98 | % endif | |
86 |
|
99 | |||
87 | var APPENLIGHT = { |
|
100 | var APPENLIGHT = { | |
88 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, |
|
101 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, | |
89 | key: '${getattr(c, "appenlight_api_public_key", "")}', |
|
102 | key: '${getattr(c, "appenlight_api_public_key", "")}', | |
90 | % if getattr(c, 'appenlight_server_url', None): |
|
103 | % if getattr(c, 'appenlight_server_url', None): | |
91 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', |
|
104 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', | |
92 | % endif |
|
105 | % endif | |
93 | requestInfo: { |
|
106 | requestInfo: { | |
94 | % if getattr(c, 'rhodecode_user', None): |
|
107 | % if getattr(c, 'rhodecode_user', None): | |
95 | ip: '${c.rhodecode_user.ip_addr}', |
|
108 | ip: '${c.rhodecode_user.ip_addr}', | |
96 | username: '${c.rhodecode_user.username}' |
|
109 | username: '${c.rhodecode_user.username}' | |
97 | % endif |
|
110 | % endif | |
98 | } |
|
111 | } | |
99 | }; |
|
112 | }; | |
100 | </script> |
|
113 | </script> | |
101 | <!--[if lt IE 9]> |
|
114 | <!--[if lt IE 9]> | |
102 | <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script> |
|
115 | <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script> | |
103 | <![endif]--> |
|
116 | <![endif]--> | |
104 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script> |
|
117 | <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> |
|
118 | <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script> | |
|
119 | <script> | |||
|
120 | var e = document.createElement('script'); | |||
|
121 | e.src = '${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}'; | |||
|
122 | document.head.appendChild(e); | |||
|
123 | </script> | |||
106 | <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}"> |
|
124 | <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}"> | |
107 | <style include="shared-styles" is="custom-style"></style> |
|
125 | <style include="shared-styles" is="custom-style"></style> | |
108 | ## avoide escaping the %N |
|
126 | ## avoide escaping the %N | |
109 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> |
|
127 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> | |
110 |
|
128 | |||
111 |
|
129 | |||
112 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
130 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
113 | ${self.js_extra()} |
|
131 | ${self.js_extra()} | |
114 |
|
132 | |||
115 | <script type="text/javascript"> |
|
133 | <script type="text/javascript"> | |
116 | $(document).ready(function(){ |
|
134 | $(document).ready(function(){ | |
117 | show_more_event(); |
|
135 | show_more_event(); | |
118 | timeagoActivate(); |
|
136 | timeagoActivate(); | |
119 | }) |
|
137 | }) | |
120 | </script> |
|
138 | </script> | |
121 |
|
139 | |||
122 | </%def> |
|
140 | </%def> | |
123 |
|
141 | |||
124 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
142 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
125 | <%def name="js_extra()"></%def> |
|
143 | <%def name="js_extra()"></%def> | |
126 | ${self.js()} |
|
144 | ${self.js()} | |
127 |
|
145 | |||
128 | <%def name="head_extra()"></%def> |
|
146 | <%def name="head_extra()"></%def> | |
129 | ${self.head_extra()} |
|
147 | ${self.head_extra()} | |
130 | <%include file="/base/plugins_base.html"/> |
|
148 | <%include file="/base/plugins_base.html"/> | |
131 |
|
149 | |||
132 | ## extra stuff |
|
150 | ## extra stuff | |
133 | %if c.pre_code: |
|
151 | %if c.pre_code: | |
134 | ${c.pre_code|n} |
|
152 | ${c.pre_code|n} | |
135 | %endif |
|
153 | %endif | |
136 | </head> |
|
154 | </head> | |
137 | <body id="body"> |
|
155 | <body id="body"> | |
138 | <noscript> |
|
156 | <noscript> | |
139 | <div class="noscript-error"> |
|
157 | <div class="noscript-error"> | |
140 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} |
|
158 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} | |
141 | </div> |
|
159 | </div> | |
142 | </noscript> |
|
160 | </noscript> | |
143 | ## IE hacks |
|
161 | ## IE hacks | |
144 | <!--[if IE 7]> |
|
162 | <!--[if IE 7]> | |
145 | <script>$(document.body).addClass('ie7')</script> |
|
163 | <script>$(document.body).addClass('ie7')</script> | |
146 | <![endif]--> |
|
164 | <![endif]--> | |
147 | <!--[if IE 8]> |
|
165 | <!--[if IE 8]> | |
148 | <script>$(document.body).addClass('ie8')</script> |
|
166 | <script>$(document.body).addClass('ie8')</script> | |
149 | <![endif]--> |
|
167 | <![endif]--> | |
150 | <!--[if IE 9]> |
|
168 | <!--[if IE 9]> | |
151 | <script>$(document.body).addClass('ie9')</script> |
|
169 | <script>$(document.body).addClass('ie9')</script> | |
152 | <![endif]--> |
|
170 | <![endif]--> | |
153 |
|
171 | |||
154 | ${next.body()} |
|
172 | ${next.body()} | |
155 | %if c.post_code: |
|
173 | %if c.post_code: | |
156 | ${c.post_code|n} |
|
174 | ${c.post_code|n} | |
157 | %endif |
|
175 | %endif | |
158 | <rhodecode-toast id="notifications"></rhodecode-toast> |
|
176 | <rhodecode-toast id="notifications"></rhodecode-toast> | |
159 | </body> |
|
177 | </body> | |
160 | </html> |
|
178 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now