Show More
@@ -17,6 +17,7 b'' | |||||
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
|
20 | from rhodecode.config import routing_links | |||
20 |
|
21 | |||
21 |
|
22 | |||
22 | def includeme(config): |
|
23 | def includeme(config): | |
@@ -37,5 +38,8 b' def includeme(config):' | |||||
37 | name='goto_switcher_data', |
|
38 | name='goto_switcher_data', | |
38 | pattern='/_goto_data') |
|
39 | pattern='/_goto_data') | |
39 |
|
40 | |||
|
41 | # register our static links via redirection mechanismy | |||
|
42 | routing_links.connect_redirection_links(config) | |||
|
43 | ||||
40 | # Scan module for configuration decorators. |
|
44 | # Scan module for configuration decorators. | |
41 | config.scan() |
|
45 | config.scan() |
@@ -32,8 +32,6 b' import os' | |||||
32 | import re |
|
32 | import re | |
33 | from routes import Mapper |
|
33 | from routes import Mapper | |
34 |
|
34 | |||
35 | from rhodecode.config import routing_links |
|
|||
36 |
|
||||
37 | # prefix for non repository related links needs to be prefixed with `/` |
|
35 | # prefix for non repository related links needs to be prefixed with `/` | |
38 | ADMIN_PREFIX = '/_admin' |
|
36 | ADMIN_PREFIX = '/_admin' | |
39 | STATIC_FILE_PREFIX = '/_static' |
|
37 | STATIC_FILE_PREFIX = '/_static' | |
@@ -189,24 +187,7 b' def make_map(config):' | |||||
189 | # MAIN PAGE |
|
187 | # MAIN PAGE | |
190 | rmap.connect('home', '/', controller='home', action='index', jsroute=True) |
|
188 | rmap.connect('home', '/', controller='home', action='index', jsroute=True) | |
191 |
|
189 | |||
192 | # TODO: johbo: Static links, to be replaced by our redirection mechanism |
|
190 | # ping and pylons error test | |
193 | rmap.connect('rst_help', |
|
|||
194 | 'http://docutils.sourceforge.net/docs/user/rst/quickref.html', |
|
|||
195 | _static=True) |
|
|||
196 | rmap.connect('markdown_help', |
|
|||
197 | 'http://daringfireball.net/projects/markdown/syntax', |
|
|||
198 | _static=True) |
|
|||
199 | rmap.connect('rhodecode_official', 'https://rhodecode.com', _static=True) |
|
|||
200 | rmap.connect('rhodecode_support', 'https://rhodecode.com/help/', _static=True) |
|
|||
201 | rmap.connect('rhodecode_translations', 'https://rhodecode.com/translate/enterprise', _static=True) |
|
|||
202 | # TODO: anderson - making this a static link since redirect won't play |
|
|||
203 | # nice with POST requests |
|
|||
204 | rmap.connect('enterprise_license_convert_from_old', |
|
|||
205 | 'https://rhodecode.com/u/license-upgrade', |
|
|||
206 | _static=True) |
|
|||
207 |
|
||||
208 | routing_links.connect_redirection_links(rmap) |
|
|||
209 |
|
||||
210 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') |
|
191 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') | |
211 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') |
|
192 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') | |
212 |
|
193 |
@@ -46,27 +46,56 b' you can see it working.' | |||||
46 | # flake8: noqa |
|
46 | # flake8: noqa | |
47 | from __future__ import unicode_literals |
|
47 | from __future__ import unicode_literals | |
48 |
|
48 | |||
49 |
|
||||
50 | link_config = [ |
|
49 | link_config = [ | |
51 | {"name": "enterprise_docs", |
|
50 | { | |
|
51 | "name": "enterprise_docs", | |||
52 | "target": "https://rhodecode.com/r1/enterprise/docs/", |
|
52 | "target": "https://rhodecode.com/r1/enterprise/docs/", | |
53 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/", |
|
53 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/", | |
54 |
|
|
54 | }, | |
55 | {"name": "enterprise_log_file_locations", |
|
55 | { | |
|
56 | "name": "enterprise_log_file_locations", | |||
56 | "target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/", |
|
57 | "target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/", | |
57 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files", |
|
58 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files", | |
58 |
|
|
59 | }, | |
59 | {"name": "enterprise_issue_tracker_settings", |
|
60 | { | |
|
61 | "name": "enterprise_issue_tracker_settings", | |||
60 | "target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/", |
|
62 | "target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/", | |
61 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html", |
|
63 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html", | |
62 |
|
|
64 | }, | |
63 | {"name": "enterprise_svn_setup", |
|
65 | { | |
|
66 | "name": "enterprise_svn_setup", | |||
64 | "target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/", |
|
67 | "target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/", | |
65 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html", |
|
68 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html", | |
66 |
|
|
69 | }, | |
|
70 | { | |||
|
71 | "name": "rst_help", | |||
|
72 | "target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |||
|
73 | "external_target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |||
|
74 | }, | |||
|
75 | { | |||
|
76 | "name": "markdown_help", | |||
|
77 | "target": "http://daringfireball.net/projects/markdown/syntax", | |||
|
78 | "external_target": "http://daringfireball.net/projects/markdown/syntax", | |||
|
79 | }, | |||
|
80 | { | |||
|
81 | "name": "rhodecode_official", | |||
|
82 | "target": "https://rhodecode.com", | |||
|
83 | "external_target": "https://rhodecode.com/", | |||
|
84 | }, | |||
|
85 | { | |||
|
86 | "name": "rhodecode_support", | |||
|
87 | "target": "https://rhodecode.com/help/", | |||
|
88 | "external_target": "https://rhodecode.com/support", | |||
|
89 | }, | |||
|
90 | { | |||
|
91 | "name": "rhodecode_translations", | |||
|
92 | "target": "https://rhodecode.com/translate/enterprise", | |||
|
93 | "external_target": "https://www.transifex.com/rhodecode/RhodeCode/", | |||
|
94 | }, | |||
|
95 | ||||
67 | ] |
|
96 | ] | |
68 |
|
97 | |||
69 |
|
98 | |||
70 |
def connect_redirection_links( |
|
99 | def connect_redirection_links(config): | |
71 | for link in link_config: |
|
100 | for link in link_config: | |
72 |
|
|
101 | config.add_route(link['name'], link['target'], static=True) |
@@ -302,7 +302,7 b' def attach_context_attributes(context, r' | |||||
302 | 'rhodecode_markup_renderer', 'rst') |
|
302 | 'rhodecode_markup_renderer', 'rst') | |
303 | context.visual.comment_types = ChangesetComment.COMMENT_TYPES |
|
303 | context.visual.comment_types = ChangesetComment.COMMENT_TYPES | |
304 | context.visual.rhodecode_support_url = \ |
|
304 | context.visual.rhodecode_support_url = \ | |
305 | rc_config.get('rhodecode_support_url') or url('rhodecode_support') |
|
305 | rc_config.get('rhodecode_support_url') or h.route_url('rhodecode_support') | |
306 |
|
306 | |||
307 | context.pre_code = rc_config.get('rhodecode_pre_code') |
|
307 | context.pre_code = rc_config.get('rhodecode_pre_code') | |
308 | context.post_code = rc_config.get('rhodecode_post_code') |
|
308 | context.post_code = rc_config.get('rhodecode_post_code') |
@@ -127,7 +127,7 b'' | |||||
127 | ## allowed_languages is defined in the users.py |
|
127 | ## allowed_languages is defined in the users.py | |
128 | ## c.language comes from base.py as a default language |
|
128 | ## c.language comes from base.py as a default language | |
129 | ${h.select('language', c.language, c.allowed_languages)} |
|
129 | ${h.select('language', c.language, c.allowed_languages)} | |
130 | <p class="help-block">${h.literal(_('Help translate %(rc_link)s into your language.') % {'rc_link': h.link_to('RhodeCode Enterprise', h.url('rhodecode_translations'))})}</p> |
|
130 | <p class="help-block">${h.literal(_('Help translate %(rc_link)s into your language.') % {'rc_link': h.link_to('RhodeCode Enterprise', h.route_url('rhodecode_translations'))})}</p> | |
131 | </div> |
|
131 | </div> | |
132 | </div> |
|
132 | </div> | |
133 | <div class="buttons"> |
|
133 | <div class="buttons"> |
@@ -41,7 +41,7 b'' | |||||
41 | % if c.visual.show_version: |
|
41 | % if c.visual.show_version: | |
42 | RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition} |
|
42 | RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition} | |
43 | % endif |
|
43 | % endif | |
44 | © 2010-${h.datetime.today().year}, <a href="${h.url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved. |
|
44 | © 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved. | |
45 | % if c.visual.rhodecode_support_url: |
|
45 | % if c.visual.rhodecode_support_url: | |
46 | <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a> |
|
46 | <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a> | |
47 | % endif |
|
47 | % endif |
@@ -18,7 +18,7 b'' | |||||
18 | <td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td> |
|
18 | <td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td> | |
19 | <td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td> |
|
19 | <td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td> | |
20 | <td class="td-prefix issue-tracker-example">#</td> |
|
20 | <td class="td-prefix issue-tracker-example">#</td> | |
21 |
<td class="issue-tracker-example"><a href=" |
|
21 | <td class="issue-tracker-example"><a href="${h.route_url('enterprise_issue_tracker_settings')}" target="_blank">${_('Read more')}</a></td> | |
22 | </tr> |
|
22 | </tr> | |
23 | %for uid, entry in patterns: |
|
23 | %for uid, entry in patterns: | |
24 | <tr id="entry_${uid}"> |
|
24 | <tr id="entry_${uid}"> |
@@ -201,7 +201,7 b'' | |||||
201 | <div class="label"> |
|
201 | <div class="label"> | |
202 | <span class="help-block"> |
|
202 | <span class="help-block"> | |
203 | ${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')} |
|
203 | ${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')} | |
204 | <a href="${h.url('enterprise_svn_setup')}" target="_blank">${_('SVN Protocol setup Documentation')}</a>. |
|
204 | <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('SVN Protocol setup Documentation')}</a>. | |
205 | </span> |
|
205 | </span> | |
206 | </div> |
|
206 | </div> | |
207 | </div> |
|
207 | </div> |
@@ -346,7 +346,7 b'' | |||||
346 | <div class="toolbar"> |
|
346 | <div class="toolbar"> | |
347 | <div class="toolbar-text"> |
|
347 | <div class="toolbar-text"> | |
348 | ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % ( |
|
348 | ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % ( | |
349 | ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), |
|
349 | ('<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), | |
350 | ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')), |
|
350 | ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')), | |
351 | ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.')) |
|
351 | ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.')) | |
352 | ) |
|
352 | ) |
@@ -62,12 +62,12 b'' | |||||
62 | <div class="inner-column"> |
|
62 | <div class="inner-column"> | |
63 | <h4>Support</h4> |
|
63 | <h4>Support</h4> | |
64 | <p>For support, go to <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>. |
|
64 | <p>For support, go to <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>. | |
65 | It may be useful to include your log file; see the log file locations <a href="${h.url('enterprise_log_file_locations')}">here</a>. |
|
65 | It may be useful to include your log file; see the log file locations <a href="${h.route_url('enterprise_log_file_locations')}">here</a>. | |
66 | </p> |
|
66 | </p> | |
67 | </div> |
|
67 | </div> | |
68 | <div class="inner-column"> |
|
68 | <div class="inner-column"> | |
69 | <h4>Documentation</h4> |
|
69 | <h4>Documentation</h4> | |
70 | <p>For more information, see <a href="${h.url('enterprise_docs')}">docs.rhodecode.com</a>.</p> |
|
70 | <p>For more information, see <a href="${h.route_url('enterprise_docs')}">docs.rhodecode.com</a>.</p> | |
71 | </div> |
|
71 | </div> | |
72 | </div> |
|
72 | </div> | |
73 | </div> |
|
73 | </div> |
@@ -53,7 +53,7 b'' | |||||
53 | <input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/> |
|
53 | <input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/> | |
54 | <a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a> |
|
54 | <a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a> | |
55 | <a id="clone_by_id" class="clone">${_('Show by ID')}</a> |
|
55 | <a id="clone_by_id" class="clone">${_('Show by ID')}</a> | |
56 | <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p> |
|
56 | <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p> | |
57 | </div> |
|
57 | </div> | |
58 | %else: |
|
58 | %else: | |
59 | <div class="left-label"> |
|
59 | <div class="left-label"> |
@@ -18,23 +18,28 b'' | |||||
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import mock |
|
21 | import pytest | |
22 |
|
22 | import requests | ||
23 | from rhodecode.config import routing_links |
|
23 | from rhodecode.config import routing_links | |
24 |
|
24 | |||
25 |
|
25 | |||
26 |
def |
|
26 | def check_connection(): | |
27 | link_config = [ |
|
27 | try: | |
28 | {"name": "example_link", |
|
28 | response = requests.get('https://rhodecode.com') | |
29 | "external_target": "http://example.com", |
|
29 | return response.status_code == 200 | |
30 | "target": "https://rhodecode.com/r/v1/enterprise/example", |
|
30 | except Exception as e: | |
31 | }, |
|
31 | print(e) | |
32 | ] |
|
32 | ||
|
33 | return False | |||
|
34 | ||||
33 |
|
35 | |||
34 | rmap = mock.Mock() |
|
36 | connection_available = pytest.mark.skipif( | |
35 | with mock.patch.object(routing_links, 'link_config', link_config): |
|
37 | not check_connection(), reason="No outside internet connection available") | |
36 | routing_links.connect_redirection_links(rmap) |
|
38 | ||
37 |
|
39 | |||
38 | rmap.connect.assert_called_with( |
|
40 | @connection_available | |
39 | link_config[0]['name'], link_config[0]['target'], |
|
41 | def test_connect_redirection_links(): | |
40 | _static=True) |
|
42 | ||
|
43 | for link_data in routing_links.link_config: | |||
|
44 | response = requests.get(link_data['target']) | |||
|
45 | assert response.url == link_data['external_target'] |
General Comments 0
You need to be logged in to leave comments.
Login now