##// END OF EJS Templates
polymer: slim out the styles and change the flow of initialization to avoid race conditions
ergo -
r714:822499e8 default
parent child Browse files
Show More
@@ -1,63 +1,64 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 ^pylint.log$
39 ^pylint.log$
40 ^rcextensions/
40 ^rcextensions/
41 ^result$
41 ^result$
42 ^rhodecode/public/css/style.css$
42 ^rhodecode/public/css/style.css$
43 ^rhodecode/public/css/style-polymer.css$
43 ^rhodecode/public/css/style-polymer.css$
44 ^rhodecode/public/js/scripts.js$
44 ^rhodecode/public/js/scripts.js$
45 ^rhodecode/public/js/rhodecode-components.html$
45 ^rhodecode/public/js/rhodecode-components.html$
46 ^rhodecode/public/js/src/components/root-styles.gen.html$
46 ^rhodecode\.db$
47 ^rhodecode\.db$
47 ^rhodecode\.log$
48 ^rhodecode\.log$
48 ^rhodecode_dev\.log$
49 ^rhodecode_dev\.log$
49 ^test\.db$
50 ^test\.db$
50
51
51 # ac-tests
52 # ac-tests
52 ^acceptance_tests/\.cache.*$
53 ^acceptance_tests/\.cache.*$
53 ^acceptance_tests/externals
54 ^acceptance_tests/externals
54 ^acceptance_tests/ghostdriver.log$
55 ^acceptance_tests/ghostdriver.log$
55 ^acceptance_tests/local(_.+)?\.ini$
56 ^acceptance_tests/local(_.+)?\.ini$
56
57
57 # docs
58 # docs
58 ^docs/_build$
59 ^docs/_build$
59 ^docs/result$
60 ^docs/result$
60 ^docs-internal/_build$
61 ^docs-internal/_build$
61
62
62 # Cythonized things
63 # Cythonized things
63 ^rhodecode/.*\.(c|so)$
64 ^rhodecode/.*\.(c|so)$
@@ -1,177 +1,187 b''
1 module.exports = function(grunt) {
1 module.exports = function(grunt) {
2 grunt.initConfig({
2 grunt.initConfig({
3
3
4 dirs: {
4 dirs: {
5 css: "rhodecode/public/css",
5 css: "rhodecode/public/css",
6 js: {
6 js: {
7 "src": "rhodecode/public/js/src",
7 "src": "rhodecode/public/js/src",
8 "dest": "rhodecode/public/js"
8 "dest": "rhodecode/public/js"
9 }
9 }
10 },
10 },
11 copy: {
11 copy: {
12 main: {
12 main: {
13 expand: true,
13 expand: true,
14 cwd: 'bower_components',
14 cwd: 'bower_components',
15 src: 'webcomponentsjs/**',
15 src: 'webcomponentsjs/**',
16 dest: '<%= dirs.js.dest %>/vendors',
16 dest: '<%= dirs.js.dest %>/vendors',
17 },
17 },
18 },
18 },
19 concat: {
19 concat: {
20 polymercss:{
21 src: [
22 // Base libraries
23 '<%= dirs.js.src %>/components/root-styles-prefix.html',
24 '<%= dirs.css %>/style-polymer.css',
25 '<%= dirs.js.src %>/components/root-styles-suffix.html'
26 ],
27 dest: '<%= dirs.js.dest %>/src/components/root-styles.gen.html',
28 nonull: true
29 },
20 dist: {
30 dist: {
21 src: [
31 src: [
22 // Base libraries
32 // Base libraries
23 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
33 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
24 '<%= dirs.js.src %>/logging.js',
34 '<%= dirs.js.src %>/logging.js',
25 '<%= dirs.js.src %>/bootstrap.js',
35 '<%= dirs.js.src %>/bootstrap.js',
26 '<%= dirs.js.src %>/mousetrap.js',
36 '<%= dirs.js.src %>/mousetrap.js',
27 '<%= dirs.js.src %>/moment.js',
37 '<%= dirs.js.src %>/moment.js',
28 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
38 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
29 '<%= dirs.js.src %>/i18n_utils.js',
39 '<%= dirs.js.src %>/i18n_utils.js',
30 '<%= dirs.js.src %>/deform.js',
40 '<%= dirs.js.src %>/deform.js',
31
41
32 // Plugins
42 // Plugins
33 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
43 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
34 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
44 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
35 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
45 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
36 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
46 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
37 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
47 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
38 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
48 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
39 '<%= dirs.js.src %>/plugins/jquery.mark.js',
49 '<%= dirs.js.src %>/plugins/jquery.mark.js',
40 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
50 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
41 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
51 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
42
52
43 // Select2
53 // Select2
44 '<%= dirs.js.src %>/select2/select2.js',
54 '<%= dirs.js.src %>/select2/select2.js',
45
55
46 // Code-mirror
56 // Code-mirror
47 '<%= dirs.js.src %>/codemirror/codemirror.js',
57 '<%= dirs.js.src %>/codemirror/codemirror.js',
48 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
58 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
49 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
59 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
50 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
60 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
51 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
61 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
52 // TODO: mikhail: this is an exception. Since the code mirror modes
62 // TODO: mikhail: this is an exception. Since the code mirror modes
53 // are loaded "on the fly", we need to keep them in a public folder
63 // are loaded "on the fly", we need to keep them in a public folder
54 '<%= dirs.js.dest %>/mode/meta.js',
64 '<%= dirs.js.dest %>/mode/meta.js',
55 '<%= dirs.js.dest %>/mode/meta_ext.js',
65 '<%= dirs.js.dest %>/mode/meta_ext.js',
56 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
66 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
57
67
58 // Rhodecode utilities
68 // Rhodecode utilities
59 '<%= dirs.js.src %>/rhodecode/utils/array.js',
69 '<%= dirs.js.src %>/rhodecode/utils/array.js',
60 '<%= dirs.js.src %>/rhodecode/utils/string.js',
70 '<%= dirs.js.src %>/rhodecode/utils/string.js',
61 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
71 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
62 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
72 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
63 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
73 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
64 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
74 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
65 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
75 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
66 '<%= dirs.js.src %>/rhodecode/utils/os.js',
76 '<%= dirs.js.src %>/rhodecode/utils/os.js',
67 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
77 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
68
78
69 // Rhodecode widgets
79 // Rhodecode widgets
70 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
80 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
71
81
72 // Rhodecode components
82 // Rhodecode components
73 '<%= dirs.js.src %>/rhodecode/init.js',
83 '<%= dirs.js.src %>/rhodecode/init.js',
74 '<%= dirs.js.src %>/rhodecode/connection_controller.js',
84 '<%= dirs.js.src %>/rhodecode/connection_controller.js',
75 '<%= dirs.js.src %>/rhodecode/codemirror.js',
85 '<%= dirs.js.src %>/rhodecode/codemirror.js',
76 '<%= dirs.js.src %>/rhodecode/comments.js',
86 '<%= dirs.js.src %>/rhodecode/comments.js',
77 '<%= dirs.js.src %>/rhodecode/constants.js',
87 '<%= dirs.js.src %>/rhodecode/constants.js',
78 '<%= dirs.js.src %>/rhodecode/files.js',
88 '<%= dirs.js.src %>/rhodecode/files.js',
79 '<%= dirs.js.src %>/rhodecode/followers.js',
89 '<%= dirs.js.src %>/rhodecode/followers.js',
80 '<%= dirs.js.src %>/rhodecode/menus.js',
90 '<%= dirs.js.src %>/rhodecode/menus.js',
81 '<%= dirs.js.src %>/rhodecode/notifications.js',
91 '<%= dirs.js.src %>/rhodecode/notifications.js',
82 '<%= dirs.js.src %>/rhodecode/permissions.js',
92 '<%= dirs.js.src %>/rhodecode/permissions.js',
83 '<%= dirs.js.src %>/rhodecode/pjax.js',
93 '<%= dirs.js.src %>/rhodecode/pjax.js',
84 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
94 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
85 '<%= dirs.js.src %>/rhodecode/settings.js',
95 '<%= dirs.js.src %>/rhodecode/settings.js',
86 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
96 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
87 '<%= dirs.js.src %>/rhodecode/tooltips.js',
97 '<%= dirs.js.src %>/rhodecode/tooltips.js',
88 '<%= dirs.js.src %>/rhodecode/users.js',
98 '<%= dirs.js.src %>/rhodecode/users.js',
89 '<%= dirs.js.src %>/rhodecode/utils/notifications.js',
99 '<%= dirs.js.src %>/rhodecode/utils/notifications.js',
90 '<%= dirs.js.src %>/rhodecode/appenlight.js',
100 '<%= dirs.js.src %>/rhodecode/appenlight.js',
91
101
92 // Rhodecode main module
102 // Rhodecode main module
93 '<%= dirs.js.src %>/rhodecode.js'
103 '<%= dirs.js.src %>/rhodecode.js'
94 ],
104 ],
95 dest: '<%= dirs.js.dest %>/scripts.js',
105 dest: '<%= dirs.js.dest %>/scripts.js',
96 nonull: true
106 nonull: true
97 }
107 }
98 },
108 },
99
109
100 less: {
110 less: {
101 development: {
111 development: {
102 options: {
112 options: {
103 compress: false,
113 compress: false,
104 yuicompress: false,
114 yuicompress: false,
105 optimization: 0
115 optimization: 0
106 },
116 },
107 files: {
117 files: {
108 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less",
118 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less",
109 "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less"
119 "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less"
110 }
120 }
111 },
121 },
112 production: {
122 production: {
113 options: {
123 options: {
114 compress: true,
124 compress: true,
115 yuicompress: true,
125 yuicompress: true,
116 optimization: 2
126 optimization: 2
117 },
127 },
118 files: {
128 files: {
119 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less",
129 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less",
120 "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less"
130 "<%= dirs.css %>/style-polymer.css": "<%= dirs.css %>/polymer.less"
121 }
131 }
122 },
132 },
123 components: {
133 components: {
124 files: [{
134 files: [{
125 cwd: '<%= dirs.js.src %>/components/',
135 cwd: '<%= dirs.js.src %>/components/',
126 dest: '<%= dirs.js.src %>/components/',
136 dest: '<%= dirs.js.src %>/components/',
127 src: ['**/*.less'],
137 src: ['**/*.less'],
128 expand: true,
138 expand: true,
129 ext: '.css'
139 ext: '.css'
130 }]
140 }]
131 }
141 }
132 },
142 },
133
143
134 watch: {
144 watch: {
135 less: {
145 less: {
136 files: ["<%= dirs.css %>/*.less"],
146 files: ["<%= dirs.css %>/**/*.less"],
137 tasks: ["less:development", 'less:components', "vulcanize"]
147 tasks: ["less:development", 'less:components', 'concat:polymercss', "vulcanize"]
138 },
148 },
139 js: {
149 js: {
140 files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/*.*"],
150 files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/**/*.html"],
141 tasks: ["vulcanize", "concat:dist"]
151 tasks: ['less:components', 'concat:polymercss', "vulcanize", "concat:dist"]
142 }
152 }
143 },
153 },
144
154
145 jshint: {
155 jshint: {
146 rhodecode: {
156 rhodecode: {
147 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
157 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
148 options: {
158 options: {
149 jshintrc: '.jshintrc'
159 jshintrc: '.jshintrc'
150 }
160 }
151 }
161 }
152 },
162 },
153 vulcanize: {
163 vulcanize: {
154 default: {
164 default: {
155 options: {
165 options: {
156 abspath: '',
166 abspath: '',
157 inlineScripts: true,
167 inlineScripts: true,
158 inlineCss: true,
168 inlineCss: true,
159 stripComments: true
169 stripComments: true
160 },
170 },
161 files: {
171 files: {
162 '<%= dirs.js.dest %>/rhodecode-components.html': '<%= dirs.js.src %>/components/shared-components.html'
172 '<%= dirs.js.dest %>/rhodecode-components.html': '<%= dirs.js.src %>/components/shared-components.html'
163 }
173 }
164 }
174 }
165 }
175 }
166 });
176 });
167
177
168 grunt.loadNpmTasks('grunt-contrib-less');
178 grunt.loadNpmTasks('grunt-contrib-less');
169 grunt.loadNpmTasks('grunt-contrib-concat');
179 grunt.loadNpmTasks('grunt-contrib-concat');
170 grunt.loadNpmTasks('grunt-contrib-watch');
180 grunt.loadNpmTasks('grunt-contrib-watch');
171 grunt.loadNpmTasks('grunt-contrib-jshint');
181 grunt.loadNpmTasks('grunt-contrib-jshint');
172 grunt.loadNpmTasks('grunt-vulcanize');
182 grunt.loadNpmTasks('grunt-vulcanize');
173 grunt.loadNpmTasks('grunt-crisper');
183 grunt.loadNpmTasks('grunt-crisper');
174 grunt.loadNpmTasks('grunt-contrib-copy');
184 grunt.loadNpmTasks('grunt-contrib-copy');
175
185
176 grunt.registerTask('default', ['less:production', 'less:components', 'copy','vulcanize', 'concat:dist']);
186 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'concat:dist']);
177 };
187 };
@@ -1,26 +1,23 b''
1 //Primary CSS
1 //Primary CSS
2 //--- IMPORTS ------------------//
2 //--- IMPORTS ------------------//
3 @import 'helpers';
3 @import 'helpers';
4 @import 'mixins';
4 @import 'mixins';
5 @import 'rcicons';
6 @import 'fonts';
7 @import 'variables';
5 @import 'variables';
8 @import 'type';
9 @import 'buttons';
6 @import 'buttons';
10
7
11 :root {
8 :root {
12 --primary-color: @rcblue;
9 --primary-color: @rcblue;
13 --light-primary-color: @rclightblue;
10 --light-primary-color: @rclightblue;
14 --dark-primary-color: @rcdarkblue;
11 --dark-primary-color: @rcdarkblue;
15 --primary-text-color: @text-color;
12 --primary-text-color: @text-color;
16
13
17 --paper-spinner-layer-1-color: @grey6;
14 --paper-spinner-layer-1-color: @grey6;
18 --paper-spinner-layer-2-color: @grey5;
15 --paper-spinner-layer-2-color: @grey5;
19 --paper-spinner-layer-3-color: @grey4;
16 --paper-spinner-layer-3-color: @grey4;
20 --paper-spinner-layer-4-color: @grey3;
17 --paper-spinner-layer-4-color: @grey3;
21 }
18 }
22
19
23 .paper-toggle-button {
20 .paper-toggle-button {
24 display: inline;
21 display: inline;
25 }
22 }
26
23
@@ -1,3 +1,3 b''
1 <dom-module id="shared-styles">
1 <dom-module id="root-styles">
2 <template>
2 <template>
3 <style>
3 <style>
1 NO CONTENT: file renamed from rhodecode/public/js/src/components/shared-styles-suffix.html to rhodecode/public/js/src/components/root-styles-suffix.html
NO CONTENT: file renamed from rhodecode/public/js/src/components/shared-styles-suffix.html to rhodecode/public/js/src/components/root-styles-suffix.html
@@ -1,94 +1,93 b''
1 <template is="dom-bind" id="notificationsPage">
1 <template is="dom-bind" id="notificationsPage">
2 <style include="shared-styles" is="custom-style"></style>
3 <iron-ajax id="toggleNotifications"
2 <iron-ajax id="toggleNotifications"
4 method="post"
3 method="post"
5 url="${url('my_account_notifications_toggle_visibility')}"
4 url="${url('my_account_notifications_toggle_visibility')}"
6 content-type="application/json"
5 content-type="application/json"
7 loading="{{changeNotificationsLoading}}"
6 loading="{{changeNotificationsLoading}}"
8 on-response="handleNotifications"
7 on-response="handleNotifications"
9 handle-as="json"></iron-ajax>
8 handle-as="json"></iron-ajax>
10
9
11 <div class="panel panel-default">
10 <div class="panel panel-default">
12 <div class="panel-heading">
11 <div class="panel-heading">
13 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
12 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
14 </div>
13 </div>
15 <div class="panel-body">
14 <div class="panel-body">
16
15
17 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
16 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
18
17
19 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
18 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
20
19
21 <div class="form">
20 <div class="form">
22 <!-- fields -->
21 <!-- fields -->
23 <div class="fields">
22 <div class="fields">
24 <div class="field">
23 <div class="field">
25 <div class="label">
24 <div class="label">
26 <label for="new_email">${_('Notifications Status')}:</label>
25 <label for="new_email">${_('Notifications Status')}:</label>
27 </div>
26 </div>
28 <div class="checkboxes">
27 <div class="checkboxes">
29 <paper-toggle-button class="paper-toggle-button" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></paper-toggle-button>
28 <paper-toggle-button class="paper-toggle-button" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></paper-toggle-button>
30 <paper-tooltip>Toggle your notifications on/off globally.</paper-tooltip>
29 <paper-tooltip>Toggle your notifications on/off globally.</paper-tooltip>
31 <template is="dom-if" if="{{changeNotificationsLoading}}">
30 <template is="dom-if" if="{{changeNotificationsLoading}}">
32 <paper-spinner active class="toggle-ajax-spinner"></paper-spinner>
31 <paper-spinner active class="toggle-ajax-spinner"></paper-spinner>
33 </template>
32 </template>
34 </div>
33 </div>
35 </div>
34 </div>
36 <div class="buttons">
35 <div class="buttons">
37 <a class="btn btn-default" id="test-notification">Test notification</a>
36 <a class="btn btn-default" id="test-notification">Test notification</a>
38 </div>
37 </div>
39 </div>
38 </div>
40 </div>
39 </div>
41
40
42 </div>
41 </div>
43 </div>
42 </div>
44
43
45 <script type="application/javascript">
44 <script type="application/javascript">
46 /** because im not creating a custom element for this page
45 /** because im not creating a custom element for this page
47 * we need to push the function onto the dom-template
46 * we need to push the function onto the dom-template
48 * ideally we turn this into notification-settings elements
47 * ideally we turn this into notification-settings elements
49 * then it will be cleaner
48 * then it will be cleaner
50 */
49 */
51 var ctrlr = $('#notificationsPage')[0];
50 var ctrlr = $('#notificationsPage')[0];
52 ctrlr.toggleNotifications = function(event){
51 ctrlr.toggleNotifications = function(event){
53 var ajax = $('#toggleNotifications')[0];
52 var ajax = $('#toggleNotifications')[0];
54 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN}
53 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN}
55 ajax.body = {notification_status:event.target.active};
54 ajax.body = {notification_status:event.target.active};
56 ajax.generateRequest();
55 ajax.generateRequest();
57 };
56 };
58 ctrlr.handleNotifications = function(event){
57 ctrlr.handleNotifications = function(event){
59 $('paper-toggle-button')[0].active = event.detail.response;
58 $('paper-toggle-button')[0].active = event.detail.response;
60 };
59 };
61
60
62 function checkBrowserStatus(){
61 function checkBrowserStatus(){
63 var browserStatus = 'Unknown';
62 var browserStatus = 'Unknown';
64
63
65 if (!("Notification" in window)) {
64 if (!("Notification" in window)) {
66 browserStatus = 'Not supported'
65 browserStatus = 'Not supported'
67 }
66 }
68 else if(Notification.permission === 'denied'){
67 else if(Notification.permission === 'denied'){
69 browserStatus = 'Denied';
68 browserStatus = 'Denied';
70 $('.flash_msg').append('<div class="alert alert-error">Notifications are blocked on browser level - you need to enable them in your browser settings.</div>')
69 $('.flash_msg').append('<div class="alert alert-error">Notifications are blocked on browser level - you need to enable them in your browser settings.</div>')
71 }
70 }
72 else if(Notification.permission === 'granted'){
71 else if(Notification.permission === 'granted'){
73 browserStatus = 'Allowed';
72 browserStatus = 'Allowed';
74 }
73 }
75
74
76 $('#browser-notification-status').text(browserStatus);
75 $('#browser-notification-status').text(browserStatus);
77 };
76 };
78
77
79 checkBrowserStatus();
78 checkBrowserStatus();
80
79
81 $('#test-notification').on('click', function(e){
80 $('#test-notification').on('click', function(e){
82 var levels = ['info', 'error', 'warning', 'success'];
81 var levels = ['info', 'error', 'warning', 'success'];
83 var level = levels[Math.floor(Math.random()*levels.length)];
82 var level = levels[Math.floor(Math.random()*levels.length)];
84 var payload = {
83 var payload = {
85 message: {
84 message: {
86 message: 'This is a test notification.',
85 message: 'This is a test notification.',
87 level: level,
86 level: level,
88 testMessage: true
87 testMessage: true
89 }
88 }
90 };
89 };
91 $.Topic('/notifications').publish(payload);
90 $.Topic('/notifications').publish(payload);
92 })
91 })
93 </script>
92 </script>
94 </template>
93 </template>
@@ -1,159 +1,160 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html>
2 <!DOCTYPE html>
3
3
4 <%
4 <%
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6
6
7 if hasattr(c, 'rhodecode_db_repo'):
7 if hasattr(c, 'rhodecode_db_repo'):
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10
10
11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
15
15
16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
17 %>
17 %>
18 <html xmlns="http://www.w3.org/1999/xhtml">
18 <html xmlns="http://www.w3.org/1999/xhtml">
19 <head>
19 <head>
20 <title>${self.title()}</title>
20 <title>${self.title()}</title>
21 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
21 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
22 <%def name="robots()">
22 <%def name="robots()">
23 <meta name="robots" content="index, nofollow"/>
23 <meta name="robots" content="index, nofollow"/>
24 </%def>
24 </%def>
25 ${self.robots()}
25 ${self.robots()}
26 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
26 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
27
27
28 ## CSS definitions
28 ## CSS definitions
29 <%def name="css()">
29 <%def name="css()">
30 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
30 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
31 <!--[if lt IE 9]>
31 <!--[if lt IE 9]>
32 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
32 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
33 <![endif]-->
33 <![endif]-->
34 ## EXTRA FOR CSS
34 ## EXTRA FOR CSS
35 ${self.css_extra()}
35 ${self.css_extra()}
36 </%def>
36 </%def>
37 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
37 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
38 <%def name="css_extra()">
38 <%def name="css_extra()">
39 </%def>
39 </%def>
40
40
41 ${self.css()}
41 ${self.css()}
42
42
43 ## JAVASCRIPT
43 ## JAVASCRIPT
44 <%def name="js()">
44 <%def name="js()">
45 <script>
45 <script>
46 // setup Polymer options
46 // setup Polymer options
47 window.Polymer = {lazyRegister: true, dom: 'shadow'};
47 window.Polymer = {lazyRegister: true, dom: 'shadow'};
48
48
49 // load webcomponents polyfills
49 // load webcomponents polyfills
50 (function() {
50 (function() {
51 if ('registerElement' in document
51 if ('registerElement' in document
52 && 'import' in document.createElement('link')
52 && 'import' in document.createElement('link')
53 && 'content' in document.createElement('template')) {
53 && 'content' in document.createElement('template')) {
54 // browser has web components
54 // browser has web components
55 } else {
55 } else {
56 // polyfill web components
56 // polyfill web components
57 var e = document.createElement('script');
57 var e = document.createElement('script');
58 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
58 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
59 document.head.appendChild(e);
59 document.head.appendChild(e);
60 }
60 }
61 })();
61 })();
62 </script>
62 </script>
63 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}" async>
64
63
65 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
64 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
66 <script type="text/javascript">
65 <script type="text/javascript">
67 // register templateContext to pass template variables to JS
66 // register templateContext to pass template variables to JS
68 var templateContext = ${h.json.dumps(c.template_context)|n};
67 var templateContext = ${h.json.dumps(c.template_context)|n};
69
68
70 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
69 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
71 %if hasattr(c, 'rhodecode_db_repo'):
70 %if hasattr(c, 'rhodecode_db_repo'):
72 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
71 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
73 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
72 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
74 %else:
73 %else:
75 var REPO_LANDING_REV = '';
74 var REPO_LANDING_REV = '';
76 var REPO_TYPE = '';
75 var REPO_TYPE = '';
77 %endif
76 %endif
78 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
77 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
79 var ASSET_URL = "${h.asset('')}";
78 var ASSET_URL = "${h.asset('')}";
80 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
79 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
81 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
80 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
82 % if getattr(c, 'rhodecode_user', None):
81 % if getattr(c, 'rhodecode_user', None):
83 var USER = {name:'${c.rhodecode_user.username}'};
82 var USER = {name:'${c.rhodecode_user.username}'};
84 % else:
83 % else:
85 var USER = {name:null};
84 var USER = {name:null};
86 % endif
85 % endif
87
86
88 var APPENLIGHT = {
87 var APPENLIGHT = {
89 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
88 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
90 key: '${getattr(c, "appenlight_api_public_key", "")}',
89 key: '${getattr(c, "appenlight_api_public_key", "")}',
91 % if getattr(c, 'appenlight_server_url', None):
90 % if getattr(c, 'appenlight_server_url', None):
92 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
91 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
93 % endif
92 % endif
94 requestInfo: {
93 requestInfo: {
95 % if getattr(c, 'rhodecode_user', None):
94 % if getattr(c, 'rhodecode_user', None):
96 ip: '${c.rhodecode_user.ip_addr}',
95 ip: '${c.rhodecode_user.ip_addr}',
97 username: '${c.rhodecode_user.username}'
96 username: '${c.rhodecode_user.username}'
98 % endif
97 % endif
99 }
98 }
100 };
99 };
101 </script>
100 </script>
102 <!--[if lt IE 9]>
101 <!--[if lt IE 9]>
103 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
102 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
104 <![endif]-->
103 <![endif]-->
105 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
104 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
106 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
105 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
106 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
107 <style include="shared-styles" is="custom-style"></style>
107 ## avoide escaping the %N
108 ## avoide escaping the %N
108 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
109 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
109
110
110
111
111 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
112 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
112 ${self.js_extra()}
113 ${self.js_extra()}
113
114
114 <script type="text/javascript">
115 <script type="text/javascript">
115 $(document).ready(function(){
116 $(document).ready(function(){
116 show_more_event();
117 show_more_event();
117 timeagoActivate();
118 timeagoActivate();
118 })
119 })
119 </script>
120 </script>
120
121
121 </%def>
122 </%def>
122
123
123 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
124 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
124 <%def name="js_extra()"></%def>
125 <%def name="js_extra()"></%def>
125 ${self.js()}
126 ${self.js()}
126
127
127 <%def name="head_extra()"></%def>
128 <%def name="head_extra()"></%def>
128 ${self.head_extra()}
129 ${self.head_extra()}
129 <%include file="/base/plugins_base.html"/>
130 <%include file="/base/plugins_base.html"/>
130
131
131 ## extra stuff
132 ## extra stuff
132 %if c.pre_code:
133 %if c.pre_code:
133 ${c.pre_code|n}
134 ${c.pre_code|n}
134 %endif
135 %endif
135 </head>
136 </head>
136 <body id="body">
137 <body id="body">
137 <noscript>
138 <noscript>
138 <div class="noscript-error">
139 <div class="noscript-error">
139 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
140 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
140 </div>
141 </div>
141 </noscript>
142 </noscript>
142 ## IE hacks
143 ## IE hacks
143 <!--[if IE 7]>
144 <!--[if IE 7]>
144 <script>$(document.body).addClass('ie7')</script>
145 <script>$(document.body).addClass('ie7')</script>
145 <![endif]-->
146 <![endif]-->
146 <!--[if IE 8]>
147 <!--[if IE 8]>
147 <script>$(document.body).addClass('ie8')</script>
148 <script>$(document.body).addClass('ie8')</script>
148 <![endif]-->
149 <![endif]-->
149 <!--[if IE 9]>
150 <!--[if IE 9]>
150 <script>$(document.body).addClass('ie9')</script>
151 <script>$(document.body).addClass('ie9')</script>
151 <![endif]-->
152 <![endif]-->
152
153
153 ${next.body()}
154 ${next.body()}
154 %if c.post_code:
155 %if c.post_code:
155 ${c.post_code|n}
156 ${c.post_code|n}
156 %endif
157 %endif
157 <rhodecode-toast id="notifications"></rhodecode-toast>
158 <rhodecode-toast id="notifications"></rhodecode-toast>
158 </body>
159 </body>
159 </html>
160 </html>
General Comments 0
You need to be logged in to leave comments. Login now