Show More
@@ -1,150 +1,166 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.initPlugins(); | |||
|
20 | // after rest of application loads and topics get fired, launch connection | |||
|
21 | $(document).ready(function () { | |||
19 | this.kickoffChannelstreamPlugin(); |
|
22 | this.kickoffChannelstreamPlugin(); | |
|
23 | }.bind(this)); | |||
20 | }, |
|
24 | }, | |
21 |
|
25 | |||
|
26 | initPlugins: function(){ | |||
|
27 | for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) { | |||
|
28 | var pluginDef = window.APPLICATION_PLUGINS[i]; | |||
|
29 | if (pluginDef.component){ | |||
|
30 | var pluginElem = document.createElement(pluginDef.component); | |||
|
31 | this.shadowRoot.appendChild(pluginElem); | |||
|
32 | if (typeof pluginElem.init !== 'undefined'){ | |||
|
33 | pluginElem.init(); | |||
|
34 | } | |||
|
35 | } | |||
|
36 | } | |||
|
37 | }, | |||
22 | /** proxy to channelstream connection */ |
|
38 | /** proxy to channelstream connection */ | |
23 | getChannelStreamConnection: function () { |
|
39 | getChannelStreamConnection: function () { | |
24 | return this.$['channelstream-connection']; |
|
40 | return this.$['channelstream-connection']; | |
25 | }, |
|
41 | }, | |
26 |
|
42 | |||
27 | handleNotifications: function (data) { |
|
43 | handleNotifications: function (data) { | |
28 | var elem = document.getElementById('notifications'); |
|
44 | var elem = document.getElementById('notifications'); | |
29 | if(elem){ |
|
45 | if(elem){ | |
30 | elem.handleNotification(data); |
|
46 | elem.handleNotification(data); | |
31 | } |
|
47 | } | |
32 |
|
48 | |||
33 | }, |
|
49 | }, | |
34 |
|
50 | |||
35 | faviconUpdate: function (data) { |
|
51 | faviconUpdate: function (data) { | |
36 | this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count; |
|
52 | this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count; | |
37 | }, |
|
53 | }, | |
38 |
|
54 | |||
39 | /** opens connection to ws server */ |
|
55 | /** opens connection to ws server */ | |
40 | kickoffChannelstreamPlugin: function (data) { |
|
56 | kickoffChannelstreamPlugin: function (data) { | |
41 | ccLog.debug('kickoffChannelstreamPlugin'); |
|
57 | ccLog.debug('kickoffChannelstreamPlugin'); | |
42 | var channels = ['broadcast']; |
|
58 | var channels = ['broadcast']; | |
43 | var addChannels = this.checkViewChannels(); |
|
59 | var addChannels = this.checkViewChannels(); | |
44 | for (var i = 0; i < addChannels.length; i++) { |
|
60 | for (var i = 0; i < addChannels.length; i++) { | |
45 | channels.push(addChannels[i]); |
|
61 | channels.push(addChannels[i]); | |
46 | } |
|
62 | } | |
47 | if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){ |
|
63 | if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){ | |
48 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
64 | var channelstreamConnection = this.getChannelStreamConnection(); | |
49 | channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect; |
|
65 | channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect; | |
50 | channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe; |
|
66 | channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe; | |
51 | channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws'; |
|
67 | channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws'; | |
52 | channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen'; |
|
68 | channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen'; | |
53 | // some channels might already be registered by topic |
|
69 | // some channels might already be registered by topic | |
54 | for (var i = 0; i < channels.length; i++) { |
|
70 | for (var i = 0; i < channels.length; i++) { | |
55 | channelstreamConnection.push('channels', channels[i]); |
|
71 | channelstreamConnection.push('channels', channels[i]); | |
56 | } |
|
72 | } | |
57 | // append any additional channels registered in other plugins |
|
73 | // append any additional channels registered in other plugins | |
58 | $.Topic('/connection_controller/subscribe').processPrepared(); |
|
74 | $.Topic('/connection_controller/subscribe').processPrepared(); | |
59 | channelstreamConnection.connect(); |
|
75 | channelstreamConnection.connect(); | |
60 | } |
|
76 | } | |
61 | }, |
|
77 | }, | |
62 |
|
78 | |||
63 | checkViewChannels: function () { |
|
79 | checkViewChannels: function () { | |
64 | // subscribe to different channels data is sent. |
|
80 | // subscribe to different channels data is sent. | |
65 |
|
81 | |||
66 | var channels = []; |
|
82 | var channels = []; | |
67 | // subscribe to PR repo channel for PR's' |
|
83 | // subscribe to PR repo channel for PR's' | |
68 | if (templateContext.pull_request_data.pull_request_id) { |
|
84 | if (templateContext.pull_request_data.pull_request_id) { | |
69 | var channelName = '/repo$' + templateContext.repo_name + '$/pr/' + |
|
85 | var channelName = '/repo$' + templateContext.repo_name + '$/pr/' + | |
70 | String(templateContext.pull_request_data.pull_request_id); |
|
86 | String(templateContext.pull_request_data.pull_request_id); | |
71 | channels.push(channelName); |
|
87 | channels.push(channelName); | |
72 | } |
|
88 | } | |
73 |
|
89 | |||
74 | if (templateContext.commit_data.commit_id) { |
|
90 | if (templateContext.commit_data.commit_id) { | |
75 | var channelName = '/repo$' + templateContext.repo_name + '$/commit/' + |
|
91 | var channelName = '/repo$' + templateContext.repo_name + '$/commit/' + | |
76 | String(templateContext.commit_data.commit_id); |
|
92 | String(templateContext.commit_data.commit_id); | |
77 | channels.push(channelName); |
|
93 | channels.push(channelName); | |
78 | } |
|
94 | } | |
79 |
|
95 | |||
80 | return channels; |
|
96 | return channels; | |
81 | }, |
|
97 | }, | |
82 |
|
98 | |||
83 | /** subscribes users from channels in channelstream */ |
|
99 | /** subscribes users from channels in channelstream */ | |
84 | subscribeToChannelTopic: function (channels) { |
|
100 | subscribeToChannelTopic: function (channels) { | |
85 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
101 | var channelstreamConnection = this.getChannelStreamConnection(); | |
86 | var toSubscribe = channelstreamConnection.calculateSubscribe(channels); |
|
102 | var toSubscribe = channelstreamConnection.calculateSubscribe(channels); | |
87 | ccLog.debug('subscribeToChannelTopic', toSubscribe); |
|
103 | ccLog.debug('subscribeToChannelTopic', toSubscribe); | |
88 | if (toSubscribe.length > 0) { |
|
104 | if (toSubscribe.length > 0) { | |
89 | // if we are connected then subscribe |
|
105 | // if we are connected then subscribe | |
90 | if (channelstreamConnection.connected) { |
|
106 | if (channelstreamConnection.connected) { | |
91 | channelstreamConnection.subscribe(toSubscribe); |
|
107 | channelstreamConnection.subscribe(toSubscribe); | |
92 | } |
|
108 | } | |
93 | // not connected? just push channels onto the stack |
|
109 | // not connected? just push channels onto the stack | |
94 | else { |
|
110 | else { | |
95 | for (var i = 0; i < toSubscribe.length; i++) { |
|
111 | for (var i = 0; i < toSubscribe.length; i++) { | |
96 | channelstreamConnection.push('channels', toSubscribe[i]); |
|
112 | channelstreamConnection.push('channels', toSubscribe[i]); | |
97 | } |
|
113 | } | |
98 | } |
|
114 | } | |
99 | } |
|
115 | } | |
100 | }, |
|
116 | }, | |
101 |
|
117 | |||
102 | /** publish received messages into correct topic */ |
|
118 | /** publish received messages into correct topic */ | |
103 | receivedMessage: function (event) { |
|
119 | receivedMessage: function (event) { | |
104 | for (var i = 0; i < event.detail.length; i++) { |
|
120 | for (var i = 0; i < event.detail.length; i++) { | |
105 | var message = event.detail[i]; |
|
121 | var message = event.detail[i]; | |
106 | if (message.message.topic) { |
|
122 | if (message.message.topic) { | |
107 | ccLog.debug('publishing', message.message.topic); |
|
123 | ccLog.debug('publishing', message.message.topic); | |
108 | $.Topic(message.message.topic).publish(message); |
|
124 | $.Topic(message.message.topic).publish(message); | |
109 | } |
|
125 | } | |
110 | else if (message.type === 'presence'){ |
|
126 | else if (message.type === 'presence'){ | |
111 | $.Topic('/connection_controller/presence').publish(message); |
|
127 | $.Topic('/connection_controller/presence').publish(message); | |
112 | } |
|
128 | } | |
113 | else { |
|
129 | else { | |
114 | ccLog.warn('unhandled message', message); |
|
130 | ccLog.warn('unhandled message', message); | |
115 | } |
|
131 | } | |
116 | } |
|
132 | } | |
117 | }, |
|
133 | }, | |
118 |
|
134 | |||
119 | handleConnected: function (event) { |
|
135 | handleConnected: function (event) { | |
120 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
136 | var channelstreamConnection = this.getChannelStreamConnection(); | |
121 | channelstreamConnection.set('channelsState', |
|
137 | channelstreamConnection.set('channelsState', | |
122 | event.detail.channels_info); |
|
138 | event.detail.channels_info); | |
123 | channelstreamConnection.set('userState', event.detail.state); |
|
139 | channelstreamConnection.set('userState', event.detail.state); | |
124 | channelstreamConnection.set('channels', event.detail.channels); |
|
140 | channelstreamConnection.set('channels', event.detail.channels); | |
125 | this.propagageChannelsState(); |
|
141 | this.propagageChannelsState(); | |
126 | }, |
|
142 | }, | |
127 | handleSubscribed: function (event) { |
|
143 | handleSubscribed: function (event) { | |
128 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
144 | var channelstreamConnection = this.getChannelStreamConnection(); | |
129 | var channelInfo = event.detail.channels_info; |
|
145 | var channelInfo = event.detail.channels_info; | |
130 | var channelKeys = Object.keys(event.detail.channels_info); |
|
146 | var channelKeys = Object.keys(event.detail.channels_info); | |
131 | for (var i = 0; i < channelKeys.length; i++) { |
|
147 | for (var i = 0; i < channelKeys.length; i++) { | |
132 | var key = channelKeys[i]; |
|
148 | var key = channelKeys[i]; | |
133 | channelstreamConnection.set(['channelsState', key], channelInfo[key]); |
|
149 | channelstreamConnection.set(['channelsState', key], channelInfo[key]); | |
134 | } |
|
150 | } | |
135 | channelstreamConnection.set('channels', event.detail.channels); |
|
151 | channelstreamConnection.set('channels', event.detail.channels); | |
136 | this.propagageChannelsState(); |
|
152 | this.propagageChannelsState(); | |
137 | }, |
|
153 | }, | |
138 | /** propagates channel states on topics */ |
|
154 | /** propagates channel states on topics */ | |
139 | propagageChannelsState: function (event) { |
|
155 | propagageChannelsState: function (event) { | |
140 | var channelstreamConnection = this.getChannelStreamConnection(); |
|
156 | var channelstreamConnection = this.getChannelStreamConnection(); | |
141 | var channel_data = channelstreamConnection.channelsState; |
|
157 | var channel_data = channelstreamConnection.channelsState; | |
142 | var channels = channelstreamConnection.channels; |
|
158 | var channels = channelstreamConnection.channels; | |
143 | for (var i = 0; i < channels.length; i++) { |
|
159 | for (var i = 0; i < channels.length; i++) { | |
144 | var key = channels[i]; |
|
160 | var key = channels[i]; | |
145 | $.Topic('/connection_controller/channel_update').publish( |
|
161 | $.Topic('/connection_controller/channel_update').publish( | |
146 | {channel: key, state: channel_data[key]} |
|
162 | {channel: key, state: channel_data[key]} | |
147 | ); |
|
163 | ); | |
148 | } |
|
164 | } | |
149 | } |
|
165 | } | |
150 | }); |
|
166 | }); |
@@ -1,161 +1,162 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <!DOCTYPE html> |
|
2 | <!DOCTYPE html> | |
3 |
|
3 | |||
4 | <% |
|
4 | <% | |
5 | c.template_context['repo_name'] = getattr(c, 'repo_name', '') |
|
5 | c.template_context['repo_name'] = getattr(c, 'repo_name', '') | |
6 | go_import_header = '' |
|
6 | go_import_header = '' | |
7 | if hasattr(c, 'rhodecode_db_repo'): |
|
7 | if hasattr(c, 'rhodecode_db_repo'): | |
8 | c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type |
|
8 | c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type | |
9 | c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1] |
|
9 | c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1] | |
10 |
|
10 | |||
11 | if getattr(c, 'repo_group', None): |
|
11 | if getattr(c, 'repo_group', None): | |
12 | c.template_context['repo_group_id'] = c.repo_group.group_id |
|
12 | c.template_context['repo_group_id'] = c.repo_group.group_id | |
13 |
|
13 | |||
14 | if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id: |
|
14 | if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id: | |
15 | c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username |
|
15 | c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username | |
16 | c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email |
|
16 | c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email | |
17 | c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True) |
|
17 | c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True) | |
18 | c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name |
|
18 | c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name | |
19 | c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name |
|
19 | c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name | |
20 |
|
20 | |||
21 | c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer') |
|
21 | c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer') | |
22 | c.template_context['default_user'] = { |
|
22 | c.template_context['default_user'] = { | |
23 | 'username': h.DEFAULT_USER, |
|
23 | 'username': h.DEFAULT_USER, | |
24 | 'user_id': 1 |
|
24 | 'user_id': 1 | |
25 | } |
|
25 | } | |
26 |
|
26 | |||
27 | %> |
|
27 | %> | |
28 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
28 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
29 | <head> |
|
29 | <head> | |
30 | <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script> |
|
30 | <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.js', ver=c.rhodecode_version_hash)}"></script> | |
31 | <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 |
|
66 | |||
67 | <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> | |
68 | <script type="text/javascript"> |
|
68 | <script type="text/javascript"> | |
69 | // register templateContext to pass template variables to JS |
|
69 | // register templateContext to pass template variables to JS | |
70 | var templateContext = ${h.json.dumps(c.template_context)|n}; |
|
70 | var templateContext = ${h.json.dumps(c.template_context)|n}; | |
71 |
|
71 | |||
72 | var APPLICATION_URL = "${h.route_path('home').rstrip('/')}"; |
|
72 | var APPLICATION_URL = "${h.route_path('home').rstrip('/')}"; | |
|
73 | var APPLICATION_PLUGINS = []; | |||
73 | var ASSET_URL = "${h.asset('')}"; |
|
74 | var ASSET_URL = "${h.asset('')}"; | |
74 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; |
|
75 | var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; | |
75 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; |
|
76 | var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; | |
76 |
|
77 | |||
77 | var APPENLIGHT = { |
|
78 | var APPENLIGHT = { | |
78 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, |
|
79 | enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, | |
79 | key: '${getattr(c, "appenlight_api_public_key", "")}', |
|
80 | key: '${getattr(c, "appenlight_api_public_key", "")}', | |
80 | % if getattr(c, 'appenlight_server_url', None): |
|
81 | % if getattr(c, 'appenlight_server_url', None): | |
81 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', |
|
82 | serverUrl: '${getattr(c, "appenlight_server_url", "")}', | |
82 | % endif |
|
83 | % endif | |
83 | requestInfo: { |
|
84 | requestInfo: { | |
84 | % if getattr(c, 'rhodecode_user', None): |
|
85 | % if getattr(c, 'rhodecode_user', None): | |
85 | ip: '${c.rhodecode_user.ip_addr}', |
|
86 | ip: '${c.rhodecode_user.ip_addr}', | |
86 | username: '${c.rhodecode_user.username}' |
|
87 | username: '${c.rhodecode_user.username}' | |
87 | % endif |
|
88 | % endif | |
88 | }, |
|
89 | }, | |
89 | tags: { |
|
90 | tags: { | |
90 | rhodecode_version: '${c.rhodecode_version}', |
|
91 | rhodecode_version: '${c.rhodecode_version}', | |
91 | rhodecode_edition: '${c.rhodecode_edition}' |
|
92 | rhodecode_edition: '${c.rhodecode_edition}' | |
92 | } |
|
93 | } | |
93 | }; |
|
94 | }; | |
94 |
|
95 | |||
95 | </script> |
|
96 | </script> | |
96 | <%include file="/base/plugins_base.mako"/> |
|
97 | <%include file="/base/plugins_base.mako"/> | |
97 | <!--[if lt IE 9]> |
|
98 | <!--[if lt IE 9]> | |
98 | <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script> |
|
99 | <script language="javascript" type="text/javascript" src="${h.asset('js/src/excanvas.min.js')}"></script> | |
99 | <![endif]--> |
|
100 | <![endif]--> | |
100 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script> |
|
101 | <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> |
|
102 | <script> var alertMessagePayloads = ${h.flash.json_alerts(request=request)|n}; </script> | |
102 | ## avoide escaping the %N |
|
103 | ## avoide escaping the %N | |
103 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script> |
|
104 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script> | |
104 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> |
|
105 | <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script> | |
105 |
|
106 | |||
106 |
|
107 | |||
107 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
108 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
108 | ${self.js_extra()} |
|
109 | ${self.js_extra()} | |
109 |
|
110 | |||
110 | <script type="text/javascript"> |
|
111 | <script type="text/javascript"> | |
111 | Rhodecode = (function() { |
|
112 | Rhodecode = (function() { | |
112 | function _Rhodecode() { |
|
113 | function _Rhodecode() { | |
113 | this.comments = new CommentsController(); |
|
114 | this.comments = new CommentsController(); | |
114 | } |
|
115 | } | |
115 | return new _Rhodecode(); |
|
116 | return new _Rhodecode(); | |
116 | })(); |
|
117 | })(); | |
117 |
|
118 | |||
118 | $(document).ready(function(){ |
|
119 | $(document).ready(function(){ | |
119 | show_more_event(); |
|
120 | show_more_event(); | |
120 | timeagoActivate(); |
|
121 | timeagoActivate(); | |
121 | clipboardActivate(); |
|
122 | clipboardActivate(); | |
122 | }) |
|
123 | }) | |
123 | </script> |
|
124 | </script> | |
124 |
|
125 | |||
125 | </%def> |
|
126 | </%def> | |
126 |
|
127 | |||
127 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates |
|
128 | ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates | |
128 | <%def name="js_extra()"></%def> |
|
129 | <%def name="js_extra()"></%def> | |
129 | ${self.js()} |
|
130 | ${self.js()} | |
130 |
|
131 | |||
131 | <%def name="head_extra()"></%def> |
|
132 | <%def name="head_extra()"></%def> | |
132 | ${self.head_extra()} |
|
133 | ${self.head_extra()} | |
133 | ## extra stuff |
|
134 | ## extra stuff | |
134 | %if c.pre_code: |
|
135 | %if c.pre_code: | |
135 | ${c.pre_code|n} |
|
136 | ${c.pre_code|n} | |
136 | %endif |
|
137 | %endif | |
137 | </head> |
|
138 | </head> | |
138 | <body id="body"> |
|
139 | <body id="body"> | |
139 | <noscript> |
|
140 | <noscript> | |
140 | <div class="noscript-error"> |
|
141 | <div class="noscript-error"> | |
141 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} |
|
142 | ${_('Please enable JavaScript to use RhodeCode Enterprise')} | |
142 | </div> |
|
143 | </div> | |
143 | </noscript> |
|
144 | </noscript> | |
144 | ## IE hacks |
|
145 | ## IE hacks | |
145 | <!--[if IE 7]> |
|
146 | <!--[if IE 7]> | |
146 | <script>$(document.body).addClass('ie7')</script> |
|
147 | <script>$(document.body).addClass('ie7')</script> | |
147 | <![endif]--> |
|
148 | <![endif]--> | |
148 | <!--[if IE 8]> |
|
149 | <!--[if IE 8]> | |
149 | <script>$(document.body).addClass('ie8')</script> |
|
150 | <script>$(document.body).addClass('ie8')</script> | |
150 | <![endif]--> |
|
151 | <![endif]--> | |
151 | <!--[if IE 9]> |
|
152 | <!--[if IE 9]> | |
152 | <script>$(document.body).addClass('ie9')</script> |
|
153 | <script>$(document.body).addClass('ie9')</script> | |
153 | <![endif]--> |
|
154 | <![endif]--> | |
154 |
|
155 | |||
155 | ${next.body()} |
|
156 | ${next.body()} | |
156 | %if c.post_code: |
|
157 | %if c.post_code: | |
157 | ${c.post_code|n} |
|
158 | ${c.post_code|n} | |
158 | %endif |
|
159 | %endif | |
159 | <rhodecode-app></rhodecode-app> |
|
160 | <rhodecode-app></rhodecode-app> | |
160 | </body> |
|
161 | </body> | |
161 | </html> |
|
162 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now