Show More
@@ -1,10 +1,10 b'' | |||||
1 | { |
|
1 | { | |
2 | "presets": [ |
|
2 | "presets": [ | |
3 | ["env", { |
|
3 | ["env", { | |
4 | "targets": { |
|
4 | "targets": { | |
5 | "browsers": ["last 2 versions"] |
|
5 | "browsers": ["last 2 versions"] | |
6 | } |
|
6 | } | |
7 | }] |
|
7 | }] | |
8 | ], |
|
8 | ], | |
9 |
|
|
9 | "plugins": ["transform-object-rest-spread"] | |
10 | } |
|
10 | } |
@@ -1,176 +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/ |
|
19 | "src": "webcomponentsjs/*.*", | |
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 | "<%= dirs.js.dest %>/rhodecode-components.js" | |
98 | ], |
|
98 | ], | |
99 | "dest": "<%= dirs.js.dest %>/scripts.js", |
|
99 | "dest": "<%= dirs.js.dest %>/scripts.js", | |
100 | "nonull": true |
|
100 | "nonull": true | |
101 | } |
|
101 | } | |
102 | }, |
|
102 | }, | |
103 | "less": { |
|
103 | "less": { | |
104 | "development": { |
|
104 | "development": { | |
105 | "options": { |
|
105 | "options": { | |
106 | "compress": false, |
|
106 | "compress": false, | |
107 | "yuicompress": false, |
|
107 | "yuicompress": false, | |
108 | "optimization": 0 |
|
108 | "optimization": 0 | |
109 | }, |
|
109 | }, | |
110 | "files": { |
|
110 | "files": { | |
111 | "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less", |
|
111 | "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less", | |
112 | "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less" |
|
112 | "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less" | |
113 | } |
|
113 | } | |
114 | }, |
|
114 | }, | |
115 | "production": { |
|
115 | "production": { | |
116 | "options": { |
|
116 | "options": { | |
117 | "compress": true, |
|
117 | "compress": true, | |
118 | "yuicompress": true, |
|
118 | "yuicompress": true, | |
119 | "optimization": 2 |
|
119 | "optimization": 2 | |
120 | }, |
|
120 | }, | |
121 | "files": { |
|
121 | "files": { | |
122 | "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less", |
|
122 | "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less", | |
123 | "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less" |
|
123 | "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less" | |
124 | } |
|
124 | } | |
125 | }, |
|
125 | }, | |
126 | "components": { |
|
126 | "components": { | |
127 | "files": [ |
|
127 | "files": [ | |
128 | { |
|
128 | { | |
129 | "cwd": "<%= dirs.js.src %>/components/", |
|
129 | "cwd": "<%= dirs.js.src %>/components/", | |
130 | "dest": "<%= dirs.js.src %>/components/", |
|
130 | "dest": "<%= dirs.js.src %>/components/", | |
131 | "src": [ |
|
131 | "src": [ | |
132 | "**/*.less" |
|
132 | "**/*.less" | |
133 | ], |
|
133 | ], | |
134 | "expand": true, |
|
134 | "expand": true, | |
135 | "ext": ".css" |
|
135 | "ext": ".css" | |
136 | } |
|
136 | } | |
137 | ] |
|
137 | ] | |
138 | } |
|
138 | } | |
139 | }, |
|
139 | }, | |
140 | "watch": { |
|
140 | "watch": { | |
141 | "less": { |
|
141 | "less": { | |
142 | "files": [ |
|
142 | "files": [ | |
143 | "<%= dirs.css.src %>/**/*.less", |
|
143 | "<%= dirs.css.src %>/**/*.less", | |
144 | "<%= dirs.js.src %>/components/**/*.less" |
|
144 | "<%= dirs.js.src %>/components/**/*.less" | |
145 | ], |
|
145 | ], | |
146 | "tasks": [ |
|
146 | "tasks": [ | |
147 | "less:development", |
|
147 | "less:development", | |
148 | "less:components", |
|
148 | "less:components", | |
149 | "concat:polymercss", |
|
149 | "concat:polymercss", | |
150 | "webpack", |
|
150 | "webpack", | |
151 | "concat:dist" |
|
151 | "concat:dist" | |
152 | ] |
|
152 | ] | |
153 | }, |
|
153 | }, | |
154 | "js": { |
|
154 | "js": { | |
155 | "files": [ |
|
155 | "files": [ | |
156 | "!<%= dirs.js.src %>/components/root-styles.gen.html", |
|
156 | "!<%= dirs.js.src %>/components/root-styles.gen.html", | |
157 | "<%= dirs.js.src %>/**/*.js", |
|
157 | "<%= dirs.js.src %>/**/*.js", | |
158 | "<%= dirs.js.src %>/components/**/*.html" |
|
158 | "<%= dirs.js.src %>/components/**/*.html" | |
159 | ], |
|
159 | ], | |
160 | "tasks": [ |
|
160 | "tasks": [ | |
161 | "less:components", |
|
161 | "less:components", | |
162 | "concat:polymercss", |
|
162 | "concat:polymercss", | |
163 | "webpack", |
|
163 | "webpack", | |
164 | "concat:dist" |
|
164 | "concat:dist" | |
165 | ] |
|
165 | ] | |
166 | } |
|
166 | } | |
167 | }, |
|
167 | }, | |
168 | "jshint": { |
|
168 | "jshint": { | |
169 | "rhodecode": { |
|
169 | "rhodecode": { | |
170 | "src": "<%= dirs.js.src %>/rhodecode/**/*.js", |
|
170 | "src": "<%= dirs.js.src %>/rhodecode/**/*.js", | |
171 | "options": { |
|
171 | "options": { | |
172 | "jshintrc": ".jshintrc" |
|
172 | "jshintrc": ".jshintrc" | |
173 | } |
|
173 | } | |
174 | } |
|
174 | } | |
175 | } |
|
175 | } | |
176 | } |
|
176 | } |
@@ -1,185 +1,195 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 | var ccLog = Logger.get('RhodeCodeApp'); |
|
17 | var ccLog = Logger.get('RhodeCodeApp'); | |
18 | ccLog.setLevel(Logger.OFF); |
|
18 | ccLog.setLevel(Logger.OFF); | |
19 |
|
19 | |||
20 |
|
|
20 | class RhodecodeApp extends Polymer.Element { | |
21 | is: 'rhodecode-app', |
|
21 | ||
22 |
|
|
22 | static get is() { | |
|
23 | return 'rhodecode-app'; | |||
|
24 | } | |||
|
25 | ||||
|
26 | connectedCallback() { | |||
|
27 | super.connectedCallback(); | |||
23 | ccLog.debug('rhodeCodeApp created'); |
|
28 | ccLog.debug('rhodeCodeApp created'); | |
24 | $.Topic('/notifications').subscribe(this.handleNotifications.bind(this)); |
|
29 | $.Topic('/notifications').subscribe(this.handleNotifications.bind(this)); | |
25 | $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this)); |
|
30 | $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this)); | |
26 | $.Topic('/connection_controller/subscribe').subscribe( |
|
31 | $.Topic('/connection_controller/subscribe').subscribe( | |
27 | this.subscribeToChannelTopic.bind(this)); |
|
32 | this.subscribeToChannelTopic.bind(this)); | |
28 | // this event can be used to coordinate plugins to do their |
|
33 | // this event can be used to coordinate plugins to do their | |
29 | // initialization before channelstream is kicked off |
|
34 | // initialization before channelstream is kicked off | |
30 | $.Topic('/__MAIN_APP__').publish({}); |
|
35 | $.Topic('/__MAIN_APP__').publish({}); | |
31 |
|
36 | |||
32 | for (var i = 0; i < alertMessagePayloads.length; i++) { |
|
37 | for (var i = 0; i < alertMessagePayloads.length; i++) { | |
33 | $.Topic('/notifications').publish(alertMessagePayloads[i]); |
|
38 | $.Topic('/notifications').publish(alertMessagePayloads[i]); | |
34 | } |
|
39 | } | |
35 | this.initPlugins(); |
|
40 | this.initPlugins(); | |
36 | // after rest of application loads and topics get fired, launch connection |
|
41 | // after rest of application loads and topics get fired, launch connection | |
37 | $(document).ready(function () { |
|
42 | $(document).ready(function () { | |
38 | this.kickoffChannelstreamPlugin(); |
|
43 | this.kickoffChannelstreamPlugin(); | |
39 | }.bind(this)); |
|
44 | }.bind(this)); | |
40 |
} |
|
45 | } | |
41 |
|
46 | |||
42 |
initPlugins |
|
47 | initPlugins() { | |
43 | for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) { |
|
48 | for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) { | |
44 | var pluginDef = window.APPLICATION_PLUGINS[i]; |
|
49 | var pluginDef = window.APPLICATION_PLUGINS[i]; | |
45 | if (pluginDef.component){ |
|
50 | if (pluginDef.component) { | |
46 | var pluginElem = document.createElement(pluginDef.component); |
|
51 | var pluginElem = document.createElement(pluginDef.component); | |
47 | this.shadowRoot.appendChild(pluginElem); |
|
52 | this.shadowRoot.appendChild(pluginElem); | |
48 | if (typeof pluginElem.init !== 'undefined'){ |
|
53 | if (typeof pluginElem.init !== 'undefined') { | |
49 | pluginElem.init(); |
|
54 | pluginElem.init(); | |
50 | } |
|
55 | } | |
51 | } |
|
56 | } | |
52 | } |
|
57 | } | |
53 |
} |
|
58 | } | |
|
59 | ||||
54 | /** proxy to channelstream connection */ |
|
60 | /** proxy to channelstream connection */ | |
55 |
getChannelStreamConnection |
|
61 | getChannelStreamConnection() { | |
56 | return this.$['channelstream-connection']; |
|
62 | return this.$['channelstream-connection']; | |
57 |
} |
|
63 | } | |
58 |
|
64 | |||
59 |
handleNotifications |
|
65 | handleNotifications(data) { | |
60 | var elem = document.getElementById('notifications'); |
|
66 | var elem = document.getElementById('notifications'); | |
61 | if(elem){ |
|
67 | if (elem) { | |
62 | elem.handleNotification(data); |
|
68 | elem.handleNotification(data); | |
63 | } |
|
69 | } | |
64 |
|
70 | |||
65 |
} |
|
71 | } | |
66 |
|
72 | |||
67 |
faviconUpdate |
|
73 | faviconUpdate(data) { | |
68 | this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count; |
|
74 | this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count; | |
69 |
} |
|
75 | } | |
70 |
|
76 | |||
71 | /** opens connection to ws server */ |
|
77 | /** opens connection to ws server */ | |
72 |
kickoffChannelstreamPlugin |
|
78 | kickoffChannelstreamPlugin(data) { | |
73 | ccLog.debug('kickoffChannelstreamPlugin'); |
|
79 | ccLog.debug('kickoffChannelstreamPlugin'); | |
74 | var channels = ['broadcast']; |
|
80 | var channels = ['broadcast']; | |
75 | var addChannels = this.checkViewChannels(); |
|
81 | var addChannels = this.checkViewChannels(); | |
76 | for (var i = 0; i < addChannels.length; i++) { |
|
82 | for (var i = 0; i < addChannels.length; i++) { | |
77 | channels.push(addChannels[i]); |
|
83 | channels.push(addChannels[i]); | |
78 | } |
|
84 | } | |
79 | if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){ |
|
85 | if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled) { | |
80 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
86 | var channelstreamConnection = this.getChannelStreamConnection(); | |
81 | channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect; |
|
87 | channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect; | |
82 | channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe; |
|
88 | channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe; | |
83 | channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws'; |
|
89 | channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws'; | |
84 | channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen'; |
|
90 | channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen'; | |
85 | // some channels might already be registered by topic |
|
91 | // some channels might already be registered by topic | |
86 | for (var i = 0; i < channels.length; i++) { |
|
92 | for (var i = 0; i < channels.length; i++) { | |
87 | channelstreamConnection.push('channels', channels[i]); |
|
93 | channelstreamConnection.push('channels', channels[i]); | |
88 | } |
|
94 | } | |
89 | // append any additional channels registered in other plugins |
|
95 | // append any additional channels registered in other plugins | |
90 | $.Topic('/connection_controller/subscribe').processPrepared(); |
|
96 | $.Topic('/connection_controller/subscribe').processPrepared(); | |
91 | channelstreamConnection.connect(); |
|
97 | channelstreamConnection.connect(); | |
92 | } |
|
98 | } | |
93 |
} |
|
99 | } | |
94 |
|
100 | |||
95 |
checkViewChannels |
|
101 | checkViewChannels() { | |
96 | // subscribe to different channels data is sent. |
|
102 | // subscribe to different channels data is sent. | |
97 |
|
103 | |||
98 | var channels = []; |
|
104 | var channels = []; | |
99 | // subscribe to PR repo channel for PR's' |
|
105 | // subscribe to PR repo channel for PR's' | |
100 | if (templateContext.pull_request_data.pull_request_id) { |
|
106 | if (templateContext.pull_request_data.pull_request_id) { | |
101 | var channelName = '/repo$' + templateContext.repo_name + '$/pr/' + |
|
107 | var channelName = '/repo$' + templateContext.repo_name + '$/pr/' + | |
102 | String(templateContext.pull_request_data.pull_request_id); |
|
108 | String(templateContext.pull_request_data.pull_request_id); | |
103 | channels.push(channelName); |
|
109 | channels.push(channelName); | |
104 | } |
|
110 | } | |
105 |
|
111 | |||
106 | if (templateContext.commit_data.commit_id) { |
|
112 | if (templateContext.commit_data.commit_id) { | |
107 | var channelName = '/repo$' + templateContext.repo_name + '$/commit/' + |
|
113 | var channelName = '/repo$' + templateContext.repo_name + '$/commit/' + | |
108 | String(templateContext.commit_data.commit_id); |
|
114 | String(templateContext.commit_data.commit_id); | |
109 | channels.push(channelName); |
|
115 | channels.push(channelName); | |
110 | } |
|
116 | } | |
111 |
|
117 | |||
112 | return channels; |
|
118 | return channels; | |
113 |
} |
|
119 | } | |
114 |
|
120 | |||
115 | /** subscribes users from channels in channelstream */ |
|
121 | /** subscribes users from channels in channelstream */ | |
116 |
subscribeToChannelTopic |
|
122 | subscribeToChannelTopic(channels) { | |
117 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
123 | var channelstreamConnection = this.getChannelStreamConnection(); | |
118 | var toSubscribe = channelstreamConnection.calculateSubscribe(channels); |
|
124 | var toSubscribe = channelstreamConnection.calculateSubscribe(channels); | |
119 | ccLog.debug('subscribeToChannelTopic', toSubscribe); |
|
125 | ccLog.debug('subscribeToChannelTopic', toSubscribe); | |
120 | if (toSubscribe.length > 0) { |
|
126 | if (toSubscribe.length > 0) { | |
121 | // if we are connected then subscribe |
|
127 | // if we are connected then subscribe | |
122 | if (channelstreamConnection.connected) { |
|
128 | if (channelstreamConnection.connected) { | |
123 | channelstreamConnection.subscribe(toSubscribe); |
|
129 | channelstreamConnection.subscribe(toSubscribe); | |
124 | } |
|
130 | } | |
125 | // not connected? just push channels onto the stack |
|
131 | // not connected? just push channels onto the stack | |
126 | else { |
|
132 | else { | |
127 | for (var i = 0; i < toSubscribe.length; i++) { |
|
133 | for (var i = 0; i < toSubscribe.length; i++) { | |
128 | channelstreamConnection.push('channels', toSubscribe[i]); |
|
134 | channelstreamConnection.push('channels', toSubscribe[i]); | |
129 | } |
|
135 | } | |
130 | } |
|
136 | } | |
131 | } |
|
137 | } | |
132 |
} |
|
138 | } | |
133 |
|
139 | |||
134 | /** publish received messages into correct topic */ |
|
140 | /** publish received messages into correct topic */ | |
135 |
receivedMessage |
|
141 | receivedMessage(event) { | |
136 | for (var i = 0; i < event.detail.length; i++) { |
|
142 | for (var i = 0; i < event.detail.length; i++) { | |
137 | var message = event.detail[i]; |
|
143 | var message = event.detail[i]; | |
138 | if (message.message.topic) { |
|
144 | if (message.message.topic) { | |
139 | ccLog.debug('publishing', message.message.topic); |
|
145 | ccLog.debug('publishing', message.message.topic); | |
140 | $.Topic(message.message.topic).publish(message); |
|
146 | $.Topic(message.message.topic).publish(message); | |
141 | } |
|
147 | } | |
142 | else if (message.type === 'presence'){ |
|
148 | else if (message.type === 'presence') { | |
143 | $.Topic('/connection_controller/presence').publish(message); |
|
149 | $.Topic('/connection_controller/presence').publish(message); | |
144 | } |
|
150 | } | |
145 | else { |
|
151 | else { | |
146 | ccLog.warn('unhandled message', message); |
|
152 | ccLog.warn('unhandled message', message); | |
147 | } |
|
153 | } | |
148 | } |
|
154 | } | |
149 |
} |
|
155 | } | |
150 |
|
156 | |||
151 |
handleConnected |
|
157 | handleConnected(event) { | |
152 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
158 | var channelstreamConnection = this.getChannelStreamConnection(); | |
153 | channelstreamConnection.set('channelsState', |
|
159 | channelstreamConnection.set('channelsState', | |
154 | event.detail.channels_info); |
|
160 | event.detail.channels_info); | |
155 | channelstreamConnection.set('userState', event.detail.state); |
|
161 | channelstreamConnection.set('userState', event.detail.state); | |
156 | channelstreamConnection.set('channels', event.detail.channels); |
|
162 | channelstreamConnection.set('channels', event.detail.channels); | |
157 | this.propagageChannelsState(); |
|
163 | this.propagageChannelsState(); | |
158 |
} |
|
164 | } | |
159 | handleSubscribed: function (event) { |
|
165 | ||
|
166 | handleSubscribed(event) { | |||
160 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
167 | var channelstreamConnection = this.getChannelStreamConnection(); | |
161 | var channelInfo = event.detail.channels_info; |
|
168 | var channelInfo = event.detail.channels_info; | |
162 | var channelKeys = Object.keys(event.detail.channels_info); |
|
169 | var channelKeys = Object.keys(event.detail.channels_info); | |
163 | for (var i = 0; i < channelKeys.length; i++) { |
|
170 | for (var i = 0; i < channelKeys.length; i++) { | |
164 | var key = channelKeys[i]; |
|
171 | var key = channelKeys[i]; | |
165 | channelstreamConnection.set(['channelsState', key], channelInfo[key]); |
|
172 | channelstreamConnection.set(['channelsState', key], channelInfo[key]); | |
166 | } |
|
173 | } | |
167 | channelstreamConnection.set('channels', event.detail.channels); |
|
174 | channelstreamConnection.set('channels', event.detail.channels); | |
168 | this.propagageChannelsState(); |
|
175 | this.propagageChannelsState(); | |
169 |
} |
|
176 | } | |
|
177 | ||||
170 | /** propagates channel states on topics */ |
|
178 | /** propagates channel states on topics */ | |
171 |
propagageChannelsState |
|
179 | propagageChannelsState(event) { | |
172 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
180 | var channelstreamConnection = this.getChannelStreamConnection(); | |
173 | var channel_data = channelstreamConnection.channelsState; |
|
181 | var channel_data = channelstreamConnection.channelsState; | |
174 | var channels = channelstreamConnection.channels; |
|
182 | var channels = channelstreamConnection.channels; | |
175 | for (var i = 0; i < channels.length; i++) { |
|
183 | for (var i = 0; i < channels.length; i++) { | |
176 | var key = channels[i]; |
|
184 | var key = channels[i]; | |
177 | $.Topic('/connection_controller/channel_update').publish( |
|
185 | $.Topic('/connection_controller/channel_update').publish( | |
178 | {channel: key, state: channel_data[key]} |
|
186 | {channel: key, state: channel_data[key]} | |
179 | ); |
|
187 | ); | |
180 | } |
|
188 | } | |
181 | } |
|
189 | } | |
182 | }); |
|
|||
183 |
|
190 | |||
|
191 | } | |||
|
192 | ||||
|
193 | customElements.define(RhodecodeApp.is, RhodecodeApp); | |||
184 | </script> |
|
194 | </script> | |
185 | </dom-module> |
|
195 | </dom-module> |
@@ -1,29 +1,38 b'' | |||||
1 | <link rel="import" href="../../../../../../bower_components/polymer/polymer.html"> |
|
1 | <link rel="import" href="../../../../../../bower_components/polymer/polymer.html"> | |
2 |
|
2 | |||
3 | <dom-module id="rhodecode-favicon"> |
|
3 | <dom-module id="rhodecode-favicon"> | |
4 | <template> |
|
4 | <template> | |
5 | </template> |
|
5 | </template> | |
6 | <script> |
|
6 | <script> | |
7 | Polymer({ |
|
7 | class RhodecodeFavicon extends Polymer.Element { | |
8 | is: 'rhodecode-favicon', |
|
8 | ||
9 | properties: { |
|
9 | static get is() { return 'rhodecode-favicon'; } | |
10 | favicon: Object, |
|
10 | ||
11 |
|
|
11 | static get properties() { | |
12 | type: Number, |
|
12 | return { | |
13 |
|
|
13 | favicon: Object, | |
|
14 | counter: { | |||
|
15 | type: Number, | |||
|
16 | observer: '_handleCounter' | |||
|
17 | } | |||
14 | } |
|
18 | } | |
15 |
} |
|
19 | } | |
16 |
|
20 | |||
17 | ready: function () { |
|
21 | connectedCallback() { | |
|
22 | super.connectedCallback(); | |||
18 | this.favicon = new Favico({ |
|
23 | this.favicon = new Favico({ | |
19 | type: 'rectangle', |
|
24 | type: 'rectangle', | |
20 | animation: 'none' |
|
25 | animation: 'none' | |
21 | }); |
|
26 | }); | |
22 |
} |
|
27 | } | |
23 | _handleCounter: function (newVal, oldVal) { |
|
28 | ||
|
29 | _handleCounter(newVal, oldVal) { | |||
24 | this.favicon.badge(this.counter); |
|
30 | this.favicon.badge(this.counter); | |
25 | } |
|
31 | } | |
26 | }); |
|
32 | ||
|
33 | } | |||
|
34 | customElements.define(RhodecodeFavicon.is, RhodecodeFavicon); | |||
|
35 | ||||
27 |
|
36 | |||
28 | </script> |
|
37 | </script> | |
29 | </dom-module> |
|
38 | </dom-module> |
@@ -1,200 +1,233 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" | |
|
3 | href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html"> | |||
3 | <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html"> |
|
4 | <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html"> | |
4 | <dom-module id="rhodecode-toast"> |
|
5 | <dom-module id="rhodecode-toast"> | |
5 | <template> |
|
6 | <template> | |
6 | <style include="shared-styles"> |
|
7 | <style include="shared-styles"> | |
7 | /* inset border for buttons - does not work in ie */ |
|
8 | /* inset border for buttons - does not work in ie */ | |
8 | /* rounded borders */ |
|
9 | /* rounded borders */ | |
9 | /* rounded borders - bottom only */ |
|
10 | /* rounded borders - bottom only */ | |
10 | /* rounded borders - top only */ |
|
11 | /* rounded borders - top only */ | |
11 | /* text shadow */ |
|
12 | /* text shadow */ | |
12 | /* centers text in a circle - input diameter of circle and color */ |
|
13 | /* centers text in a circle - input diameter of circle and color */ | |
13 | /* pill version of the circle */ |
|
14 | /* pill version of the circle */ | |
14 | .absolute-center { |
|
15 | .absolute-center { | |
15 | margin: auto; |
|
16 | margin: auto; | |
16 | position: absolute; |
|
17 | position: absolute; | |
17 | top: 0; |
|
18 | top: 0; | |
18 | left: 0; |
|
19 | left: 0; | |
19 | bottom: 0; |
|
20 | bottom: 0; | |
20 | right: 0; |
|
21 | right: 0; | |
21 | } |
|
22 | } | |
|
23 | ||||
22 | .top-left-rounded-corner { |
|
24 | .top-left-rounded-corner { | |
23 | -webkit-border-top-left-radius: 2px; |
|
25 | -webkit-border-top-left-radius: 2px; | |
24 | -khtml-border-radius-topleft: 2px; |
|
26 | -khtml-border-radius-topleft: 2px; | |
25 | border-top-left-radius: 2px; |
|
27 | border-top-left-radius: 2px; | |
26 | } |
|
28 | } | |
|
29 | ||||
27 | .top-right-rounded-corner { |
|
30 | .top-right-rounded-corner { | |
28 | -webkit-border-top-right-radius: 2px; |
|
31 | -webkit-border-top-right-radius: 2px; | |
29 | -khtml-border-radius-topright: 2px; |
|
32 | -khtml-border-radius-topright: 2px; | |
30 | border-top-right-radius: 2px; |
|
33 | border-top-right-radius: 2px; | |
31 | } |
|
34 | } | |
|
35 | ||||
32 | .bottom-left-rounded-corner { |
|
36 | .bottom-left-rounded-corner { | |
33 | -webkit-border-bottom-left-radius: 2px; |
|
37 | -webkit-border-bottom-left-radius: 2px; | |
34 | -khtml-border-radius-bottomleft: 2px; |
|
38 | -khtml-border-radius-bottomleft: 2px; | |
35 | border-bottom-left-radius: 2px; |
|
39 | border-bottom-left-radius: 2px; | |
36 | } |
|
40 | } | |
|
41 | ||||
37 | .bottom-right-rounded-corner { |
|
42 | .bottom-right-rounded-corner { | |
38 | -webkit-border-bottom-right-radius: 2px; |
|
43 | -webkit-border-bottom-right-radius: 2px; | |
39 | -khtml-border-radius-bottomright: 2px; |
|
44 | -khtml-border-radius-bottomright: 2px; | |
40 | border-bottom-right-radius: 2px; |
|
45 | border-bottom-right-radius: 2px; | |
41 | } |
|
46 | } | |
|
47 | ||||
42 | .top-left-rounded-corner-mid { |
|
48 | .top-left-rounded-corner-mid { | |
43 | -webkit-border-top-left-radius: 2px; |
|
49 | -webkit-border-top-left-radius: 2px; | |
44 | -khtml-border-radius-topleft: 2px; |
|
50 | -khtml-border-radius-topleft: 2px; | |
45 | border-top-left-radius: 2px; |
|
51 | border-top-left-radius: 2px; | |
46 | } |
|
52 | } | |
|
53 | ||||
47 | .top-right-rounded-corner-mid { |
|
54 | .top-right-rounded-corner-mid { | |
48 | -webkit-border-top-right-radius: 2px; |
|
55 | -webkit-border-top-right-radius: 2px; | |
49 | -khtml-border-radius-topright: 2px; |
|
56 | -khtml-border-radius-topright: 2px; | |
50 | border-top-right-radius: 2px; |
|
57 | border-top-right-radius: 2px; | |
51 | } |
|
58 | } | |
|
59 | ||||
52 | .bottom-left-rounded-corner-mid { |
|
60 | .bottom-left-rounded-corner-mid { | |
53 | -webkit-border-bottom-left-radius: 2px; |
|
61 | -webkit-border-bottom-left-radius: 2px; | |
54 | -khtml-border-radius-bottomleft: 2px; |
|
62 | -khtml-border-radius-bottomleft: 2px; | |
55 | border-bottom-left-radius: 2px; |
|
63 | border-bottom-left-radius: 2px; | |
56 | } |
|
64 | } | |
|
65 | ||||
57 | .bottom-right-rounded-corner-mid { |
|
66 | .bottom-right-rounded-corner-mid { | |
58 | -webkit-border-bottom-right-radius: 2px; |
|
67 | -webkit-border-bottom-right-radius: 2px; | |
59 | -khtml-border-radius-bottomright: 2px; |
|
68 | -khtml-border-radius-bottomright: 2px; | |
60 | border-bottom-right-radius: 2px; |
|
69 | border-bottom-right-radius: 2px; | |
61 | } |
|
70 | } | |
|
71 | ||||
62 | .alert { |
|
72 | .alert { | |
63 | margin: 10px 0; |
|
73 | margin: 10px 0; | |
64 | } |
|
74 | } | |
|
75 | ||||
65 | .toast-close { |
|
76 | .toast-close { | |
66 | margin: 0; |
|
77 | margin: 0; | |
67 | float: right; |
|
78 | float: right; | |
68 | cursor: pointer; |
|
79 | cursor: pointer; | |
69 | } |
|
80 | } | |
|
81 | ||||
70 | .toast-message-holder { |
|
82 | .toast-message-holder { | |
71 | background: rgba(255, 255, 255, 0.25); |
|
83 | background: rgba(255, 255, 255, 0.25); | |
72 | } |
|
84 | } | |
|
85 | ||||
73 | .toast-message-holder.fixed { |
|
86 | .toast-message-holder.fixed { | |
74 | position: fixed; |
|
87 | position: fixed; | |
75 | padding: 10px 0; |
|
88 | padding: 10px 0; | |
76 | margin-left: 10px; |
|
89 | margin-left: 10px; | |
77 | margin-right: 10px; |
|
90 | margin-right: 10px; | |
78 | top: 0; |
|
91 | top: 0; | |
79 | left: 0; |
|
92 | left: 0; | |
80 | right: 0; |
|
93 | right: 0; | |
81 | z-index: 100; |
|
94 | z-index: 100; | |
82 | } |
|
95 | } | |
83 | </style> |
|
96 | </style> | |
84 |
|
97 | |||
85 | <template is="dom-if" if="[[hasToasts]]"> |
|
98 | <template is="dom-if" if="[[hasToasts]]"> | |
86 | <div class$="container toast-message-holder [[conditionalClass(isFixed)]]"> |
|
99 | <div class$="container toast-message-holder [[conditionalClass(isFixed)]]"> | |
87 | <template is="dom-repeat" items="[[toasts]]"> |
|
100 | <template is="dom-repeat" items="[[toasts]]"> | |
88 | <div class$="alert alert-[[item.level]]"> |
|
101 | <div class$="alert alert-[[item.level]]"> | |
89 |
<div on- |
|
102 | <div on-click="dismissNotification" class="toast-close" index-pos="[[index]]"> | |
90 | <span>[[_gettext('Close')]]</span> |
|
103 | <span>[[_gettext('Close')]]</span> | |
91 | </div> |
|
104 | </div> | |
92 | <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html> |
|
105 | <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html> | |
93 | </div> |
|
106 | </div> | |
94 | </template> |
|
107 | </template> | |
95 | </div> |
|
108 | </div> | |
96 | </template> |
|
109 | </template> | |
97 | </template> |
|
110 | </template> | |
98 |
|
111 | |||
99 | <script> |
|
112 | <script> | |
100 | Polymer({ |
|
113 | ||
101 | is: 'rhodecode-toast', |
|
114 | class RhodecodeToast extends Polymer.mixinBehaviors([Polymer.IronA11yKeysBehavior], Polymer.Element) { | |
102 | properties: { |
|
115 | ||
103 |
|
|
116 | static get is() { | |
104 | type: Array, |
|
117 | return 'rhodecode-toast'; | |
105 | value: function(){ |
|
118 | } | |
106 | return [] |
|
119 | ||
107 | } |
|
120 | static get properties() { | |
108 |
|
|
121 | return { | |
109 |
|
|
122 | toasts: { | |
110 |
type: |
|
123 | type: Array, | |
111 |
value |
|
124 | value() { | |
112 | }, |
|
125 | return [] | |
113 |
|
|
126 | } | |
114 |
|
|
127 | }, | |
115 | computed: '_computeHasToasts(toasts.*)' |
|
128 | isFixed: { | |
116 |
|
|
129 | type: Boolean, | |
117 | keyEventTarget: { |
|
130 | value: false | |
118 |
|
|
131 | }, | |
119 |
|
|
132 | hasToasts: { | |
120 |
|
|
133 | type: Boolean, | |
|
134 | computed: '_computeHasToasts(toasts.*)' | |||
|
135 | }, | |||
|
136 | keyEventTarget: { | |||
|
137 | type: Object, | |||
|
138 | value() { | |||
|
139 | return document.body; | |||
|
140 | } | |||
121 | } |
|
141 | } | |
122 | } |
|
142 | } | |
123 |
} |
|
143 | } | |
124 | behaviors: [ |
|
144 | ||
125 | Polymer.IronA11yKeysBehavior |
|
145 | get keyBindings() { | |
126 |
|
|
146 | return { | |
127 | observers: [ |
|
147 | 'esc:keyup': '_hideOnEsc' | |
128 | '_changedToasts(toasts.splices)' |
|
148 | } | |
129 |
|
|
149 | } | |
130 |
|
150 | |||
131 | keyBindings: { |
|
151 | static get observers() { | |
132 | 'esc:keyup': '_hideOnEsc' |
|
152 | return [ | |
133 | }, |
|
153 | '_changedToasts(toasts.splices)' | |
|
154 | ] | |||
|
155 | } | |||
134 |
|
156 | |||
135 |
_hideOnEsc |
|
157 | _hideOnEsc(event) { | |
136 | return this.dismissNotifications(); |
|
158 | return this.dismissNotifications(); | |
137 |
} |
|
159 | } | |
138 |
|
160 | |||
139 |
_computeHasToasts |
|
161 | _computeHasToasts() { | |
140 | return this.toasts.length > 0; |
|
162 | return this.toasts.length > 0; | |
141 |
} |
|
163 | } | |
142 |
|
164 | |||
143 |
_debouncedCalc |
|
165 | _debouncedCalc() { | |
144 | // calculate once in a while |
|
166 | // calculate once in a while | |
145 | this.debounce('debouncedCalc', this.toastInWindow, 25); |
|
167 | this.debounce('debouncedCalc', this.toastInWindow, 25); | |
146 |
} |
|
168 | } | |
147 |
|
169 | |||
148 |
conditionalClass |
|
170 | conditionalClass() { | |
149 | return this.isFixed ? 'fixed': ''; |
|
171 | return this.isFixed ? 'fixed' : ''; | |
150 |
} |
|
172 | } | |
151 |
|
173 | |||
152 |
toastInWindow |
|
174 | toastInWindow() { | |
153 | if (!this._headerNode){ |
|
175 | if (!this._headerNode) { | |
154 | return true |
|
176 | return true | |
155 | } |
|
177 | } | |
156 | var headerHeight = this._headerNode.offsetHeight; |
|
178 | var headerHeight = this._headerNode.offsetHeight; | |
157 | var scrollPosition = window.scrollY; |
|
179 | var scrollPosition = window.scrollY; | |
158 |
|
180 | |||
159 | if (this.isFixed){ |
|
181 | if (this.isFixed) { | |
160 | this.isFixed = 1 <= scrollPosition; |
|
182 | this.isFixed = 1 <= scrollPosition; | |
161 | } |
|
183 | } | |
162 | else{ |
|
184 | else { | |
163 | this.isFixed = headerHeight <= scrollPosition; |
|
185 | this.isFixed = headerHeight <= scrollPosition; | |
164 | } |
|
186 | } | |
165 |
} |
|
187 | } | |
166 |
|
188 | |||
167 | attached: function(){ |
|
189 | connectedCallback() { | |
|
190 | super.connectedCallback(); | |||
168 | this._headerNode = document.querySelector('.header', document); |
|
191 | this._headerNode = document.querySelector('.header', document); | |
169 | this.listen(window,'scroll', '_debouncedCalc'); |
|
192 | this.listen(window, 'scroll', '_debouncedCalc'); | |
170 | this.listen(window,'resize', '_debouncedCalc'); |
|
193 | this.listen(window, 'resize', '_debouncedCalc'); | |
171 | this._debouncedCalc(); |
|
194 | this._debouncedCalc(); | |
172 |
} |
|
195 | } | |
173 | _changedToasts: function(newValue, oldValue){ |
|
196 | ||
|
197 | _changedToasts(newValue, oldValue) { | |||
174 | $.Topic('/favicon/update').publish({count: this.toasts.length}); |
|
198 | $.Topic('/favicon/update').publish({count: this.toasts.length}); | |
175 |
} |
|
199 | } | |
176 | dismissNotification: function(e) { |
|
200 | ||
177 | $.Topic('/favicon/update').publish({count: this.toasts.length-1}); |
|
201 | dismissNotification(e) { | |
|
202 | $.Topic('/favicon/update').publish({count: this.toasts.length - 1}); | |||
178 | var idx = e.target.parentNode.indexPos |
|
203 | var idx = e.target.parentNode.indexPos | |
179 | this.splice('toasts', idx, 1); |
|
204 | this.splice('toasts', idx, 1); | |
180 |
|
205 | |||
181 |
} |
|
206 | } | |
182 | dismissNotifications: function(){ |
|
207 | ||
|
208 | dismissNotifications() { | |||
183 | $.Topic('/favicon/update').publish({count: 0}); |
|
209 | $.Topic('/favicon/update').publish({count: 0}); | |
184 | this.splice('toasts', 0); |
|
210 | this.splice('toasts', 0); | |
185 |
} |
|
211 | } | |
186 | handleNotification: function(data){ |
|
212 | ||
|
213 | handleNotification(data) { | |||
187 | if (!templateContext.rhodecode_user.notification_status && !data.message.force) { |
|
214 | if (!templateContext.rhodecode_user.notification_status && !data.message.force) { | |
188 | // do not act if notifications are disabled |
|
215 | // do not act if notifications are disabled | |
189 | return |
|
216 | return | |
190 | } |
|
217 | } | |
191 | this.push('toasts',{ |
|
218 | this.push('toasts', { | |
192 | level: data.message.level, |
|
219 | level: data.message.level, | |
193 | message: data.message.message |
|
220 | message: data.message.message | |
194 | }); |
|
221 | }); | |
195 |
} |
|
222 | } | |
196 | _gettext: _gettext |
|
223 | ||
197 | }); |
|
224 | _gettext(x){ | |
|
225 | return _gettext(x) | |||
|
226 | } | |||
|
227 | ||||
|
228 | } | |||
|
229 | ||||
|
230 | customElements.define(RhodecodeToast.is, RhodecodeToast); | |||
198 |
|
231 | |||
199 | </script> |
|
232 | </script> | |
200 | </dom-module> |
|
233 | </dom-module> |
@@ -1,48 +1,61 b'' | |||||
1 | <link rel="import" href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html"> |
|
1 | <link rel="import" | |
|
2 | href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html"> | |||
2 | <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html"> |
|
3 | <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html"> | |
3 | <link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html"> |
|
4 | <link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html"> | |
4 |
|
5 | |||
5 | <dom-module id="rhodecode-toggle"> |
|
6 | <dom-module id="rhodecode-toggle"> | |
6 |
|
7 | |||
7 | <style include="shared-styles"> |
|
8 | <style include="shared-styles"> | |
8 | .rc-toggle { |
|
9 | .rc-toggle { | |
9 | float: left; |
|
10 | float: left; | |
10 | position: relative; |
|
11 | position: relative; | |
11 | } |
|
12 | } | |
|
13 | ||||
12 | .rc-toggle paper-spinner { |
|
14 | .rc-toggle paper-spinner { | |
13 | position: absolute; |
|
15 | position: absolute; | |
14 | top: 0; |
|
16 | top: 0; | |
15 | left: -30px; |
|
17 | left: -30px; | |
16 | width: 20px; |
|
18 | width: 20px; | |
17 | height: 20px; |
|
19 | height: 20px; | |
18 | } |
|
20 | } | |
19 | </style> |
|
21 | </style> | |
20 |
|
22 | |||
21 | <template> |
|
23 | <template> | |
22 | <div class="rc-toggle"> |
|
24 | <div class="rc-toggle"> | |
23 | <paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button> |
|
25 | <paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button> | |
24 | <paper-tooltip>[[tooltipText]]</paper-tooltip> |
|
26 | <paper-tooltip>[[tooltipText]]</paper-tooltip> | |
25 | <template is="dom-if" if="[[shouldShow(noSpinner)]]"> |
|
27 | <template is="dom-if" if="[[shouldShow(noSpinner)]]"> | |
26 | <paper-spinner active=[[active]]></paper-spinner> |
|
28 | <paper-spinner active=[[active]]></paper-spinner> | |
27 | </template> |
|
29 | </template> | |
28 | </div> |
|
30 | </div> | |
29 | </template> |
|
31 | </template> | |
30 |
|
32 | |||
31 | <script> |
|
33 | <script> | |
32 | Polymer({ |
|
34 | ||
33 | is: 'rhodecode-toggle', |
|
35 | class RhodecodeToggle extends Polymer.Element { | |
34 | properties: { |
|
36 | ||
35 | noSpinner: { type: Boolean, value: false, reflectToAttribute:true}, |
|
37 | static get is() { | |
36 | tooltipText: { type: String, value: "Click to toggle", reflectToAttribute:true}, |
|
38 | return 'rhodecode-toggle'; | |
37 | checked: { type: Boolean, value: false, reflectToAttribute:true}, |
|
39 | } | |
38 | active: { type: Boolean, value: false, reflectToAttribute:true, notify:true} |
|
40 | ||
39 | }, |
|
41 | static get properties() { | |
40 | shouldShow: function(){ |
|
42 | return { | |
|
43 | noSpinner: {type: Boolean, value: false, reflectToAttribute: true}, | |||
|
44 | tooltipText: {type: String, value: "Click to toggle", reflectToAttribute: true}, | |||
|
45 | checked: {type: Boolean, value: false, reflectToAttribute: true}, | |||
|
46 | active: {type: Boolean, value: false, reflectToAttribute: true, notify: true} | |||
|
47 | } | |||
|
48 | } | |||
|
49 | ||||
|
50 | shouldShow() { | |||
41 | return !this.noSpinner |
|
51 | return !this.noSpinner | |
42 | }, |
|
|||
43 | labelStatus: function(isActive){ |
|
|||
44 | return this.checked? 'Enabled' : "Disabled" |
|
|||
45 | } |
|
52 | } | |
46 | }); |
|
53 | ||
|
54 | labelStatus(isActive) { | |||
|
55 | return this.checked ? 'Enabled' : "Disabled" | |||
|
56 | } | |||
|
57 | } | |||
|
58 | ||||
|
59 | customElements.define(RhodecodeToggle.is, RhodecodeToggle); | |||
47 | </script> |
|
60 | </script> | |
48 | </dom-module> |
|
61 | </dom-module> |
@@ -1,23 +1,31 b'' | |||||
1 | <link rel="import" href="../../../../../../bower_components/polymer/polymer.html"> |
|
1 | <link rel="import" href="../../../../../../bower_components/polymer/polymer-element.html"> | |
2 |
|
2 | |||
3 | <dom-module id="rhodecode-unsafe-html"> |
|
3 | <dom-module id="rhodecode-unsafe-html"> | |
4 | <template> |
|
4 | <template> | |
5 | <style include="shared-styles"></style> |
|
5 | <style include="shared-styles"></style> | |
6 | <slot></slot> |
|
6 | <slot></slot> | |
7 | </template> |
|
7 | </template> | |
8 | <script> |
|
8 | <script> | |
9 | Polymer({ |
|
9 | class RhodecodeUnsafeHtml extends Polymer.Element { | |
10 | is: 'rhodecode-unsafe-html', |
|
10 | ||
11 |
|
|
11 | static get is() { | |
12 | text: { |
|
12 | return 'rhodecode-unsafe-html'; | |
13 | type: String, |
|
13 | } | |
14 | observer: '_handleText' |
|
14 | ||
|
15 | static get properties() { | |||
|
16 | return { | |||
|
17 | text: { | |||
|
18 | type: String, | |||
|
19 | observer: '_handleText' | |||
|
20 | } | |||
15 | } |
|
21 | } | |
16 |
} |
|
22 | } | |
17 | _handleText: function(newVal, oldVal){ |
|
23 | ||
|
24 | _handleText(newVal, oldVal) { | |||
18 | this.innerHTML = this.text; |
|
25 | this.innerHTML = this.text; | |
19 | } |
|
26 | } | |
20 |
} |
|
27 | } | |
21 |
|
28 | |||
|
29 | customElements.define(RhodecodeUnsafeHtml.is, RhodecodeUnsafeHtml); | |||
22 | </script> |
|
30 | </script> | |
23 | </dom-module> |
|
31 | </dom-module> |
@@ -1,161 +1,163 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 | ||||
|
31 | <script src="${h.asset('js/vendors/webcomponentsjs/custom-elements-es5-adapter.js', ver=c.rhodecode_version_hash)}"></script> | |||
30 | <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script> |
|
32 | <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script> | |
31 | <title>${self.title()}</title> |
|
33 | <title>${self.title()}</title> | |
32 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
|
34 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
33 |
|
35 | |||
34 | ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))} |
|
36 | ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))} | |
35 |
|
37 | |||
36 | % if 'safari' in (request.user_agent or '').lower(): |
|
38 | % if 'safari' in (request.user_agent or '').lower(): | |
37 | <meta name="referrer" content="origin"> |
|
39 | <meta name="referrer" content="origin"> | |
38 | % else: |
|
40 | % else: | |
39 | <meta name="referrer" content="origin-when-cross-origin"> |
|
41 | <meta name="referrer" content="origin-when-cross-origin"> | |
40 | % endif |
|
42 | % endif | |
41 |
|
43 | |||
42 | <%def name="robots()"> |
|
44 | <%def name="robots()"> | |
43 | <meta name="robots" content="index, nofollow"/> |
|
45 | <meta name="robots" content="index, nofollow"/> | |
44 | </%def> |
|
46 | </%def> | |
45 | ${self.robots()} |
|
47 | ${self.robots()} | |
46 | <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" /> |
|
48 | <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" /> | |
47 |
|
49 | |||
48 | ## CSS definitions |
|
50 | ## CSS definitions | |
49 | <%def name="css()"> |
|
51 | <%def name="css()"> | |
50 | <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/> |
|
52 | <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/> | |
51 | <!--[if lt IE 9]> |
|
53 | <!--[if lt IE 9]> | |
52 | <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/> |
|
54 | <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/> | |
53 | <![endif]--> |
|
55 | <![endif]--> | |
54 | ## EXTRA FOR CSS |
|
56 | ## EXTRA FOR CSS | |
55 | ${self.css_extra()} |
|
57 | ${self.css_extra()} | |
56 | </%def> |
|
58 | </%def> | |
57 | ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites |
|
59 | ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites | |
58 | <%def name="css_extra()"> |
|
60 | <%def name="css_extra()"> | |
59 | </%def> |
|
61 | </%def> | |
60 |
|
62 | |||
61 | ${self.css()} |
|
63 | ${self.css()} | |
62 |
|
64 | |||
63 | ## JAVASCRIPT |
|
65 | ## JAVASCRIPT | |
64 | <%def name="js()"> |
|
66 | <%def name="js()"> | |
65 |
|
67 | |||
66 | <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> |
|
68 | <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script> | |
67 | <script type="text/javascript"> |
|
69 | <script type="text/javascript"> | |
68 | // register templateContext to pass template variables to JS |
|
70 | // register templateContext to pass template variables to JS | |
69 | var templateContext = ${h.json.dumps(c.template_context)|n}; |
|
71 | var templateContext = ${h.json.dumps(c.template_context)|n}; | |
70 |
|
72 | |||
71 | var APPLICATION_URL = "${h.route_path('home').rstrip('/')}"; |
|
73 | var APPLICATION_URL = "${h.route_path('home').rstrip('/')}"; | |
72 | var APPLICATION_PLUGINS = []; |
|
74 | var APPLICATION_PLUGINS = []; | |
73 | var ASSET_URL = "${h.asset('')}"; |
|
75 | var ASSET_URL = "${h.asset('')}"; | |
74 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; |
|
76 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; | |
75 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; |
|
77 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; | |
76 |
|
78 | |||
77 | var APPENLIGHT = { |
|
79 | var APPENLIGHT = { | |
78 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, |
|
80 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, | |
79 | key: '${getattr(c, "appenlight_api_public_key", "")}', |
|
81 | key: '${getattr(c, "appenlight_api_public_key", "")}', | |
80 | % if getattr(c, 'appenlight_server_url', None): |
|
82 | % if getattr(c, 'appenlight_server_url', None): | |
81 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', |
|
83 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', | |
82 | % endif |
|
84 | % endif | |
83 | requestInfo: { |
|
85 | requestInfo: { | |
84 | % if getattr(c, 'rhodecode_user', None): |
|
86 | % if getattr(c, 'rhodecode_user', None): | |
85 | ip: '${c.rhodecode_user.ip_addr}', |
|
87 | ip: '${c.rhodecode_user.ip_addr}', | |
86 | username: '${c.rhodecode_user.username}' |
|
88 | username: '${c.rhodecode_user.username}' | |
87 | % endif |
|
89 | % endif | |
88 | }, |
|
90 | }, | |
89 | tags: { |
|
91 | tags: { | |
90 | rhodecode_version: '${c.rhodecode_version}', |
|
92 | rhodecode_version: '${c.rhodecode_version}', | |
91 | rhodecode_edition: '${c.rhodecode_edition}' |
|
93 | rhodecode_edition: '${c.rhodecode_edition}' | |
92 | } |
|
94 | } | |
93 | }; |
|
95 | }; | |
94 |
|
96 | |||
95 | </script> |
|
97 | </script> | |
96 | <%include file="/base/plugins_base.mako"/> |
|
98 | <%include file="/base/plugins_base.mako"/> | |
97 | <!--[if lt IE 9]> |
|
99 | <!--[if lt IE 9]> | |
98 | <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script> |
|
100 | <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script> | |
99 | <![endif]--> |
|
101 | <![endif]--> | |
100 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script> |
|
102 | <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> |
|
103 | <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script> | |
102 | ## avoide escaping the %N |
|
104 | ## avoide escaping the %N | |
103 | <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.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> | |
104 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> |
|
106 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> | |
105 |
|
107 | |||
106 |
|
108 | |||
107 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
109 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
108 | ${self.js_extra()} |
|
110 | ${self.js_extra()} | |
109 |
|
111 | |||
110 | <script type="text/javascript"> |
|
112 | <script type="text/javascript"> | |
111 | Rhodecode = (function() { |
|
113 | Rhodecode = (function() { | |
112 | function _Rhodecode() { |
|
114 | function _Rhodecode() { | |
113 | this.comments = new CommentsController(); |
|
115 | this.comments = new CommentsController(); | |
114 | } |
|
116 | } | |
115 | return new _Rhodecode(); |
|
117 | return new _Rhodecode(); | |
116 | })(); |
|
118 | })(); | |
117 |
|
119 | |||
118 | $(document).ready(function(){ |
|
120 | $(document).ready(function(){ | |
119 | show_more_event(); |
|
121 | show_more_event(); | |
120 | timeagoActivate(); |
|
122 | timeagoActivate(); | |
121 | clipboardActivate(); |
|
123 | clipboardActivate(); | |
122 | }) |
|
124 | }) | |
123 | </script> |
|
125 | </script> | |
124 |
|
126 | |||
125 | </%def> |
|
127 | </%def> | |
126 |
|
128 | |||
127 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
129 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
128 | <%def name="js_extra()"></%def> |
|
130 | <%def name="js_extra()"></%def> | |
129 | ${self.js()} |
|
131 | ${self.js()} | |
130 |
|
132 | |||
131 | <%def name="head_extra()"></%def> |
|
133 | <%def name="head_extra()"></%def> | |
132 | ${self.head_extra()} |
|
134 | ${self.head_extra()} | |
133 | ## extra stuff |
|
135 | ## extra stuff | |
134 | %if c.pre_code: |
|
136 | %if c.pre_code: | |
135 | ${c.pre_code|n} |
|
137 | ${c.pre_code|n} | |
136 | %endif |
|
138 | %endif | |
137 | </head> |
|
139 | </head> | |
138 | <body id="body"> |
|
140 | <body id="body"> | |
139 | <noscript> |
|
141 | <noscript> | |
140 | <div class="noscript-error"> |
|
142 | <div class="noscript-error"> | |
141 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} |
|
143 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} | |
142 | </div> |
|
144 | </div> | |
143 | </noscript> |
|
145 | </noscript> | |
144 | ## IE hacks |
|
146 | ## IE hacks | |
145 | <!--[if IE 7]> |
|
147 | <!--[if IE 7]> | |
146 | <script>$(document.body).addClass('ie7')</script> |
|
148 | <script>$(document.body).addClass('ie7')</script> | |
147 | <![endif]--> |
|
149 | <![endif]--> | |
148 | <!--[if IE 8]> |
|
150 | <!--[if IE 8]> | |
149 | <script>$(document.body).addClass('ie8')</script> |
|
151 | <script>$(document.body).addClass('ie8')</script> | |
150 | <![endif]--> |
|
152 | <![endif]--> | |
151 | <!--[if IE 9]> |
|
153 | <!--[if IE 9]> | |
152 | <script>$(document.body).addClass('ie9')</script> |
|
154 | <script>$(document.body).addClass('ie9')</script> | |
153 | <![endif]--> |
|
155 | <![endif]--> | |
154 |
|
156 | |||
155 | ${next.body()} |
|
157 | ${next.body()} | |
156 | %if c.post_code: |
|
158 | %if c.post_code: | |
157 | ${c.post_code|n} |
|
159 | ${c.post_code|n} | |
158 | %endif |
|
160 | %endif | |
159 | <rhodecode-app></rhodecode-app> |
|
161 | <rhodecode-app></rhodecode-app> | |
160 | </body> |
|
162 | </body> | |
161 | </html> |
|
163 | </html> |
@@ -1,69 +1,82 b'' | |||||
1 | /* webpack.config.js */ |
|
1 | /* webpack.config.js */ | |
2 | require('style-loader'); |
|
2 | require('style-loader'); | |
3 | require('css-loader'); |
|
3 | require('css-loader'); | |
4 | var path = require('path'); |
|
4 | var path = require('path'); | |
5 |
|
5 | |||
6 | const projectName = 'rhodecode-components'; |
|
6 | const projectName = 'rhodecode-components'; | |
7 | let destinationDirectory = path.join(process.cwd(), 'rhodecode', 'public', 'js') |
|
7 | let destinationDirectory = path.join(process.cwd(), 'rhodecode', 'public', 'js') | |
8 |
|
8 | |||
9 | if (process.env.RC_STATIC_DIR) { |
|
9 | if (process.env.RC_STATIC_DIR) { | |
10 | destinationDirectory = process.env.RC_STATIC_DIR; |
|
10 | destinationDirectory = process.env.RC_STATIC_DIR; | |
11 | } |
|
11 | } | |
12 |
|
12 | |||
|
13 | // doing it this way because it seems that plugin via grunt does not pick up .babelrc | |||
|
14 | let babelRCOptions = { | |||
|
15 | "presets": [ | |||
|
16 | ["env", { | |||
|
17 | "targets": { | |||
|
18 | "browsers": ["last 2 versions"] | |||
|
19 | } | |||
|
20 | }] | |||
|
21 | ], | |||
|
22 | "plugins": ["transform-object-rest-spread"] | |||
|
23 | } | |||
|
24 | ||||
13 | module.exports = { |
|
25 | module.exports = { | |
14 | // Tell Webpack which file kicks off our app. |
|
26 | // Tell Webpack which file kicks off our app. | |
15 | entry: { |
|
27 | entry: { | |
16 | main: path.resolve(__dirname, 'rhodecode/public/js/src/components/index.js'), |
|
28 | main: path.resolve(__dirname, 'rhodecode/public/js/src/components/index.js'), | |
17 | }, |
|
29 | }, | |
18 | output: { |
|
30 | output: { | |
19 | filename: 'rhodecode-components.js', |
|
31 | filename: 'rhodecode-components.js', | |
20 | path: path.resolve(destinationDirectory) |
|
32 | path: path.resolve(destinationDirectory) | |
21 | }, |
|
33 | }, | |
22 | // Tell Webpack which directories to look in to resolve import statements. |
|
34 | // 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 |
|
35 | // 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 |
|
36 | // the property weβll need to tell it to look there in addition to the | |
25 | // bower_components folder. |
|
37 | // bower_components folder. | |
26 | resolve: { |
|
38 | resolve: { | |
27 | modules: [ |
|
39 | modules: [ | |
28 | path.resolve(__dirname, 'node_modules'), |
|
40 | path.resolve(__dirname, 'node_modules'), | |
29 | path.resolve(__dirname, 'bower_components') |
|
41 | path.resolve(__dirname, 'bower_components') | |
30 | ] |
|
42 | ] | |
31 | }, |
|
43 | }, | |
32 | // These rules tell Webpack how to process different module types. |
|
44 | // These rules tell Webpack how to process different module types. | |
33 | // Remember, *everything* is a module in Webpack. That includes |
|
45 | // Remember, *everything* is a module in Webpack. That includes | |
34 | // CSS, and (thanks to our loader) HTML. |
|
46 | // CSS, and (thanks to our loader) HTML. | |
35 | module: { |
|
47 | module: { | |
36 | rules: [ |
|
48 | rules: [ | |
37 | { |
|
49 | { | |
38 | // If you see a file that ends in .html, send it to these loaders. |
|
50 | // If you see a file that ends in .html, send it to these loaders. | |
39 | test: /\.html$/, |
|
51 | test: /\.html$/, | |
40 | // This is an example of chained loaders in Webpack. |
|
52 | // This is an example of chained loaders in Webpack. | |
41 | // Chained loaders run last to first. So it will run |
|
53 | // Chained loaders run last to first. So it will run | |
42 | // polymer-webpack-loader, and hand the output to |
|
54 | // polymer-webpack-loader, and hand the output to | |
43 | // babel-loader. This let's us transpile JS in our `<script>` elements. |
|
55 | // babel-loader. This let's us transpile JS in our `<script>` elements. | |
44 | use: [ |
|
56 | use: [ | |
45 |
{loader: 'babel-loader' |
|
57 | {loader: 'babel-loader', | |
|
58 | options: babelRCOptions}, | |||
46 | {loader: 'polymer-webpack-loader', |
|
59 | {loader: 'polymer-webpack-loader', | |
47 | options: { |
|
60 | options: { | |
48 | processStyleLinks: true, |
|
61 | processStyleLinks: true, | |
49 | } |
|
62 | } | |
50 | } |
|
63 | } | |
51 | ], |
|
64 | ], | |
52 | }, |
|
65 | }, | |
53 | { |
|
66 | { | |
54 | // If you see a file that ends in .js, just send it to the babel-loader. |
|
67 | // If you see a file that ends in .js, just send it to the babel-loader. | |
55 | test: /\.js$/, |
|
68 | test: /\.js$/, | |
56 | use: 'babel-loader' |
|
69 | use: {loader: 'babel-loader', options: babelRCOptions} | |
57 | // Optionally exclude node_modules from transpilation except for polymer-webpack-loader: |
|
70 | // Optionally exclude node_modules from transpilation except for polymer-webpack-loader: | |
58 | // exclude: /node_modules\/(?!polymer-webpack-loader\/).*/ |
|
71 | // exclude: /node_modules\/(?!polymer-webpack-loader\/).*/ | |
59 | }, |
|
72 | }, | |
60 | // this is required because of bug: |
|
73 | // this is required because of bug: | |
61 | // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49 |
|
74 | // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49 | |
62 | { |
|
75 | { | |
63 | test: /intl-messageformat.min.js/, |
|
76 | test: /intl-messageformat.min.js/, | |
64 | use: 'imports-loader?this=>window' |
|
77 | use: 'imports-loader?this=>window' | |
65 | } |
|
78 | } | |
66 | ] |
|
79 | ] | |
67 | }, |
|
80 | }, | |
68 | plugins: [] |
|
81 | plugins: [] | |
69 | }; |
|
82 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now