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