##// END OF EJS Templates
frontend: Use Polymer 2.0
ergo -
r2915:59bfd308 default
parent child Browse files
Show More

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

@@ -1,17 +1,17 b''
1 {
1 {
2 "name": "rhodecode-elements",
2 "name": "rhodecode-elements",
3 "description": "User interface for elements for rhodecode",
3 "description": "User interface for elements for rhodecode",
4 "main": "index.html",
4 "main": "index.html",
5 "dependencies": {
5 "dependencies": {
6 "webcomponentsjs": "^0.7.22",
6 "webcomponentsjs": "^1.2.3",
7 "polymer": "Polymer/polymer#^1.6.1",
7 "polymer": "Polymer/polymer#^2.6.0",
8 "paper-button": "PolymerElements/paper-button#^1.0.13",
8 "paper-button": "PolymerElements/paper-button#^2.1.2",
9 "paper-spinner": "PolymerElements/paper-spinner#^1.2.0",
9 "paper-spinner": "PolymerElements/paper-spinner#^2.1.0",
10 "paper-tooltip": "PolymerElements/paper-tooltip#^1.1.2",
10 "paper-tooltip": "PolymerElements/paper-tooltip#^2.1.1",
11 "paper-toast": "PolymerElements/paper-toast#^1.3.0",
11 "paper-toast": "PolymerElements/paper-toast#^2.1.2",
12 "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.2.0",
12 "paper-toggle-button": "PolymerElements/paper-toggle-button#^2.1.1",
13 "iron-ajax": "PolymerElements/iron-ajax#^1.4.4",
13 "iron-ajax": "PolymerElements/iron-ajax#^2.1.3",
14 "iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^1.0.13",
14 "iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^2.2.0",
15 "iron-a11y-keys": "PolymerElements/iron-a11y-keys#^1.0.6"
15 "iron-a11y-keys": "PolymerElements/iron-a11y-keys#^2.1.2"
16 }
16 }
17 }
17 }
@@ -1,32 +1,32 b''
1 {
1 {
2 "name": "rhodecode-enterprise",
2 "name": "rhodecode-enterprise",
3 "version": "1.0.0",
3 "version": "1.0.0",
4 "private": true,
4 "private": true,
5 "description" : "RhodeCode JS packaged",
5 "description" : "RhodeCode JS packaged",
6 "license": "SEE LICENSE IN LICENSE.txt",
6 "license": "SEE LICENSE IN LICENSE.txt",
7 "repository" : {
7 "repository" : {
8 "type" : "hg",
8 "type" : "hg",
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
10 },
10 },
11 "devDependencies": {
11 "devDependencies": {
12 "grunt": "^0.4.5",
12 "grunt": "^0.4.5",
13 "grunt-contrib-copy": "^1.0.0",
13 "grunt-contrib-copy": "^1.0.0",
14 "grunt-contrib-concat": "^0.5.1",
14 "grunt-contrib-concat": "^0.5.1",
15 "grunt-contrib-jshint": "^0.12.0",
15 "grunt-contrib-jshint": "^0.12.0",
16 "grunt-contrib-less": "^1.1.0",
16 "grunt-contrib-less": "^1.1.0",
17 "grunt-contrib-watch": "^0.6.1",
17 "grunt-contrib-watch": "^0.6.1",
18 "crisper": "^2.0.2",
18 "crisper": "^2.1.1",
19 "vulcanize": "^1.14.8",
19 "vulcanize": "^1.16.0",
20 "grunt-crisper": "^1.0.1",
20 "grunt-crisper": "^1.0.1",
21 "grunt-vulcanize": "^1.0.0",
21 "grunt-vulcanize": "^1.0.0",
22 "node2nix": "^1.0.0",
22 "node2nix": "^1.0.0",
23 "jshint": "^2.9.1-rc3",
23 "jshint": "^2.9.1-rc3",
24 "bower": "^1.8.4",
24 "bower": "^1.8.4",
25 "jquery": "1.11.3",
25 "jquery": "1.11.3",
26 "favico.js": "^0.3.10",
26 "favico.js": "^0.3.10",
27 "clipboard": "^1.7.1",
27 "clipboard": "^1.7.1",
28 "moment": "^2.18.1",
28 "moment": "^2.18.1",
29 "mousetrap": "^1.6.1",
29 "mousetrap": "^1.6.1",
30 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1"
30 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1"
31 }
31 }
32 }
32 }
@@ -1,150 +1,150 b''
1 ccLog = Logger.get('RhodeCodeApp');
1 ccLog = Logger.get('RhodeCodeApp');
2 ccLog.setLevel(Logger.OFF);
2 ccLog.setLevel(Logger.OFF);
3
3
4 var rhodeCodeApp = Polymer({
4 var rhodeCodeApp = Polymer({
5 is: 'rhodecode-app',
5 is: 'rhodecode-app',
6 attached: function () {
6 attached: function () {
7 ccLog.debug('rhodeCodeApp created');
7 ccLog.debug('rhodeCodeApp created');
8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
9 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
9 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
10 $.Topic('/connection_controller/subscribe').subscribe(
10 $.Topic('/connection_controller/subscribe').subscribe(
11 this.subscribeToChannelTopic.bind(this));
11 this.subscribeToChannelTopic.bind(this));
12 // this event can be used to coordinate plugins to do their
12 // this event can be used to coordinate plugins to do their
13 // initialization before channelstream is kicked off
13 // initialization before channelstream is kicked off
14 $.Topic('/__MAIN_APP__').publish({});
14 $.Topic('/__MAIN_APP__').publish({});
15
15
16 for (var i = 0; i < alertMessagePayloads.length; i++) {
16 for (var i = 0; i < alertMessagePayloads.length; i++) {
17 $.Topic('/notifications').publish(alertMessagePayloads[i]);
17 $.Topic('/notifications').publish(alertMessagePayloads[i]);
18 }
18 }
19 this.kickoffChannelstreamPlugin();
19 this.kickoffChannelstreamPlugin();
20 },
20 },
21
21
22 /** proxy to channelstream connection */
22 /** proxy to channelstream connection */
23 getChannelStreamConnection: function () {
23 getChannelStreamConnection: function () {
24 return this.$['channelstream-connection'];
24 return this.$['channelstream-connection'];
25 },
25 },
26
26
27 handleNotifications: function (data) {
27 handleNotifications: function (data) {
28 var elem = document.getElementById('notifications');
28 var elem = document.getElementById('notifications');
29 if(elem){
29 if(elem){
30 elem.handleNotification(data);
30 elem.handleNotification(data);
31 }
31 }
32
32
33 },
33 },
34
34
35 faviconUpdate: function (data) {
35 faviconUpdate: function (data) {
36 this.$$('rhodecode-favicon').counter = data.count;
36 this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count;
37 },
37 },
38
38
39 /** opens connection to ws server */
39 /** opens connection to ws server */
40 kickoffChannelstreamPlugin: function (data) {
40 kickoffChannelstreamPlugin: function (data) {
41 ccLog.debug('kickoffChannelstreamPlugin');
41 ccLog.debug('kickoffChannelstreamPlugin');
42 var channels = ['broadcast'];
42 var channels = ['broadcast'];
43 var addChannels = this.checkViewChannels();
43 var addChannels = this.checkViewChannels();
44 for (var i = 0; i < addChannels.length; i++) {
44 for (var i = 0; i < addChannels.length; i++) {
45 channels.push(addChannels[i]);
45 channels.push(addChannels[i]);
46 }
46 }
47 if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){
47 if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){
48 var channelstreamConnection = this.getChannelStreamConnection();
48 var channelstreamConnection = this.getChannelStreamConnection();
49 channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect;
49 channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect;
50 channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe;
50 channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe;
51 channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws';
51 channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws';
52 channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen';
52 channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen';
53 // some channels might already be registered by topic
53 // some channels might already be registered by topic
54 for (var i = 0; i < channels.length; i++) {
54 for (var i = 0; i < channels.length; i++) {
55 channelstreamConnection.push('channels', channels[i]);
55 channelstreamConnection.push('channels', channels[i]);
56 }
56 }
57 // append any additional channels registered in other plugins
57 // append any additional channels registered in other plugins
58 $.Topic('/connection_controller/subscribe').processPrepared();
58 $.Topic('/connection_controller/subscribe').processPrepared();
59 channelstreamConnection.connect();
59 channelstreamConnection.connect();
60 }
60 }
61 },
61 },
62
62
63 checkViewChannels: function () {
63 checkViewChannels: function () {
64 // subscribe to different channels data is sent.
64 // subscribe to different channels data is sent.
65
65
66 var channels = [];
66 var channels = [];
67 // subscribe to PR repo channel for PR's'
67 // subscribe to PR repo channel for PR's'
68 if (templateContext.pull_request_data.pull_request_id) {
68 if (templateContext.pull_request_data.pull_request_id) {
69 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
69 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
70 String(templateContext.pull_request_data.pull_request_id);
70 String(templateContext.pull_request_data.pull_request_id);
71 channels.push(channelName);
71 channels.push(channelName);
72 }
72 }
73
73
74 if (templateContext.commit_data.commit_id) {
74 if (templateContext.commit_data.commit_id) {
75 var channelName = '/repo$' + templateContext.repo_name + '$/commit/' +
75 var channelName = '/repo$' + templateContext.repo_name + '$/commit/' +
76 String(templateContext.commit_data.commit_id);
76 String(templateContext.commit_data.commit_id);
77 channels.push(channelName);
77 channels.push(channelName);
78 }
78 }
79
79
80 return channels;
80 return channels;
81 },
81 },
82
82
83 /** subscribes users from channels in channelstream */
83 /** subscribes users from channels in channelstream */
84 subscribeToChannelTopic: function (channels) {
84 subscribeToChannelTopic: function (channels) {
85 var channelstreamConnection = this.getChannelStreamConnection();
85 var channelstreamConnection = this.getChannelStreamConnection();
86 var toSubscribe = channelstreamConnection.calculateSubscribe(channels);
86 var toSubscribe = channelstreamConnection.calculateSubscribe(channels);
87 ccLog.debug('subscribeToChannelTopic', toSubscribe);
87 ccLog.debug('subscribeToChannelTopic', toSubscribe);
88 if (toSubscribe.length > 0) {
88 if (toSubscribe.length > 0) {
89 // if we are connected then subscribe
89 // if we are connected then subscribe
90 if (channelstreamConnection.connected) {
90 if (channelstreamConnection.connected) {
91 channelstreamConnection.subscribe(toSubscribe);
91 channelstreamConnection.subscribe(toSubscribe);
92 }
92 }
93 // not connected? just push channels onto the stack
93 // not connected? just push channels onto the stack
94 else {
94 else {
95 for (var i = 0; i < toSubscribe.length; i++) {
95 for (var i = 0; i < toSubscribe.length; i++) {
96 channelstreamConnection.push('channels', toSubscribe[i]);
96 channelstreamConnection.push('channels', toSubscribe[i]);
97 }
97 }
98 }
98 }
99 }
99 }
100 },
100 },
101
101
102 /** publish received messages into correct topic */
102 /** publish received messages into correct topic */
103 receivedMessage: function (event) {
103 receivedMessage: function (event) {
104 for (var i = 0; i < event.detail.length; i++) {
104 for (var i = 0; i < event.detail.length; i++) {
105 var message = event.detail[i];
105 var message = event.detail[i];
106 if (message.message.topic) {
106 if (message.message.topic) {
107 ccLog.debug('publishing', message.message.topic);
107 ccLog.debug('publishing', message.message.topic);
108 $.Topic(message.message.topic).publish(message);
108 $.Topic(message.message.topic).publish(message);
109 }
109 }
110 else if (message.type === 'presence'){
110 else if (message.type === 'presence'){
111 $.Topic('/connection_controller/presence').publish(message);
111 $.Topic('/connection_controller/presence').publish(message);
112 }
112 }
113 else {
113 else {
114 ccLog.warn('unhandled message', message);
114 ccLog.warn('unhandled message', message);
115 }
115 }
116 }
116 }
117 },
117 },
118
118
119 handleConnected: function (event) {
119 handleConnected: function (event) {
120 var channelstreamConnection = this.getChannelStreamConnection();
120 var channelstreamConnection = this.getChannelStreamConnection();
121 channelstreamConnection.set('channelsState',
121 channelstreamConnection.set('channelsState',
122 event.detail.channels_info);
122 event.detail.channels_info);
123 channelstreamConnection.set('userState', event.detail.state);
123 channelstreamConnection.set('userState', event.detail.state);
124 channelstreamConnection.set('channels', event.detail.channels);
124 channelstreamConnection.set('channels', event.detail.channels);
125 this.propagageChannelsState();
125 this.propagageChannelsState();
126 },
126 },
127 handleSubscribed: function (event) {
127 handleSubscribed: function (event) {
128 var channelstreamConnection = this.getChannelStreamConnection();
128 var channelstreamConnection = this.getChannelStreamConnection();
129 var channelInfo = event.detail.channels_info;
129 var channelInfo = event.detail.channels_info;
130 var channelKeys = Object.keys(event.detail.channels_info);
130 var channelKeys = Object.keys(event.detail.channels_info);
131 for (var i = 0; i < channelKeys.length; i++) {
131 for (var i = 0; i < channelKeys.length; i++) {
132 var key = channelKeys[i];
132 var key = channelKeys[i];
133 channelstreamConnection.set(['channelsState', key], channelInfo[key]);
133 channelstreamConnection.set(['channelsState', key], channelInfo[key]);
134 }
134 }
135 channelstreamConnection.set('channels', event.detail.channels);
135 channelstreamConnection.set('channels', event.detail.channels);
136 this.propagageChannelsState();
136 this.propagageChannelsState();
137 },
137 },
138 /** propagates channel states on topics */
138 /** propagates channel states on topics */
139 propagageChannelsState: function (event) {
139 propagageChannelsState: function (event) {
140 var channelstreamConnection = this.getChannelStreamConnection();
140 var channelstreamConnection = this.getChannelStreamConnection();
141 var channel_data = channelstreamConnection.channelsState;
141 var channel_data = channelstreamConnection.channelsState;
142 var channels = channelstreamConnection.channels;
142 var channels = channelstreamConnection.channels;
143 for (var i = 0; i < channels.length; i++) {
143 for (var i = 0; i < channels.length; i++) {
144 var key = channels[i];
144 var key = channels[i];
145 $.Topic('/connection_controller/channel_update').publish(
145 $.Topic('/connection_controller/channel_update').publish(
146 {channel: key, state: channel_data[key]}
146 {channel: key, state: channel_data[key]}
147 );
147 );
148 }
148 }
149 }
149 }
150 });
150 });
@@ -1,24 +1,23 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/paper-toast/paper-toast.html">
3 <link rel="import" href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
2 <link rel="import" href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
4 <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
3 <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
5 <dom-module id="rhodecode-toast">
4 <dom-module id="rhodecode-toast">
6 <template>
5 <template>
7 <style include="shared-styles"></style>
6 <style include="shared-styles"></style>
8 <link rel="stylesheet" href="rhodecode-toast.css">
7 <link rel="stylesheet" href="rhodecode-toast.css">
9 <template is="dom-if" if="[[hasToasts]]">
8 <template is="dom-if" if="[[hasToasts]]">
10 <div class$="container toast-message-holder [[conditionalClass(isFixed)]]">
9 <div class$="container toast-message-holder [[conditionalClass(isFixed)]]">
11 <template is="dom-repeat" items="[[toasts]]">
10 <template is="dom-repeat" items="[[toasts]]">
12 <div class$="alert alert-[[item.level]]">
11 <div class$="alert alert-[[item.level]]">
13 <div on-tap="dismissNotification" class="toast-close" index-pos="[[index]]">
12 <div on-tap="dismissNotification" class="toast-close" index-pos="[[index]]">
14 <span>[[_gettext('Close')]]</span>
13 <span>[[_gettext('Close')]]</span>
15 </div>
14 </div>
16 <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html>
15 <rhodecode-unsafe-html text="[[item.message]]"></rhodecode-unsafe-html>
17 </div>
16 </div>
18 </template>
17 </template>
19 </div>
18 </div>
20 </template>
19 </template>
21 </template>
20 </template>
22
21
23 <script src="rhodecode-toast.js"></script>
22 <script src="rhodecode-toast.js"></script>
24 </dom-module>
23 </dom-module>
@@ -1,9 +1,9 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-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 <content></content>
6 <slot></slot>
7 </template>
7 </template>
8 <script src="rhodecode-unsafe-html.js"></script>
8 <script src="rhodecode-unsafe-html.js"></script>
9 </dom-module>
9 </dom-module>
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,130 +1,133 b''
1 <template is="dom-bind" id="notificationsPage">
1 <dom-bind id="notificationsPage">
2 <template>
2 <iron-ajax id="toggleNotifications"
3 <iron-ajax id="toggleNotifications"
3 method="post"
4 method="post"
4 url="${h.route_path('my_account_notifications_toggle_visibility')}"
5 url="${h.route_path('my_account_notifications_toggle_visibility')}"
5 content-type="application/json"
6 content-type="application/json"
6 loading="{{changeNotificationsLoading}}"
7 loading="{{changeNotificationsLoading}}"
7 on-response="handleNotifications"
8 on-response="handleNotifications"
8 handle-as="json">
9 handle-as="json">
9 </iron-ajax>
10 </iron-ajax>
10
11
11 <iron-ajax id="sendTestNotification"
12 <iron-ajax id="sendTestNotification"
12 method="post"
13 method="post"
13 url="${h.route_path('my_account_notifications_test_channelstream')}"
14 url="${h.route_path('my_account_notifications_test_channelstream')}"
14 content-type="application/json"
15 content-type="application/json"
15 on-response="handleTestNotification"
16 on-response="handleTestNotification"
16 handle-as="json">
17 handle-as="json">
17 </iron-ajax>
18 </iron-ajax>
18
19
19 <div class="panel panel-default">
20 <div class="panel panel-default">
20 <div class="panel-heading">
21 <div class="panel-heading">
21 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
22 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
22 </div>
23 </div>
23 <div class="panel-body">
24 <div class="panel-body">
24
25
25 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
26 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
26
27
27 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
28 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
28
29
29 <div class="form">
30 <div class="form">
30 <div class="fields">
31 <div class="fields">
31 <div class="field">
32 <div class="field">
32 <div class="label">
33 <div class="label">
33 <label for="new_email">${_('Notifications Status')}:</label>
34 <label for="new_email">${_('Notifications Status')}:</label>
34 </div>
35 </div>
35 <div class="checkboxes">
36 <div class="checkboxes">
36 <rhodecode-toggle id="live-notifications" active="[[changeNotificationsLoading]]" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></rhodecode-toggle>
37 <rhodecode-toggle id="live-notifications" active="[[changeNotificationsLoading]]" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></rhodecode-toggle>
37 </div>
38 </div>
38 </div>
39 </div>
39 </div>
40 </div>
40 </div>
41 </div>
41 </div>
42 </div>
42 </div>
43 </div>
43
44
44 <div class="panel panel-default">
45 <div class="panel panel-default">
45 <div class="panel-heading">
46 <div class="panel-heading">
46 <h3 class="panel-title">${_('Test Notifications')}</h3>
47 <h3 class="panel-title">${_('Test Notifications')}</h3>
47 </div>
48 </div>
48 <div class="panel-body">
49 <div class="panel-body">
49
50
50
51
51 <div style="padding: 0px 0px 20px 0px">
52 <div style="padding: 0px 0px 20px 0px">
52 <button class="btn" id="test-notification" on-tap="testNotifications">Test flash message</button>
53 <button class="btn" id="test-notification" on-tap="testNotifications">Test flash message</button>
53 <button class="btn" id="test-notification-live" on-tap="testNotificationsLive">Test live notification</button>
54 <button class="btn" id="test-notification-live" on-tap="testNotificationsLive">Test live notification</button>
54 </div>
55 </div>
55 <h4 id="test-response"></h4>
56 <h4 id="test-response"></h4>
56
57
57 </div>
58 </div>
58
59
59
60
60
61
61 </div>
62 </div>
62
63
64
65 </template>
66 </dom-bind>
67
63 <script type="text/javascript">
68 <script type="text/javascript">
64 /** because im not creating a custom element for this page
69 /** because im not creating a custom element for this page
65 * we need to push the function onto the dom-template
70 * we need to push the function onto the dom-template
66 * ideally we turn this into notification-settings elements
71 * ideally we turn this into notification-settings elements
67 * then it will be cleaner
72 * then it will be cleaner
68 */
73 */
69 var ctrlr = $('#notificationsPage')[0];
74 var ctrlr = $('#notificationsPage')[0];
70 ctrlr.toggleNotifications = function(event){
75 ctrlr.toggleNotifications = function(event){
71 var ajax = $('#toggleNotifications')[0];
76 var ajax = $('#toggleNotifications')[0];
72 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN};
77 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN};
73 ajax.body = {notification_status:event.target.active};
78 ajax.body = {notification_status:event.target.active};
74 ajax.generateRequest();
79 ajax.generateRequest();
75 };
80 };
76 ctrlr.handleNotifications = function(event){
81 ctrlr.handleNotifications = function(event){
77 $('#live-notifications')[0].checked = event.detail.response;
82 $('#live-notifications')[0].checked = event.detail.response;
78 };
83 };
79
84
80 ctrlr.testNotifications = function(event){
85 ctrlr.testNotifications = function(event){
81 var levels = ['info', 'error', 'warning', 'success'];
86 var levels = ['info', 'error', 'warning', 'success'];
82 var level = levels[Math.floor(Math.random()*levels.length)];
87 var level = levels[Math.floor(Math.random()*levels.length)];
83 function getRandomArbitrary(min, max) {
88 function getRandomArbitrary(min, max) {
84 return parseInt(Math.random() * (max - min) + min);
89 return parseInt(Math.random() * (max - min) + min);
85 }
90 }
86 function shuffle(a) {
91 function shuffle(a) {
87 var j, x, i;
92 var j, x, i;
88 for (i = a.length; i; i--) {
93 for (i = a.length; i; i--) {
89 j = Math.floor(Math.random() * i);
94 j = Math.floor(Math.random() * i);
90 x = a[i - 1];
95 x = a[i - 1];
91 a[i - 1] = a[j];
96 a[i - 1] = a[j];
92 a[j] = x;
97 a[j] = x;
93 }
98 }
94 }
99 }
95 var wordDb = [
100 var wordDb = [
96 "Leela,", "Bender,", "we are", "going", "grave", "robbing.",
101 "Leela,", "Bender,", "we are", "going", "grave", "robbing.",
97 "Oh,", "I", "think", "we", "should", "just", "stay", "friends.",
102 "Oh,", "I", "think", "we", "should", "just", "stay", "friends.",
98 "got", "to", "find", "a", "way", "to", "escape", "the", "horrible",
103 "got", "to", "find", "a", "way", "to", "escape", "the", "horrible",
99 "ravages", "of", "youth.", "Suddenly,", "going", "to",
104 "ravages", "of", "youth.", "Suddenly,", "going", "to",
100 "the", "bathroom", "like", "clockwork,", "every", "three",
105 "the", "bathroom", "like", "clockwork,", "every", "three",
101 "hours.", "And", "those", "jerks", "at", "Social", "Security",
106 "hours.", "And", "those", "jerks", "at", "Social", "Security",
102 "stopped", "sending", "me", "checks.", "Now", "have", "to", "pay"
107 "stopped", "sending", "me", "checks.", "Now", "have", "to", "pay"
103 ];
108 ];
104 shuffle(wordDb);
109 shuffle(wordDb);
105 wordDb = wordDb.slice(0, getRandomArbitrary(3, wordDb.length));
110 wordDb = wordDb.slice(0, getRandomArbitrary(3, wordDb.length));
106 var randomMessage = wordDb.join(" ");
111 var randomMessage = wordDb.join(" ");
107 var payload = {
112 var payload = {
108 message: {
113 message: {
109 message: randomMessage + " " + new Date(),
114 message: randomMessage + " " + new Date(),
110 level: level,
115 level: level,
111 force: true
116 force: true
112 }
117 }
113 };
118 };
114 $.Topic('/notifications').publish(payload);
119 $.Topic('/notifications').publish(payload);
115 };
120 };
116 ctrlr.testNotificationsLive = function(event){
121 ctrlr.testNotificationsLive = function(event){
117 var ajax = $('#sendTestNotification')[0];
122 var ajax = $('#sendTestNotification')[0];
118 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN};
123 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN};
119 ajax.body = {test_msg: 'Hello !'};
124 ajax.body = {test_msg: 'Hello !'};
120 ajax.generateRequest();
125 ajax.generateRequest();
121 };
126 };
122 ctrlr.handleTestNotification = function(event){
127 ctrlr.handleTestNotification = function(event){
123 var reply = event.detail.response.response;
128 var reply = event.detail.response.response;
124 reply = reply || 'no reply form server';
129 reply = reply || 'no reply form server';
125 $('#test-response').html(reply);
130 $('#test-response').html(reply);
126 };
131 };
127
132
128 </script>
133 </script>
129
130 </template>
@@ -1,188 +1,161 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html>
2 <!DOCTYPE html>
3
3
4 <%
4 <%
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6 go_import_header = ''
6 go_import_header = ''
7 if hasattr(c, 'rhodecode_db_repo'):
7 if hasattr(c, 'rhodecode_db_repo'):
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10
10
11 if getattr(c, 'repo_group', None):
11 if getattr(c, 'repo_group', None):
12 c.template_context['repo_group_id'] = c.repo_group.group_id
12 c.template_context['repo_group_id'] = c.repo_group.group_id
13
13
14 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
14 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
15 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
15 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
16 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
16 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
17 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
17 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
18 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
18 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
19 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
19 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
20
20
21 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
21 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
22 c.template_context['default_user'] = {
22 c.template_context['default_user'] = {
23 'username': h.DEFAULT_USER,
23 'username': h.DEFAULT_USER,
24 'user_id': 1
24 'user_id': 1
25 }
25 }
26
26
27 %>
27 %>
28 <html xmlns="http://www.w3.org/1999/xhtml">
28 <html xmlns="http://www.w3.org/1999/xhtml">
29 <head>
29 <head>
30 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}"></script>
30 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script>
31 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
31 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
32 <title>${self.title()}</title>
32 <title>${self.title()}</title>
33 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
33 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
34
34
35 ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))}
35 ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))}
36
36
37 % if 'safari' in (request.user_agent or '').lower():
37 % if 'safari' in (request.user_agent or '').lower():
38 <meta name="referrer" content="origin">
38 <meta name="referrer" content="origin">
39 % else:
39 % else:
40 <meta name="referrer" content="origin-when-cross-origin">
40 <meta name="referrer" content="origin-when-cross-origin">
41 % endif
41 % endif
42
42
43 <%def name="robots()">
43 <%def name="robots()">
44 <meta name="robots" content="index, nofollow"/>
44 <meta name="robots" content="index, nofollow"/>
45 </%def>
45 </%def>
46 ${self.robots()}
46 ${self.robots()}
47 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
47 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
48
48
49 ## CSS definitions
49 ## CSS definitions
50 <%def name="css()">
50 <%def name="css()">
51 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
51 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
52 <!--[if lt IE 9]>
52 <!--[if lt IE 9]>
53 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
53 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
54 <![endif]-->
54 <![endif]-->
55 ## EXTRA FOR CSS
55 ## EXTRA FOR CSS
56 ${self.css_extra()}
56 ${self.css_extra()}
57 </%def>
57 </%def>
58 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
58 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
59 <%def name="css_extra()">
59 <%def name="css_extra()">
60 </%def>
60 </%def>
61
61
62 ${self.css()}
62 ${self.css()}
63
63
64 ## JAVASCRIPT
64 ## JAVASCRIPT
65 <%def name="js()">
65 <%def name="js()">
66 <script>
67 // setup Polymer options
68 window.Polymer = {lazyRegister: true, dom: 'shadow'};
69
70 // Load webcomponentsjs polyfill if browser does not support native Web Components
71 (function() {
72 'use strict';
73 var onload = function() {
74 // For native Imports, manually fire WebComponentsReady so user code
75 // can use the same code path for native and polyfill'd imports.
76 if (!window.HTMLImports) {
77 document.dispatchEvent(
78 new CustomEvent('WebComponentsReady', {bubbles: true})
79 );
80 }
81 };
82 var webComponentsSupported = (
83 'registerElement' in document
84 && 'import' in document.createElement('link')
85 && 'content' in document.createElement('template')
86 );
87 if (!webComponentsSupported) {
88 } else {
89 onload();
90 }
91 })();
92 </script>
93
66
94 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
67 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
95 <script type="text/javascript">
68 <script type="text/javascript">
96 // register templateContext to pass template variables to JS
69 // register templateContext to pass template variables to JS
97 var templateContext = ${h.json.dumps(c.template_context)|n};
70 var templateContext = ${h.json.dumps(c.template_context)|n};
98
71
99 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
72 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
100 var ASSET_URL = "${h.asset('')}";
73 var ASSET_URL = "${h.asset('')}";
101 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
74 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
102 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
75 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
103
76
104 var APPENLIGHT = {
77 var APPENLIGHT = {
105 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
78 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
106 key: '${getattr(c, "appenlight_api_public_key", "")}',
79 key: '${getattr(c, "appenlight_api_public_key", "")}',
107 % if getattr(c, 'appenlight_server_url', None):
80 % if getattr(c, 'appenlight_server_url', None):
108 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
81 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
109 % endif
82 % endif
110 requestInfo: {
83 requestInfo: {
111 % if getattr(c, 'rhodecode_user', None):
84 % if getattr(c, 'rhodecode_user', None):
112 ip: '${c.rhodecode_user.ip_addr}',
85 ip: '${c.rhodecode_user.ip_addr}',
113 username: '${c.rhodecode_user.username}'
86 username: '${c.rhodecode_user.username}'
114 % endif
87 % endif
115 },
88 },
116 tags: {
89 tags: {
117 rhodecode_version: '${c.rhodecode_version}',
90 rhodecode_version: '${c.rhodecode_version}',
118 rhodecode_edition: '${c.rhodecode_edition}'
91 rhodecode_edition: '${c.rhodecode_edition}'
119 }
92 }
120 };
93 };
121
94
122 </script>
95 </script>
123 <%include file="/base/plugins_base.mako"/>
96 <%include file="/base/plugins_base.mako"/>
124 <!--[if lt IE 9]>
97 <!--[if lt IE 9]>
125 <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script>
98 <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script>
126 <![endif]-->
99 <![endif]-->
127 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
100 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
128 <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script>
101 <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script>
129 ## avoide escaping the %N
102 ## avoide escaping the %N
130 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
103 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
131 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
104 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
132
105
133
106
134 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
107 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
135 ${self.js_extra()}
108 ${self.js_extra()}
136
109
137 <script type="text/javascript">
110 <script type="text/javascript">
138 Rhodecode = (function() {
111 Rhodecode = (function() {
139 function _Rhodecode() {
112 function _Rhodecode() {
140 this.comments = new CommentsController();
113 this.comments = new CommentsController();
141 }
114 }
142 return new _Rhodecode();
115 return new _Rhodecode();
143 })();
116 })();
144
117
145 $(document).ready(function(){
118 $(document).ready(function(){
146 show_more_event();
119 show_more_event();
147 timeagoActivate();
120 timeagoActivate();
148 clipboardActivate();
121 clipboardActivate();
149 })
122 })
150 </script>
123 </script>
151
124
152 </%def>
125 </%def>
153
126
154 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
127 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
155 <%def name="js_extra()"></%def>
128 <%def name="js_extra()"></%def>
156 ${self.js()}
129 ${self.js()}
157
130
158 <%def name="head_extra()"></%def>
131 <%def name="head_extra()"></%def>
159 ${self.head_extra()}
132 ${self.head_extra()}
160 ## extra stuff
133 ## extra stuff
161 %if c.pre_code:
134 %if c.pre_code:
162 ${c.pre_code|n}
135 ${c.pre_code|n}
163 %endif
136 %endif
164 </head>
137 </head>
165 <body id="body">
138 <body id="body">
166 <noscript>
139 <noscript>
167 <div class="noscript-error">
140 <div class="noscript-error">
168 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
141 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
169 </div>
142 </div>
170 </noscript>
143 </noscript>
171 ## IE hacks
144 ## IE hacks
172 <!--[if IE 7]>
145 <!--[if IE 7]>
173 <script>$(document.body).addClass('ie7')</script>
146 <script>$(document.body).addClass('ie7')</script>
174 <![endif]-->
147 <![endif]-->
175 <!--[if IE 8]>
148 <!--[if IE 8]>
176 <script>$(document.body).addClass('ie8')</script>
149 <script>$(document.body).addClass('ie8')</script>
177 <![endif]-->
150 <![endif]-->
178 <!--[if IE 9]>
151 <!--[if IE 9]>
179 <script>$(document.body).addClass('ie9')</script>
152 <script>$(document.body).addClass('ie9')</script>
180 <![endif]-->
153 <![endif]-->
181
154
182 ${next.body()}
155 ${next.body()}
183 %if c.post_code:
156 %if c.post_code:
184 ${c.post_code|n}
157 ${c.post_code|n}
185 %endif
158 %endif
186 <rhodecode-app></rhodecode-app>
159 <rhodecode-app></rhodecode-app>
187 </body>
160 </body>
188 </html>
161 </html>
General Comments 0
You need to be logged in to leave comments. Login now