##// END OF EJS Templates
frontend: use webpack instead of vulcanize
ergo -
r3171:b9c8d2ad default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,7 b''
1 import '../../../../../bower_components/iron-ajax/iron-ajax.html';
2 import './root-styles.gen.html';
3 import './channelstream-connection/channelstream-connection.html';
4 import './rhodecode-toast/rhodecode-toast.html';
5 import './rhodecode-toggle/rhodecode-toggle.html';
6 import './rhodecode-unsafe-html/rhodecode-unsafe-html.html';
7 import './rhodecode-app/rhodecode-app.html';
@@ -0,0 +1,69 b''
1 /* webpack.config.js */
2 require('style-loader');
3 require('css-loader');
4 var path = require('path');
5
6 const projectName = 'rhodecode-components';
7 let destinationDirectory = path.join(process.cwd(), 'rhodecode', 'public', 'js')
8
9 if (process.env.RC_STATIC_DIR) {
10 destinationDirectory = process.env.RC_STATIC_DIR;
11 }
12
13 module.exports = {
14 // Tell Webpack which file kicks off our app.
15 entry: {
16 main: path.resolve(__dirname, 'rhodecode/public/js/src/components/index.js'),
17 },
18 output: {
19 filename: 'rhodecode-components.js',
20 path: path.resolve(destinationDirectory)
21 },
22 // Tell Webpack which directories to look in to resolve import statements.
23 // Normally Webpack will look in node_modules by default but since we’re overriding
24 // the property we’ll need to tell it to look there in addition to the
25 // bower_components folder.
26 resolve: {
27 modules: [
28 path.resolve(__dirname, 'node_modules'),
29 path.resolve(__dirname, 'bower_components')
30 ]
31 },
32 // These rules tell Webpack how to process different module types.
33 // Remember, *everything* is a module in Webpack. That includes
34 // CSS, and (thanks to our loader) HTML.
35 module: {
36 rules: [
37 {
38 // If you see a file that ends in .html, send it to these loaders.
39 test: /\.html$/,
40 // This is an example of chained loaders in Webpack.
41 // Chained loaders run last to first. So it will run
42 // polymer-webpack-loader, and hand the output to
43 // babel-loader. This let's us transpile JS in our `<script>` elements.
44 use: [
45 {loader: 'babel-loader'},
46 {loader: 'polymer-webpack-loader',
47 options: {
48 processStyleLinks: true,
49 }
50 }
51 ],
52 },
53 {
54 // If you see a file that ends in .js, just send it to the babel-loader.
55 test: /\.js$/,
56 use: 'babel-loader'
57 // Optionally exclude node_modules from transpilation except for polymer-webpack-loader:
58 // exclude: /node_modules\/(?!polymer-webpack-loader\/).*/
59 },
60 // this is required because of bug:
61 // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49
62 {
63 test: /intl-messageformat.min.js/,
64 use: 'imports-loader?this=>window'
65 }
66 ]
67 },
68 plugins: []
69 };
@@ -1,67 +1,68 b''
1 syntax: glob
1 syntax: glob
2 *.egg
2 *.egg
3 *.egg-info
3 *.egg-info
4 *.idea
4 *.idea
5 *.orig
5 *.orig
6 *.pyc
6 *.pyc
7 *.sqlite-journal
7 *.sqlite-journal
8 *.swp
8 *.swp
9 *.tox
9 *.tox
10 *.DS_Store*
10 *.DS_Store*
11 rhodecode/public/js/src/components/**/*.css
11 rhodecode/public/js/src/components/**/*.css
12
12
13 syntax: regexp
13 syntax: regexp
14
14
15 #.filename
15 #.filename
16 ^\.settings$
16 ^\.settings$
17 ^\.project$
17 ^\.project$
18 ^\.pydevproject$
18 ^\.pydevproject$
19 ^\.coverage$
19 ^\.coverage$
20 ^\.cache.*$
20 ^\.cache.*$
21 ^\.rhodecode$
21 ^\.rhodecode$
22
22
23 ^rcextensions
23 ^rcextensions
24 ^.dev
24 ^.dev
25 ^._dev
25 ^._dev
26 ^build/
26 ^build/
27 ^bower_components/
27 ^bower_components/
28 ^coverage\.xml$
28 ^coverage\.xml$
29 ^data$
29 ^data$
30 ^\.eggs/
30 ^\.eggs/
31 ^configs/data$
31 ^configs/data$
32 ^dev.ini$
32 ^dev.ini$
33 ^acceptance_tests/dev.*\.ini$
33 ^acceptance_tests/dev.*\.ini$
34 ^dist/
34 ^dist/
35 ^fabfile.py
35 ^fabfile.py
36 ^htmlcov
36 ^htmlcov
37 ^junit\.xml$
37 ^junit\.xml$
38 ^node_modules/
38 ^node_modules/
39 ^node_binaries/
39 ^node_binaries/
40 ^pylint.log$
40 ^pylint.log$
41 ^rcextensions/
41 ^rcextensions/
42 ^result$
42 ^result$
43 ^rhodecode/public/css/style.css$
43 ^rhodecode/public/css/style.css$
44 ^rhodecode/public/css/style-polymer.css$
44 ^rhodecode/public/css/style-polymer.css$
45 ^rhodecode/public/js/rhodecode-components.html$
45 ^rhodecode/public/js/rhodecode-components.html$
46 ^rhodecode/public/js/scripts.js$
46 ^rhodecode/public/js/scripts.js$
47 ^rhodecode/public/js/rhodecode-components.js$
47 ^rhodecode/public/js/rhodecode-components.js$
48 ^rhodecode/public/js/app-bundle.js$
48 ^rhodecode/public/js/src/components/root-styles.gen.html$
49 ^rhodecode/public/js/src/components/root-styles.gen.html$
49 ^rhodecode/public/js/vendors/webcomponentsjs/
50 ^rhodecode/public/js/vendors/webcomponentsjs/
50 ^rhodecode\.db$
51 ^rhodecode\.db$
51 ^rhodecode\.log$
52 ^rhodecode\.log$
52 ^rhodecode_dev\.log$
53 ^rhodecode_dev\.log$
53 ^test\.db$
54 ^test\.db$
54
55
55 # ac-tests
56 # ac-tests
56 ^acceptance_tests/\.cache.*$
57 ^acceptance_tests/\.cache.*$
57 ^acceptance_tests/externals
58 ^acceptance_tests/externals
58 ^acceptance_tests/ghostdriver.log$
59 ^acceptance_tests/ghostdriver.log$
59 ^acceptance_tests/local(_.+)?\.ini$
60 ^acceptance_tests/local(_.+)?\.ini$
60
61
61 # docs
62 # docs
62 ^docs/_build$
63 ^docs/_build$
63 ^docs/result$
64 ^docs/result$
64 ^docs-internal/_build$
65 ^docs-internal/_build$
65
66
66 # Cythonized things
67 # Cythonized things
67 ^rhodecode/.*\.(c|so)$
68 ^rhodecode/.*\.(c|so)$
@@ -1,14 +1,21 b''
1 var gruntConfig = require('./grunt_config.json');
1 var gruntConfig = require('./grunt_config.json');
2 var webpackConfig = require('./webpack.config');
3 gruntConfig["webpack"] = {
4 options: {
5 stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
6 },
7 prod: webpackConfig,
8 dev: Object.assign({ watch: false }, webpackConfig)
9 };
2
10
3 module.exports = function(grunt) {
11 module.exports = function(grunt) {
4 grunt.initConfig(gruntConfig);
12 grunt.initConfig(gruntConfig);
5
13
6 grunt.loadNpmTasks('grunt-contrib-less');
14 grunt.loadNpmTasks('grunt-contrib-less');
7 grunt.loadNpmTasks('grunt-contrib-concat');
15 grunt.loadNpmTasks('grunt-contrib-concat');
8 grunt.loadNpmTasks('grunt-contrib-watch');
16 grunt.loadNpmTasks('grunt-contrib-watch');
9 grunt.loadNpmTasks('grunt-contrib-jshint');
17 grunt.loadNpmTasks('grunt-contrib-jshint');
10 grunt.loadNpmTasks('grunt-vulcanize');
11 grunt.loadNpmTasks('grunt-contrib-copy');
18 grunt.loadNpmTasks('grunt-contrib-copy');
12
19 grunt.loadNpmTasks('grunt-webpack');
13 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy', 'concat:dist', 'vulcanize']);
20 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy', 'webpack', 'concat:dist']);
14 };
21 };
@@ -1,188 +1,176 b''
1 {
1 {
2 "dirs": {
2 "dirs": {
3 "css": {
3 "css": {
4 "src":"rhodecode/public/css",
4 "src":"rhodecode/public/css",
5 "dest":"rhodecode/public/css"
5 "dest":"rhodecode/public/css"
6 },
6 },
7 "js": {
7 "js": {
8 "src": "rhodecode/public/js/src",
8 "src": "rhodecode/public/js/src",
9 "src_rc": "rhodecode/public/js/rhodecode",
9 "src_rc": "rhodecode/public/js/rhodecode",
10 "dest": "rhodecode/public/js",
10 "dest": "rhodecode/public/js",
11 "bower": "bower_components",
11 "bower": "bower_components",
12 "node_modules": "node_modules"
12 "node_modules": "node_modules"
13 }
13 }
14 },
14 },
15 "copy": {
15 "copy": {
16 "main": {
16 "main": {
17 "expand": true,
17 "expand": true,
18 "cwd": "bower_components",
18 "cwd": "bower_components",
19 "src": "webcomponentsjs/webcomponents*.*",
19 "src": "webcomponentsjs/webcomponents*.*",
20 "dest": "<%= dirs.js.dest %>/vendors"
20 "dest": "<%= dirs.js.dest %>/vendors"
21 }
21 }
22 },
22 },
23 "concat": {
23 "concat": {
24 "polymercss": {
24 "polymercss": {
25 "src": [
25 "src": [
26 "<%= dirs.js.src %>/components/root-styles-prefix.html",
26 "<%= dirs.js.src %>/components/root-styles-prefix.html",
27 "<%= dirs.css.src %>/style-polymer.css",
27 "<%= dirs.css.src %>/style-polymer.css",
28 "<%= dirs.js.src %>/components/root-styles-suffix.html"
28 "<%= dirs.js.src %>/components/root-styles-suffix.html"
29 ],
29 ],
30 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
30 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
31 "nonull": true
31 "nonull": true
32 },
32 },
33 "dist": {
33 "dist": {
34 "src": [
34 "src": [
35 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
35 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
36 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
36 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
37 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
37 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
38 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
38 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
39 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
39 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
40 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
40 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
41 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
41 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
42 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
42 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
43 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
43 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
44 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
44 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
45 "<%= dirs.js.src %>/logging.js",
45 "<%= dirs.js.src %>/logging.js",
46 "<%= dirs.js.src %>/bootstrap.js",
46 "<%= dirs.js.src %>/bootstrap.js",
47 "<%= dirs.js.src %>/i18n_utils.js",
47 "<%= dirs.js.src %>/i18n_utils.js",
48 "<%= dirs.js.src %>/deform.js",
48 "<%= dirs.js.src %>/deform.js",
49 "<%= dirs.js.src %>/ejs.js",
49 "<%= dirs.js.src %>/ejs.js",
50 "<%= dirs.js.src %>/ejs_templates/utils.js",
50 "<%= dirs.js.src %>/ejs_templates/utils.js",
51 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
51 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
52 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
52 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
53 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
53 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
54 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
54 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
55 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
55 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
56 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
56 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
57 "<%= dirs.js.src %>/plugins/jquery.mark.js",
57 "<%= dirs.js.src %>/plugins/jquery.mark.js",
58 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
58 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
59 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
59 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
60 "<%= dirs.js.src %>/select2/select2.js",
60 "<%= dirs.js.src %>/select2/select2.js",
61 "<%= dirs.js.src %>/codemirror/codemirror.js",
61 "<%= dirs.js.src %>/codemirror/codemirror.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
65 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
65 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
66 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
66 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
67 "<%= dirs.js.dest %>/mode/meta.js",
67 "<%= dirs.js.dest %>/mode/meta.js",
68 "<%= dirs.js.dest %>/mode/meta_ext.js",
68 "<%= dirs.js.dest %>/mode/meta_ext.js",
69 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
69 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
70 "<%= dirs.js.src %>/rhodecode/utils/array.js",
70 "<%= dirs.js.src %>/rhodecode/utils/array.js",
71 "<%= dirs.js.src %>/rhodecode/utils/string.js",
71 "<%= dirs.js.src %>/rhodecode/utils/string.js",
72 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
72 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
73 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
73 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
74 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
74 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
75 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
75 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
76 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
76 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
77 "<%= dirs.js.src %>/rhodecode/utils/os.js",
77 "<%= dirs.js.src %>/rhodecode/utils/os.js",
78 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
78 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
79 "<%= dirs.js.src %>/rhodecode/init.js",
79 "<%= dirs.js.src %>/rhodecode/init.js",
80 "<%= dirs.js.src %>/rhodecode/changelog.js",
80 "<%= dirs.js.src %>/rhodecode/changelog.js",
81 "<%= dirs.js.src %>/rhodecode/codemirror.js",
81 "<%= dirs.js.src %>/rhodecode/codemirror.js",
82 "<%= dirs.js.src %>/rhodecode/comments.js",
82 "<%= dirs.js.src %>/rhodecode/comments.js",
83 "<%= dirs.js.src %>/rhodecode/constants.js",
83 "<%= dirs.js.src %>/rhodecode/constants.js",
84 "<%= dirs.js.src %>/rhodecode/files.js",
84 "<%= dirs.js.src %>/rhodecode/files.js",
85 "<%= dirs.js.src %>/rhodecode/followers.js",
85 "<%= dirs.js.src %>/rhodecode/followers.js",
86 "<%= dirs.js.src %>/rhodecode/menus.js",
86 "<%= dirs.js.src %>/rhodecode/menus.js",
87 "<%= dirs.js.src %>/rhodecode/notifications.js",
87 "<%= dirs.js.src %>/rhodecode/notifications.js",
88 "<%= dirs.js.src %>/rhodecode/permissions.js",
88 "<%= dirs.js.src %>/rhodecode/permissions.js",
89 "<%= dirs.js.src %>/rhodecode/pjax.js",
89 "<%= dirs.js.src %>/rhodecode/pjax.js",
90 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
90 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
91 "<%= dirs.js.src %>/rhodecode/settings.js",
91 "<%= dirs.js.src %>/rhodecode/settings.js",
92 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
92 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
93 "<%= dirs.js.src %>/rhodecode/tooltips.js",
93 "<%= dirs.js.src %>/rhodecode/tooltips.js",
94 "<%= dirs.js.src %>/rhodecode/users.js",
94 "<%= dirs.js.src %>/rhodecode/users.js",
95 "<%= dirs.js.src %>/rhodecode/appenlight.js",
95 "<%= dirs.js.src %>/rhodecode/appenlight.js",
96 "<%= dirs.js.src %>/rhodecode.js"
96 "<%= dirs.js.src %>/rhodecode.js",
97 "<%= dirs.js.dest %>/rhodecode-components.js"
97 ],
98 ],
98 "dest": "<%= dirs.js.dest %>/scripts.js",
99 "dest": "<%= dirs.js.dest %>/scripts.js",
99 "nonull": true
100 "nonull": true
100 }
101 }
101 },
102 },
102 "less": {
103 "less": {
103 "development": {
104 "development": {
104 "options": {
105 "options": {
105 "compress": false,
106 "compress": false,
106 "yuicompress": false,
107 "yuicompress": false,
107 "optimization": 0
108 "optimization": 0
108 },
109 },
109 "files": {
110 "files": {
110 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
111 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
111 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
112 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
112 }
113 }
113 },
114 },
114 "production": {
115 "production": {
115 "options": {
116 "options": {
116 "compress": true,
117 "compress": true,
117 "yuicompress": true,
118 "yuicompress": true,
118 "optimization": 2
119 "optimization": 2
119 },
120 },
120 "files": {
121 "files": {
121 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
122 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
122 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
123 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
123 }
124 }
124 },
125 },
125 "components": {
126 "components": {
126 "files": [
127 "files": [
127 {
128 {
128 "cwd": "<%= dirs.js.src %>/components/",
129 "cwd": "<%= dirs.js.src %>/components/",
129 "dest": "<%= dirs.js.src %>/components/",
130 "dest": "<%= dirs.js.src %>/components/",
130 "src": [
131 "src": [
131 "**/*.less"
132 "**/*.less"
132 ],
133 ],
133 "expand": true,
134 "expand": true,
134 "ext": ".css"
135 "ext": ".css"
135 }
136 }
136 ]
137 ]
137 }
138 }
138 },
139 },
139 "watch": {
140 "watch": {
140 "less": {
141 "less": {
141 "files": [
142 "files": [
142 "<%= dirs.css.src %>/**/*.less",
143 "<%= dirs.css.src %>/**/*.less",
143 "<%= dirs.js.src %>/components/**/*.less"
144 "<%= dirs.js.src %>/components/**/*.less"
144 ],
145 ],
145 "tasks": [
146 "tasks": [
146 "less:development",
147 "less:development",
147 "less:components",
148 "less:components",
148 "concat:polymercss",
149 "concat:polymercss",
149 "vulcanize",
150 "webpack",
150 "concat:dist"
151 "concat:dist"
151 ]
152 ]
152 },
153 },
153 "js": {
154 "js": {
154 "files": [
155 "files": [
155 "!<%= dirs.js.src %>/components/root-styles.gen.html",
156 "!<%= dirs.js.src %>/components/root-styles.gen.html",
156 "<%= dirs.js.src %>/**/*.js",
157 "<%= dirs.js.src %>/**/*.js",
157 "<%= dirs.js.src %>/components/**/*.html"
158 "<%= dirs.js.src %>/components/**/*.html"
158 ],
159 ],
159 "tasks": [
160 "tasks": [
160 "less:components",
161 "less:components",
161 "concat:polymercss",
162 "concat:polymercss",
162 "vulcanize",
163 "webpack",
163 "concat:dist"
164 "concat:dist"
164 ]
165 ]
165 }
166 }
166 },
167 },
167 "jshint": {
168 "jshint": {
168 "rhodecode": {
169 "rhodecode": {
169 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
170 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
170 "options": {
171 "options": {
171 "jshintrc": ".jshintrc"
172 "jshintrc": ".jshintrc"
172 }
173 }
173 }
174 }
174 },
175 "vulcanize": {
176 "default": {
177 "options": {
178 "abspath": "",
179 "inlineScripts": true,
180 "inlineCss": true,
181 "stripComments": true
182 },
183 "files": {
184 "<%= dirs.js.dest %>/rhodecode-components.html": "<%= dirs.js.src %>/components/shared-components.html"
185 }
186 }
187 }
175 }
188 }
176 }
@@ -1,36 +1,50 b''
1 {
1 {
2 "name": "rhodecode-enterprise",
2 "name": "rhodecode-enterprise",
3 "version": "1.0.0",
3 "version": "1.0.0",
4 "private": true,
4 "private": true,
5 "description" : "RhodeCode JS packaged",
5 "description" : "RhodeCode JS packaged",
6 "license": "SEE LICENSE IN LICENSE.txt",
6 "license": "SEE LICENSE IN LICENSE.txt",
7 "repository" : {
7 "repository" : {
8 "type" : "hg",
8 "type" : "hg",
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
10 },
10 },
11 "devDependencies": {
11 "devDependencies": {
12 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1",
12 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1",
13 "bower": "^1.8.4",
13 "bower": "^1.8.4",
14 "clipboard": "^2.0.1",
14 "clipboard": "^2.0.1",
15 "exports-loader": "^0.6.4",
15 "exports-loader": "^0.6.4",
16 "favico.js": "^0.3.10",
16 "favico.js": "^0.3.10",
17 "grunt": "^0.4.5",
17 "grunt": "^0.4.5",
18 "grunt-cli": "^1.3.1",
18 "grunt-cli": "^1.3.1",
19 "grunt-contrib-concat": "^0.5.1",
19 "grunt-contrib-concat": "^0.5.1",
20 "grunt-contrib-copy": "^1.0.0",
20 "grunt-contrib-copy": "^1.0.0",
21 "grunt-contrib-jshint": "^0.12.0",
21 "grunt-contrib-jshint": "^0.12.0",
22 "grunt-contrib-less": "^1.1.0",
22 "grunt-contrib-less": "^1.1.0",
23 "grunt-contrib-watch": "^0.6.1",
23 "grunt-contrib-watch": "^0.6.1",
24 "grunt-vulcanize": "^1.0.0",
24 "grunt-webpack": "^3.1.3",
25 "jquery": "1.11.3",
25 "jquery": "1.11.3",
26 "jshint": "^2.9.1-rc3",
26 "jshint": "^2.9.1-rc3",
27 "moment": "^2.18.1",
27 "moment": "^2.18.1",
28 "mousetrap": "^1.6.1",
28 "mousetrap": "^1.6.1",
29 "qrious": "^4.0.2",
29 "qrious": "^4.0.2",
30 "sticky-sidebar": "3.3.1",
30 "sticky-sidebar": "3.3.1",
31 "vulcanize": "^1.16.0",
32 "waypoints": "4.0.1",
31 "waypoints": "4.0.1",
33 "webpack": "4.23.1",
32 "webpack": "4.23.1",
34 "webpack-cli": "3.1.2"
33 "webpack-cli": "3.1.2",
34 "babel-core": "^6.26.3",
35 "babel-loader": "^7.1.2",
36 "babel-plugin-transform-object-rest-spread": "^6.26.0",
37 "babel-preset-env": "^1.6.0",
38 "copy-webpack-plugin": "^4.4.2",
39 "css-loader": "^0.28.11",
40 "exports-loader": "^0.6.4",
41 "html-loader": "^0.4.4",
42 "html-webpack-plugin": "^3.2.0",
43 "imports-loader": "^0.7.1",
44 "polymer-webpack-loader": "^2.0.1",
45 "style-loader": "^0.21.0",
46 "webpack-uglify-js-plugin": "^1.1.9",
47 "raw-loader": "1.0.0-beta.0",
48 "ts-loader": "^1.3.3"
35 }
49 }
36 }
50 }
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,142 +1,141 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2018 RhodeCode GmbH
3 # Copyright (C) 2010-2018 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21
21
22 import pytest
22 import pytest
23
23
24 import rhodecode
24 import rhodecode
25 from rhodecode.model.db import Repository
25 from rhodecode.model.db import Repository
26 from rhodecode.model.meta import Session
26 from rhodecode.model.meta import Session
27 from rhodecode.model.repo import RepoModel
27 from rhodecode.model.repo import RepoModel
28 from rhodecode.model.repo_group import RepoGroupModel
28 from rhodecode.model.repo_group import RepoGroupModel
29 from rhodecode.model.settings import SettingsModel
29 from rhodecode.model.settings import SettingsModel
30 from rhodecode.tests import TestController
30 from rhodecode.tests import TestController
31 from rhodecode.tests.fixture import Fixture
31 from rhodecode.tests.fixture import Fixture
32 from rhodecode.lib import helpers as h
32 from rhodecode.lib import helpers as h
33
33
34 fixture = Fixture()
34 fixture = Fixture()
35
35
36
36
37 def route_path(name, **kwargs):
37 def route_path(name, **kwargs):
38 return {
38 return {
39 'home': '/',
39 'home': '/',
40 'repo_group_home': '/{repo_group_name}'
40 'repo_group_home': '/{repo_group_name}'
41 }[name].format(**kwargs)
41 }[name].format(**kwargs)
42
42
43
43
44 class TestHomeController(TestController):
44 class TestHomeController(TestController):
45
45
46 def test_index(self):
46 def test_index(self):
47 self.log_user()
47 self.log_user()
48 response = self.app.get(route_path('home'))
48 response = self.app.get(route_path('home'))
49 # if global permission is set
49 # if global permission is set
50 response.mustcontain('Add Repository')
50 response.mustcontain('Add Repository')
51
51
52 # search for objects inside the JavaScript JSON
52 # search for objects inside the JavaScript JSON
53 for repo in Repository.getAll():
53 for repo in Repository.getAll():
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
55
55
56 def test_index_contains_statics_with_ver(self):
56 def test_index_contains_statics_with_ver(self):
57 from rhodecode.lib.base import calculate_version_hash
57 from rhodecode.lib.base import calculate_version_hash
58
58
59 self.log_user()
59 self.log_user()
60 response = self.app.get(route_path('home'))
60 response = self.app.get(route_path('home'))
61
61
62 rhodecode_version_hash = calculate_version_hash(
62 rhodecode_version_hash = calculate_version_hash(
63 {'beaker.session.secret': 'test-rc-uytcxaz'})
63 {'beaker.session.secret': 'test-rc-uytcxaz'})
64 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
65 response.mustcontain('scripts.js?ver={0}'.format(rhodecode_version_hash))
65 response.mustcontain('scripts.js?ver={0}'.format(rhodecode_version_hash))
66 response.mustcontain('hodecode-components.html?ver={0}'.format(rhodecode_version_hash))
67
66
68 def test_index_contains_backend_specific_details(self, backend):
67 def test_index_contains_backend_specific_details(self, backend):
69 self.log_user()
68 self.log_user()
70 response = self.app.get(route_path('home'))
69 response = self.app.get(route_path('home'))
71 tip = backend.repo.get_commit().raw_id
70 tip = backend.repo.get_commit().raw_id
72
71
73 # html in javascript variable:
72 # html in javascript variable:
74 response.mustcontain(r'<i class=\"icon-%s\"' % (backend.alias, ))
73 response.mustcontain(r'<i class=\"icon-%s\"' % (backend.alias, ))
75 response.mustcontain(r'href=\"/%s\"' % (backend.repo_name, ))
74 response.mustcontain(r'href=\"/%s\"' % (backend.repo_name, ))
76
75
77 response.mustcontain("""/%s/changeset/%s""" % (backend.repo_name, tip))
76 response.mustcontain("""/%s/changeset/%s""" % (backend.repo_name, tip))
78 response.mustcontain("""Added a symlink""")
77 response.mustcontain("""Added a symlink""")
79
78
80 def test_index_with_anonymous_access_disabled(self):
79 def test_index_with_anonymous_access_disabled(self):
81 with fixture.anon_access(False):
80 with fixture.anon_access(False):
82 response = self.app.get(route_path('home'), status=302)
81 response = self.app.get(route_path('home'), status=302)
83 assert 'login' in response.location
82 assert 'login' in response.location
84
83
85 def test_index_page_on_groups(self, autologin_user, repo_group):
84 def test_index_page_on_groups(self, autologin_user, repo_group):
86 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1'))
85 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1'))
87 response.mustcontain("gr1/repo_in_group")
86 response.mustcontain("gr1/repo_in_group")
88
87
89 def test_index_page_on_group_with_trailing_slash(
88 def test_index_page_on_group_with_trailing_slash(
90 self, autologin_user, repo_group):
89 self, autologin_user, repo_group):
91 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1') + '/')
90 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1') + '/')
92 response.mustcontain("gr1/repo_in_group")
91 response.mustcontain("gr1/repo_in_group")
93
92
94 @pytest.fixture(scope='class')
93 @pytest.fixture(scope='class')
95 def repo_group(self, request):
94 def repo_group(self, request):
96 gr = fixture.create_repo_group('gr1')
95 gr = fixture.create_repo_group('gr1')
97 fixture.create_repo(name='gr1/repo_in_group', repo_group=gr)
96 fixture.create_repo(name='gr1/repo_in_group', repo_group=gr)
98
97
99 @request.addfinalizer
98 @request.addfinalizer
100 def cleanup():
99 def cleanup():
101 RepoModel().delete('gr1/repo_in_group')
100 RepoModel().delete('gr1/repo_in_group')
102 RepoGroupModel().delete(repo_group='gr1', force_delete=True)
101 RepoGroupModel().delete(repo_group='gr1', force_delete=True)
103 Session().commit()
102 Session().commit()
104
103
105 def test_index_with_name_with_tags(self, user_util, autologin_user):
104 def test_index_with_name_with_tags(self, user_util, autologin_user):
106 user = user_util.create_user()
105 user = user_util.create_user()
107 username = user.username
106 username = user.username
108 user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">'
107 user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">'
109 user.lastname = '#"><img src=x onerror=prompt(document.cookie);>'
108 user.lastname = '#"><img src=x onerror=prompt(document.cookie);>'
110
109
111 Session().add(user)
110 Session().add(user)
112 Session().commit()
111 Session().commit()
113 user_util.create_repo(owner=username)
112 user_util.create_repo(owner=username)
114
113
115 response = self.app.get(route_path('home'))
114 response = self.app.get(route_path('home'))
116 response.mustcontain(h.html_escape(user.first_name))
115 response.mustcontain(h.html_escape(user.first_name))
117 response.mustcontain(h.html_escape(user.last_name))
116 response.mustcontain(h.html_escape(user.last_name))
118
117
119 @pytest.mark.parametrize("name, state", [
118 @pytest.mark.parametrize("name, state", [
120 ('Disabled', False),
119 ('Disabled', False),
121 ('Enabled', True),
120 ('Enabled', True),
122 ])
121 ])
123 def test_index_show_version(self, autologin_user, name, state):
122 def test_index_show_version(self, autologin_user, name, state):
124 version_string = 'RhodeCode Enterprise %s' % rhodecode.__version__
123 version_string = 'RhodeCode Enterprise %s' % rhodecode.__version__
125
124
126 sett = SettingsModel().create_or_update_setting(
125 sett = SettingsModel().create_or_update_setting(
127 'show_version', state, 'bool')
126 'show_version', state, 'bool')
128 Session().add(sett)
127 Session().add(sett)
129 Session().commit()
128 Session().commit()
130 SettingsModel().invalidate_settings_cache()
129 SettingsModel().invalidate_settings_cache()
131
130
132 response = self.app.get(route_path('home'))
131 response = self.app.get(route_path('home'))
133 if state is True:
132 if state is True:
134 response.mustcontain(version_string)
133 response.mustcontain(version_string)
135 if state is False:
134 if state is False:
136 response.mustcontain(no=[version_string])
135 response.mustcontain(no=[version_string])
137
136
138 def test_logout_form_contains_csrf(self, autologin_user, csrf_token):
137 def test_logout_form_contains_csrf(self, autologin_user, csrf_token):
139 response = self.app.get(route_path('home'))
138 response = self.app.get(route_path('home'))
140 assert_response = response.assert_response()
139 assert_response = response.assert_response()
141 element = assert_response.get_element('.logout #csrf_token')
140 element = assert_response.get_element('.logout #csrf_token')
142 assert element.value == csrf_token
141 assert element.value == csrf_token
@@ -1,185 +1,185 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
3 <link rel="import" href="../rhodecode-toast/rhodecode-toast.html">
3 <link rel="import" href="../rhodecode-toast/rhodecode-toast.html">
4 <link rel="import" href="../rhodecode-favicon/rhodecode-favicon.html">
4 <link rel="import" href="../rhodecode-favicon/rhodecode-favicon.html">
5
5
6 <dom-module id="rhodecode-app">
6 <dom-module id="rhodecode-app">
7 <template>
7 <template>
8 <channelstream-connection
8 <channelstream-connection
9 id="channelstream-connection"
9 id="channelstream-connection"
10 on-channelstream-listen-message="receivedMessage"
10 on-channelstream-listen-message="receivedMessage"
11 on-channelstream-connected="handleConnected"
11 on-channelstream-connected="handleConnected"
12 on-channelstream-subscribed="handleSubscribed">
12 on-channelstream-subscribed="handleSubscribed">
13 </channelstream-connection>
13 </channelstream-connection>
14 <rhodecode-favicon></rhodecode-favicon>
14 <rhodecode-favicon></rhodecode-favicon>
15 </template>
15 </template>
16 <script>
16 <script>
17 ccLog = Logger.get('RhodeCodeApp');
17 var ccLog = Logger.get('RhodeCodeApp');
18 ccLog.setLevel(Logger.OFF);
18 ccLog.setLevel(Logger.OFF);
19
19
20 var rhodeCodeApp = Polymer({
20 var rhodeCodeApp = Polymer({
21 is: 'rhodecode-app',
21 is: 'rhodecode-app',
22 attached: function () {
22 attached: function () {
23 ccLog.debug('rhodeCodeApp created');
23 ccLog.debug('rhodeCodeApp created');
24 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
24 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
25 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
25 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
26 $.Topic('/connection_controller/subscribe').subscribe(
26 $.Topic('/connection_controller/subscribe').subscribe(
27 this.subscribeToChannelTopic.bind(this));
27 this.subscribeToChannelTopic.bind(this));
28 // this event can be used to coordinate plugins to do their
28 // this event can be used to coordinate plugins to do their
29 // initialization before channelstream is kicked off
29 // initialization before channelstream is kicked off
30 $.Topic('/__MAIN_APP__').publish({});
30 $.Topic('/__MAIN_APP__').publish({});
31
31
32 for (var i = 0; i < alertMessagePayloads.length; i++) {
32 for (var i = 0; i < alertMessagePayloads.length; i++) {
33 $.Topic('/notifications').publish(alertMessagePayloads[i]);
33 $.Topic('/notifications').publish(alertMessagePayloads[i]);
34 }
34 }
35 this.initPlugins();
35 this.initPlugins();
36 // after rest of application loads and topics get fired, launch connection
36 // after rest of application loads and topics get fired, launch connection
37 $(document).ready(function () {
37 $(document).ready(function () {
38 this.kickoffChannelstreamPlugin();
38 this.kickoffChannelstreamPlugin();
39 }.bind(this));
39 }.bind(this));
40 },
40 },
41
41
42 initPlugins: function(){
42 initPlugins: function(){
43 for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) {
43 for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) {
44 var pluginDef = window.APPLICATION_PLUGINS[i];
44 var pluginDef = window.APPLICATION_PLUGINS[i];
45 if (pluginDef.component){
45 if (pluginDef.component){
46 var pluginElem = document.createElement(pluginDef.component);
46 var pluginElem = document.createElement(pluginDef.component);
47 this.shadowRoot.appendChild(pluginElem);
47 this.shadowRoot.appendChild(pluginElem);
48 if (typeof pluginElem.init !== 'undefined'){
48 if (typeof pluginElem.init !== 'undefined'){
49 pluginElem.init();
49 pluginElem.init();
50 }
50 }
51 }
51 }
52 }
52 }
53 },
53 },
54 /** proxy to channelstream connection */
54 /** proxy to channelstream connection */
55 getChannelStreamConnection: function () {
55 getChannelStreamConnection: function () {
56 return this.$['channelstream-connection'];
56 return this.$['channelstream-connection'];
57 },
57 },
58
58
59 handleNotifications: function (data) {
59 handleNotifications: function (data) {
60 var elem = document.getElementById('notifications');
60 var elem = document.getElementById('notifications');
61 if(elem){
61 if(elem){
62 elem.handleNotification(data);
62 elem.handleNotification(data);
63 }
63 }
64
64
65 },
65 },
66
66
67 faviconUpdate: function (data) {
67 faviconUpdate: function (data) {
68 this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count;
68 this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count;
69 },
69 },
70
70
71 /** opens connection to ws server */
71 /** opens connection to ws server */
72 kickoffChannelstreamPlugin: function (data) {
72 kickoffChannelstreamPlugin: function (data) {
73 ccLog.debug('kickoffChannelstreamPlugin');
73 ccLog.debug('kickoffChannelstreamPlugin');
74 var channels = ['broadcast'];
74 var channels = ['broadcast'];
75 var addChannels = this.checkViewChannels();
75 var addChannels = this.checkViewChannels();
76 for (var i = 0; i < addChannels.length; i++) {
76 for (var i = 0; i < addChannels.length; i++) {
77 channels.push(addChannels[i]);
77 channels.push(addChannels[i]);
78 }
78 }
79 if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){
79 if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){
80 var channelstreamConnection = this.getChannelStreamConnection();
80 var channelstreamConnection = this.getChannelStreamConnection();
81 channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect;
81 channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect;
82 channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe;
82 channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe;
83 channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws';
83 channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws';
84 channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen';
84 channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen';
85 // some channels might already be registered by topic
85 // some channels might already be registered by topic
86 for (var i = 0; i < channels.length; i++) {
86 for (var i = 0; i < channels.length; i++) {
87 channelstreamConnection.push('channels', channels[i]);
87 channelstreamConnection.push('channels', channels[i]);
88 }
88 }
89 // append any additional channels registered in other plugins
89 // append any additional channels registered in other plugins
90 $.Topic('/connection_controller/subscribe').processPrepared();
90 $.Topic('/connection_controller/subscribe').processPrepared();
91 channelstreamConnection.connect();
91 channelstreamConnection.connect();
92 }
92 }
93 },
93 },
94
94
95 checkViewChannels: function () {
95 checkViewChannels: function () {
96 // subscribe to different channels data is sent.
96 // subscribe to different channels data is sent.
97
97
98 var channels = [];
98 var channels = [];
99 // subscribe to PR repo channel for PR's'
99 // subscribe to PR repo channel for PR's'
100 if (templateContext.pull_request_data.pull_request_id) {
100 if (templateContext.pull_request_data.pull_request_id) {
101 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
101 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
102 String(templateContext.pull_request_data.pull_request_id);
102 String(templateContext.pull_request_data.pull_request_id);
103 channels.push(channelName);
103 channels.push(channelName);
104 }
104 }
105
105
106 if (templateContext.commit_data.commit_id) {
106 if (templateContext.commit_data.commit_id) {
107 var channelName = '/repo$' + templateContext.repo_name + '$/commit/' +
107 var channelName = '/repo$' + templateContext.repo_name + '$/commit/' +
108 String(templateContext.commit_data.commit_id);
108 String(templateContext.commit_data.commit_id);
109 channels.push(channelName);
109 channels.push(channelName);
110 }
110 }
111
111
112 return channels;
112 return channels;
113 },
113 },
114
114
115 /** subscribes users from channels in channelstream */
115 /** subscribes users from channels in channelstream */
116 subscribeToChannelTopic: function (channels) {
116 subscribeToChannelTopic: function (channels) {
117 var channelstreamConnection = this.getChannelStreamConnection();
117 var channelstreamConnection = this.getChannelStreamConnection();
118 var toSubscribe = channelstreamConnection.calculateSubscribe(channels);
118 var toSubscribe = channelstreamConnection.calculateSubscribe(channels);
119 ccLog.debug('subscribeToChannelTopic', toSubscribe);
119 ccLog.debug('subscribeToChannelTopic', toSubscribe);
120 if (toSubscribe.length > 0) {
120 if (toSubscribe.length > 0) {
121 // if we are connected then subscribe
121 // if we are connected then subscribe
122 if (channelstreamConnection.connected) {
122 if (channelstreamConnection.connected) {
123 channelstreamConnection.subscribe(toSubscribe);
123 channelstreamConnection.subscribe(toSubscribe);
124 }
124 }
125 // not connected? just push channels onto the stack
125 // not connected? just push channels onto the stack
126 else {
126 else {
127 for (var i = 0; i < toSubscribe.length; i++) {
127 for (var i = 0; i < toSubscribe.length; i++) {
128 channelstreamConnection.push('channels', toSubscribe[i]);
128 channelstreamConnection.push('channels', toSubscribe[i]);
129 }
129 }
130 }
130 }
131 }
131 }
132 },
132 },
133
133
134 /** publish received messages into correct topic */
134 /** publish received messages into correct topic */
135 receivedMessage: function (event) {
135 receivedMessage: function (event) {
136 for (var i = 0; i < event.detail.length; i++) {
136 for (var i = 0; i < event.detail.length; i++) {
137 var message = event.detail[i];
137 var message = event.detail[i];
138 if (message.message.topic) {
138 if (message.message.topic) {
139 ccLog.debug('publishing', message.message.topic);
139 ccLog.debug('publishing', message.message.topic);
140 $.Topic(message.message.topic).publish(message);
140 $.Topic(message.message.topic).publish(message);
141 }
141 }
142 else if (message.type === 'presence'){
142 else if (message.type === 'presence'){
143 $.Topic('/connection_controller/presence').publish(message);
143 $.Topic('/connection_controller/presence').publish(message);
144 }
144 }
145 else {
145 else {
146 ccLog.warn('unhandled message', message);
146 ccLog.warn('unhandled message', message);
147 }
147 }
148 }
148 }
149 },
149 },
150
150
151 handleConnected: function (event) {
151 handleConnected: function (event) {
152 var channelstreamConnection = this.getChannelStreamConnection();
152 var channelstreamConnection = this.getChannelStreamConnection();
153 channelstreamConnection.set('channelsState',
153 channelstreamConnection.set('channelsState',
154 event.detail.channels_info);
154 event.detail.channels_info);
155 channelstreamConnection.set('userState', event.detail.state);
155 channelstreamConnection.set('userState', event.detail.state);
156 channelstreamConnection.set('channels', event.detail.channels);
156 channelstreamConnection.set('channels', event.detail.channels);
157 this.propagageChannelsState();
157 this.propagageChannelsState();
158 },
158 },
159 handleSubscribed: function (event) {
159 handleSubscribed: function (event) {
160 var channelstreamConnection = this.getChannelStreamConnection();
160 var channelstreamConnection = this.getChannelStreamConnection();
161 var channelInfo = event.detail.channels_info;
161 var channelInfo = event.detail.channels_info;
162 var channelKeys = Object.keys(event.detail.channels_info);
162 var channelKeys = Object.keys(event.detail.channels_info);
163 for (var i = 0; i < channelKeys.length; i++) {
163 for (var i = 0; i < channelKeys.length; i++) {
164 var key = channelKeys[i];
164 var key = channelKeys[i];
165 channelstreamConnection.set(['channelsState', key], channelInfo[key]);
165 channelstreamConnection.set(['channelsState', key], channelInfo[key]);
166 }
166 }
167 channelstreamConnection.set('channels', event.detail.channels);
167 channelstreamConnection.set('channels', event.detail.channels);
168 this.propagageChannelsState();
168 this.propagageChannelsState();
169 },
169 },
170 /** propagates channel states on topics */
170 /** propagates channel states on topics */
171 propagageChannelsState: function (event) {
171 propagageChannelsState: function (event) {
172 var channelstreamConnection = this.getChannelStreamConnection();
172 var channelstreamConnection = this.getChannelStreamConnection();
173 var channel_data = channelstreamConnection.channelsState;
173 var channel_data = channelstreamConnection.channelsState;
174 var channels = channelstreamConnection.channels;
174 var channels = channelstreamConnection.channels;
175 for (var i = 0; i < channels.length; i++) {
175 for (var i = 0; i < channels.length; i++) {
176 var key = channels[i];
176 var key = channels[i];
177 $.Topic('/connection_controller/channel_update').publish(
177 $.Topic('/connection_controller/channel_update').publish(
178 {channel: key, state: channel_data[key]}
178 {channel: key, state: channel_data[key]}
179 );
179 );
180 }
180 }
181 }
181 }
182 });
182 });
183
183
184 </script>
184 </script>
185 </dom-module>
185 </dom-module>
@@ -1,123 +1,200 b''
1 <link rel="import" href="../../../../../../bower_components/paper-button/paper-button.html">
1 <link rel="import" href="../../../../../../bower_components/paper-button/paper-button.html">
2 <link rel="import" href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
2 <link rel="import" href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
3 <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
3 <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
4 <dom-module id="rhodecode-toast">
4 <dom-module id="rhodecode-toast">
5 <template>
5 <template>
6 <style include="shared-styles"></style>
6 <style include="shared-styles">
7 <link rel="stylesheet" href="rhodecode-toast.css">
7 /* inset border for buttons - does not work in ie */
8 /* rounded borders */
9 /* rounded borders - bottom only */
10 /* rounded borders - top only */
11 /* text shadow */
12 /* centers text in a circle - input diameter of circle and color */
13 /* pill version of the circle */
14 .absolute-center {
15 margin: auto;
16 position: absolute;
17 top: 0;
18 left: 0;
19 bottom: 0;
20 right: 0;
21 }
22 .top-left-rounded-corner {
23 -webkit-border-top-left-radius: 2px;
24 -khtml-border-radius-topleft: 2px;
25 border-top-left-radius: 2px;
26 }
27 .top-right-rounded-corner {
28 -webkit-border-top-right-radius: 2px;
29 -khtml-border-radius-topright: 2px;
30 border-top-right-radius: 2px;
31 }
32 .bottom-left-rounded-corner {
33 -webkit-border-bottom-left-radius: 2px;
34 -khtml-border-radius-bottomleft: 2px;
35 border-bottom-left-radius: 2px;
36 }
37 .bottom-right-rounded-corner {
38 -webkit-border-bottom-right-radius: 2px;
39 -khtml-border-radius-bottomright: 2px;
40 border-bottom-right-radius: 2px;
41 }
42 .top-left-rounded-corner-mid {
43 -webkit-border-top-left-radius: 2px;
44 -khtml-border-radius-topleft: 2px;
45 border-top-left-radius: 2px;
46 }
47 .top-right-rounded-corner-mid {
48 -webkit-border-top-right-radius: 2px;
49 -khtml-border-radius-topright: 2px;
50 border-top-right-radius: 2px;
51 }
52 .bottom-left-rounded-corner-mid {
53 -webkit-border-bottom-left-radius: 2px;
54 -khtml-border-radius-bottomleft: 2px;
55 border-bottom-left-radius: 2px;
56 }
57 .bottom-right-rounded-corner-mid {
58 -webkit-border-bottom-right-radius: 2px;
59 -khtml-border-radius-bottomright: 2px;
60 border-bottom-right-radius: 2px;
61 }
62 .alert {
63 margin: 10px 0;
64 }
65 .toast-close {
66 margin: 0;
67 float: right;
68 cursor: pointer;
69 }
70 .toast-message-holder {
71 background: rgba(255, 255, 255, 0.25);
72 }
73 .toast-message-holder.fixed {
74 position: fixed;
75 padding: 10px 0;
76 margin-left: 10px;
77 margin-right: 10px;
78 top: 0;
79 left: 0;
80 right: 0;
81 z-index: 100;
82 }
83 </style>
84
8 <template is="dom-if" if="[[hasToasts]]">
85 <template is="dom-if" if="[[hasToasts]]">
9 <div class$="container toast-message-holder [[conditionalClass(isFixed)]]">
86 <div class$="container toast-message-holder [[conditionalClass(isFixed)]]">
10 <template is="dom-repeat" items="[[toasts]]">
87 <template is="dom-repeat" items="[[toasts]]">
11 <div class$="alert alert-[[item.level]]">
88 <div class$="alert alert-[[item.level]]">
12 <div on-tap="dismissNotification" class="toast-close" index-pos="[[index]]">
89 <div on-tap="dismissNotification" class="toast-close" index-pos="[[index]]">
13 <span>[[_gettext('Close')]]</span>
90 <span>[[_gettext('Close')]]</span>
14 </div>
91 </div>
15 <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html>
92 <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html>
16 </div>
93 </div>
17 </template>
94 </template>
18 </div>
95 </div>
19 </template>
96 </template>
20 </template>
97 </template>
21
98
22 <script>
99 <script>
23 Polymer({
100 Polymer({
24 is: 'rhodecode-toast',
101 is: 'rhodecode-toast',
25 properties: {
102 properties: {
26 toasts: {
103 toasts: {
27 type: Array,
104 type: Array,
28 value: function(){
105 value: function(){
29 return []
106 return []
30 }
107 }
31 },
108 },
32 isFixed: {
109 isFixed: {
33 type: Boolean,
110 type: Boolean,
34 value: false
111 value: false
35 },
112 },
36 hasToasts: {
113 hasToasts: {
37 type: Boolean,
114 type: Boolean,
38 computed: '_computeHasToasts(toasts.*)'
115 computed: '_computeHasToasts(toasts.*)'
39 },
116 },
40 keyEventTarget: {
117 keyEventTarget: {
41 type: Object,
118 type: Object,
42 value: function() {
119 value: function() {
43 return document.body;
120 return document.body;
44 }
121 }
45 }
122 }
46 },
123 },
47 behaviors: [
124 behaviors: [
48 Polymer.IronA11yKeysBehavior
125 Polymer.IronA11yKeysBehavior
49 ],
126 ],
50 observers: [
127 observers: [
51 '_changedToasts(toasts.splices)'
128 '_changedToasts(toasts.splices)'
52 ],
129 ],
53
130
54 keyBindings: {
131 keyBindings: {
55 'esc:keyup': '_hideOnEsc'
132 'esc:keyup': '_hideOnEsc'
56 },
133 },
57
134
58 _hideOnEsc: function (event) {
135 _hideOnEsc: function (event) {
59 return this.dismissNotifications();
136 return this.dismissNotifications();
60 },
137 },
61
138
62 _computeHasToasts: function(){
139 _computeHasToasts: function(){
63 return this.toasts.length > 0;
140 return this.toasts.length > 0;
64 },
141 },
65
142
66 _debouncedCalc: function(){
143 _debouncedCalc: function(){
67 // calculate once in a while
144 // calculate once in a while
68 this.debounce('debouncedCalc', this.toastInWindow, 25);
145 this.debounce('debouncedCalc', this.toastInWindow, 25);
69 },
146 },
70
147
71 conditionalClass: function(){
148 conditionalClass: function(){
72 return this.isFixed ? 'fixed': '';
149 return this.isFixed ? 'fixed': '';
73 },
150 },
74
151
75 toastInWindow: function() {
152 toastInWindow: function() {
76 if (!this._headerNode){
153 if (!this._headerNode){
77 return true
154 return true
78 }
155 }
79 var headerHeight = this._headerNode.offsetHeight;
156 var headerHeight = this._headerNode.offsetHeight;
80 var scrollPosition = window.scrollY;
157 var scrollPosition = window.scrollY;
81
158
82 if (this.isFixed){
159 if (this.isFixed){
83 this.isFixed = 1 <= scrollPosition;
160 this.isFixed = 1 <= scrollPosition;
84 }
161 }
85 else{
162 else{
86 this.isFixed = headerHeight <= scrollPosition;
163 this.isFixed = headerHeight <= scrollPosition;
87 }
164 }
88 },
165 },
89
166
90 attached: function(){
167 attached: function(){
91 this._headerNode = document.querySelector('.header', document);
168 this._headerNode = document.querySelector('.header', document);
92 this.listen(window,'scroll', '_debouncedCalc');
169 this.listen(window,'scroll', '_debouncedCalc');
93 this.listen(window,'resize', '_debouncedCalc');
170 this.listen(window,'resize', '_debouncedCalc');
94 this._debouncedCalc();
171 this._debouncedCalc();
95 },
172 },
96 _changedToasts: function(newValue, oldValue){
173 _changedToasts: function(newValue, oldValue){
97 $.Topic('/favicon/update').publish({count: this.toasts.length});
174 $.Topic('/favicon/update').publish({count: this.toasts.length});
98 },
175 },
99 dismissNotification: function(e) {
176 dismissNotification: function(e) {
100 $.Topic('/favicon/update').publish({count: this.toasts.length-1});
177 $.Topic('/favicon/update').publish({count: this.toasts.length-1});
101 var idx = e.target.parentNode.indexPos
178 var idx = e.target.parentNode.indexPos
102 this.splice('toasts', idx, 1);
179 this.splice('toasts', idx, 1);
103
180
104 },
181 },
105 dismissNotifications: function(){
182 dismissNotifications: function(){
106 $.Topic('/favicon/update').publish({count: 0});
183 $.Topic('/favicon/update').publish({count: 0});
107 this.splice('toasts', 0);
184 this.splice('toasts', 0);
108 },
185 },
109 handleNotification: function(data){
186 handleNotification: function(data){
110 if (!templateContext.rhodecode_user.notification_status && !data.message.force) {
187 if (!templateContext.rhodecode_user.notification_status && !data.message.force) {
111 // do not act if notifications are disabled
188 // do not act if notifications are disabled
112 return
189 return
113 }
190 }
114 this.push('toasts',{
191 this.push('toasts',{
115 level: data.message.level,
192 level: data.message.level,
116 message: data.message.message
193 message: data.message.message
117 });
194 });
118 },
195 },
119 _gettext: _gettext
196 _gettext: _gettext
120 });
197 });
121
198
122 </script>
199 </script>
123 </dom-module>
200 </dom-module>
@@ -1,37 +1,48 b''
1 <link rel="import" href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html">
1 <link rel="import" href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html">
2 <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html">
2 <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html">
3 <link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html">
3 <link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html">
4
4
5 <dom-module id="rhodecode-toggle">
5 <dom-module id="rhodecode-toggle">
6
6
7 <style include="shared-styles"></style>
7 <style include="shared-styles">
8 <link rel="stylesheet" href="rhodecode-toggle.css">
8 .rc-toggle {
9 float: left;
10 position: relative;
11 }
12 .rc-toggle paper-spinner {
13 position: absolute;
14 top: 0;
15 left: -30px;
16 width: 20px;
17 height: 20px;
18 }
19 </style>
9
20
10 <template>
21 <template>
11 <div class="rc-toggle">
22 <div class="rc-toggle">
12 <paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button>
23 <paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button>
13 <paper-tooltip>[[tooltipText]]</paper-tooltip>
24 <paper-tooltip>[[tooltipText]]</paper-tooltip>
14 <template is="dom-if" if="[[shouldShow(noSpinner)]]">
25 <template is="dom-if" if="[[shouldShow(noSpinner)]]">
15 <paper-spinner active=[[active]]></paper-spinner>
26 <paper-spinner active=[[active]]></paper-spinner>
16 </template>
27 </template>
17 </div>
28 </div>
18 </template>
29 </template>
19
30
20 <script>
31 <script>
21 Polymer({
32 Polymer({
22 is: 'rhodecode-toggle',
33 is: 'rhodecode-toggle',
23 properties: {
34 properties: {
24 noSpinner: { type: Boolean, value: false, reflectToAttribute:true},
35 noSpinner: { type: Boolean, value: false, reflectToAttribute:true},
25 tooltipText: { type: String, value: "Click to toggle", reflectToAttribute:true},
36 tooltipText: { type: String, value: "Click to toggle", reflectToAttribute:true},
26 checked: { type: Boolean, value: false, reflectToAttribute:true},
37 checked: { type: Boolean, value: false, reflectToAttribute:true},
27 active: { type: Boolean, value: false, reflectToAttribute:true, notify:true}
38 active: { type: Boolean, value: false, reflectToAttribute:true, notify:true}
28 },
39 },
29 shouldShow: function(){
40 shouldShow: function(){
30 return !this.noSpinner
41 return !this.noSpinner
31 },
42 },
32 labelStatus: function(isActive){
43 labelStatus: function(isActive){
33 return this.checked? 'Enabled' : "Disabled"
44 return this.checked? 'Enabled' : "Disabled"
34 }
45 }
35 });
46 });
36 </script>
47 </script>
37 </dom-module>
48 </dom-module>
@@ -1,3 +1,3 b''
1 <dom-module id="root-styles">
1 <dom-module id="shared-styles">
2 <template>
2 <template>
3 <style>
3 <style>
@@ -1,162 +1,161 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 go_import_header = ''
6 go_import_header = ''
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, 'repo_group', None):
11 if getattr(c, 'repo_group', None):
12 c.template_context['repo_group_id'] = c.repo_group.group_id
12 c.template_context['repo_group_id'] = c.repo_group.group_id
13
13
14 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
14 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
15 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
15 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
16 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
16 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
17 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
17 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
18 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
18 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
19 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
19 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
20
20
21 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
21 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
22 c.template_context['default_user'] = {
22 c.template_context['default_user'] = {
23 'username': h.DEFAULT_USER,
23 'username': h.DEFAULT_USER,
24 'user_id': 1
24 'user_id': 1
25 }
25 }
26
26
27 %>
27 %>
28 <html xmlns="http://www.w3.org/1999/xhtml">
28 <html xmlns="http://www.w3.org/1999/xhtml">
29 <head>
29 <head>
30 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script>
30 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script>
31 <title>${self.title()}</title>
31 <title>${self.title()}</title>
32 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
32 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
33
33
34 ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))}
34 ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))}
35
35
36 % if 'safari' in (request.user_agent or '').lower():
36 % if 'safari' in (request.user_agent or '').lower():
37 <meta name="referrer" content="origin">
37 <meta name="referrer" content="origin">
38 % else:
38 % else:
39 <meta name="referrer" content="origin-when-cross-origin">
39 <meta name="referrer" content="origin-when-cross-origin">
40 % endif
40 % endif
41
41
42 <%def name="robots()">
42 <%def name="robots()">
43 <meta name="robots" content="index, nofollow"/>
43 <meta name="robots" content="index, nofollow"/>
44 </%def>
44 </%def>
45 ${self.robots()}
45 ${self.robots()}
46 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
46 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
47
47
48 ## CSS definitions
48 ## CSS definitions
49 <%def name="css()">
49 <%def name="css()">
50 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
50 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
51 <!--[if lt IE 9]>
51 <!--[if lt IE 9]>
52 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
52 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
53 <![endif]-->
53 <![endif]-->
54 ## EXTRA FOR CSS
54 ## EXTRA FOR CSS
55 ${self.css_extra()}
55 ${self.css_extra()}
56 </%def>
56 </%def>
57 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
57 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
58 <%def name="css_extra()">
58 <%def name="css_extra()">
59 </%def>
59 </%def>
60
60
61 ${self.css()}
61 ${self.css()}
62
62
63 ## JAVASCRIPT
63 ## JAVASCRIPT
64 <%def name="js()">
64 <%def name="js()">
65
65
66 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
66 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
67 <script type="text/javascript">
67 <script type="text/javascript">
68 // register templateContext to pass template variables to JS
68 // register templateContext to pass template variables to JS
69 var templateContext = ${h.json.dumps(c.template_context)|n};
69 var templateContext = ${h.json.dumps(c.template_context)|n};
70
70
71 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
71 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
72 var APPLICATION_PLUGINS = [];
72 var APPLICATION_PLUGINS = [];
73 var ASSET_URL = "${h.asset('')}";
73 var ASSET_URL = "${h.asset('')}";
74 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
74 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
75 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
75 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
76
76
77 var APPENLIGHT = {
77 var APPENLIGHT = {
78 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
78 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
79 key: '${getattr(c, "appenlight_api_public_key", "")}',
79 key: '${getattr(c, "appenlight_api_public_key", "")}',
80 % if getattr(c, 'appenlight_server_url', None):
80 % if getattr(c, 'appenlight_server_url', None):
81 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
81 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
82 % endif
82 % endif
83 requestInfo: {
83 requestInfo: {
84 % if getattr(c, 'rhodecode_user', None):
84 % if getattr(c, 'rhodecode_user', None):
85 ip: '${c.rhodecode_user.ip_addr}',
85 ip: '${c.rhodecode_user.ip_addr}',
86 username: '${c.rhodecode_user.username}'
86 username: '${c.rhodecode_user.username}'
87 % endif
87 % endif
88 },
88 },
89 tags: {
89 tags: {
90 rhodecode_version: '${c.rhodecode_version}',
90 rhodecode_version: '${c.rhodecode_version}',
91 rhodecode_edition: '${c.rhodecode_edition}'
91 rhodecode_edition: '${c.rhodecode_edition}'
92 }
92 }
93 };
93 };
94
94
95 </script>
95 </script>
96 <%include file="/base/plugins_base.mako"/>
96 <%include file="/base/plugins_base.mako"/>
97 <!--[if lt IE 9]>
97 <!--[if lt IE 9]>
98 <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script>
98 <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script>
99 <![endif]-->
99 <![endif]-->
100 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
100 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
101 <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script>
101 <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script>
102 ## avoide escaping the %N
102 ## avoide escaping the %N
103 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
103 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
104 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
105 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
104 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
106
105
107
106
108 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
107 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
109 ${self.js_extra()}
108 ${self.js_extra()}
110
109
111 <script type="text/javascript">
110 <script type="text/javascript">
112 Rhodecode = (function() {
111 Rhodecode = (function() {
113 function _Rhodecode() {
112 function _Rhodecode() {
114 this.comments = new CommentsController();
113 this.comments = new CommentsController();
115 }
114 }
116 return new _Rhodecode();
115 return new _Rhodecode();
117 })();
116 })();
118
117
119 $(document).ready(function(){
118 $(document).ready(function(){
120 show_more_event();
119 show_more_event();
121 timeagoActivate();
120 timeagoActivate();
122 clipboardActivate();
121 clipboardActivate();
123 })
122 })
124 </script>
123 </script>
125
124
126 </%def>
125 </%def>
127
126
128 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
127 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
129 <%def name="js_extra()"></%def>
128 <%def name="js_extra()"></%def>
130 ${self.js()}
129 ${self.js()}
131
130
132 <%def name="head_extra()"></%def>
131 <%def name="head_extra()"></%def>
133 ${self.head_extra()}
132 ${self.head_extra()}
134 ## extra stuff
133 ## extra stuff
135 %if c.pre_code:
134 %if c.pre_code:
136 ${c.pre_code|n}
135 ${c.pre_code|n}
137 %endif
136 %endif
138 </head>
137 </head>
139 <body id="body">
138 <body id="body">
140 <noscript>
139 <noscript>
141 <div class="noscript-error">
140 <div class="noscript-error">
142 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
141 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
143 </div>
142 </div>
144 </noscript>
143 </noscript>
145 ## IE hacks
144 ## IE hacks
146 <!--[if IE 7]>
145 <!--[if IE 7]>
147 <script>$(document.body).addClass('ie7')</script>
146 <script>$(document.body).addClass('ie7')</script>
148 <![endif]-->
147 <![endif]-->
149 <!--[if IE 8]>
148 <!--[if IE 8]>
150 <script>$(document.body).addClass('ie8')</script>
149 <script>$(document.body).addClass('ie8')</script>
151 <![endif]-->
150 <![endif]-->
152 <!--[if IE 9]>
151 <!--[if IE 9]>
153 <script>$(document.body).addClass('ie9')</script>
152 <script>$(document.body).addClass('ie9')</script>
154 <![endif]-->
153 <![endif]-->
155
154
156 ${next.body()}
155 ${next.body()}
157 %if c.post_code:
156 %if c.post_code:
158 ${c.post_code|n}
157 ${c.post_code|n}
159 %endif
158 %endif
160 <rhodecode-app></rhodecode-app>
159 <rhodecode-app></rhodecode-app>
161 </body>
160 </body>
162 </html>
161 </html>
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now