parent
0b80fe66c9
commit
2d37a1e953
12 changed files with 82 additions and 63 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
# This program is dual-licensed. If you wish to learn more about the
|
# This program is dual-licensed. If you wish to learn more about the
|
||||||
# RhodeCode Enterprise Edition, including its added features, Support services,
|
# RhodeCode Enterprise Edition, including its added features, Support services,
|
||||||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||||
|
from rhodecode.config import routing_links
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
|
|
@ -37,5 +38,8 @@ def includeme(config):
|
||||||
name='goto_switcher_data',
|
name='goto_switcher_data',
|
||||||
pattern='/_goto_data')
|
pattern='/_goto_data')
|
||||||
|
|
||||||
|
# register our static links via redirection mechanismy
|
||||||
|
routing_links.connect_redirection_links(config)
|
||||||
|
|
||||||
# Scan module for configuration decorators.
|
# Scan module for configuration decorators.
|
||||||
config.scan()
|
config.scan()
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ import os
|
||||||
import re
|
import re
|
||||||
from routes import Mapper
|
from routes import Mapper
|
||||||
|
|
||||||
from rhodecode.config import routing_links
|
|
||||||
|
|
||||||
# prefix for non repository related links needs to be prefixed with `/`
|
# prefix for non repository related links needs to be prefixed with `/`
|
||||||
ADMIN_PREFIX = '/_admin'
|
ADMIN_PREFIX = '/_admin'
|
||||||
STATIC_FILE_PREFIX = '/_static'
|
STATIC_FILE_PREFIX = '/_static'
|
||||||
|
|
@ -189,24 +187,7 @@ def make_map(config):
|
||||||
# MAIN PAGE
|
# MAIN PAGE
|
||||||
rmap.connect('home', '/', controller='home', action='index', jsroute=True)
|
rmap.connect('home', '/', controller='home', action='index', jsroute=True)
|
||||||
|
|
||||||
# TODO: johbo: Static links, to be replaced by our redirection mechanism
|
# ping and pylons error test
|
||||||
rmap.connect('rst_help',
|
|
||||||
'http://docutils.sourceforge.net/docs/user/rst/quickref.html',
|
|
||||||
_static=True)
|
|
||||||
rmap.connect('markdown_help',
|
|
||||||
'http://daringfireball.net/projects/markdown/syntax',
|
|
||||||
_static=True)
|
|
||||||
rmap.connect('rhodecode_official', 'https://rhodecode.com', _static=True)
|
|
||||||
rmap.connect('rhodecode_support', 'https://rhodecode.com/help/', _static=True)
|
|
||||||
rmap.connect('rhodecode_translations', 'https://rhodecode.com/translate/enterprise', _static=True)
|
|
||||||
# TODO: anderson - making this a static link since redirect won't play
|
|
||||||
# nice with POST requests
|
|
||||||
rmap.connect('enterprise_license_convert_from_old',
|
|
||||||
'https://rhodecode.com/u/license-upgrade',
|
|
||||||
_static=True)
|
|
||||||
|
|
||||||
routing_links.connect_redirection_links(rmap)
|
|
||||||
|
|
||||||
rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping')
|
rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping')
|
||||||
rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test')
|
rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,27 +46,56 @@ you can see it working.
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
link_config = [
|
link_config = [
|
||||||
{"name": "enterprise_docs",
|
{
|
||||||
"target": "https://rhodecode.com/r1/enterprise/docs/",
|
"name": "enterprise_docs",
|
||||||
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/",
|
"target": "https://rhodecode.com/r1/enterprise/docs/",
|
||||||
},
|
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/",
|
||||||
{"name": "enterprise_log_file_locations",
|
},
|
||||||
"target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/",
|
{
|
||||||
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files",
|
"name": "enterprise_log_file_locations",
|
||||||
},
|
"target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/",
|
||||||
{"name": "enterprise_issue_tracker_settings",
|
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files",
|
||||||
"target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/",
|
},
|
||||||
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html",
|
{
|
||||||
},
|
"name": "enterprise_issue_tracker_settings",
|
||||||
{"name": "enterprise_svn_setup",
|
"target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/",
|
||||||
"target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/",
|
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html",
|
||||||
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html",
|
},
|
||||||
},
|
{
|
||||||
|
"name": "enterprise_svn_setup",
|
||||||
|
"target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/",
|
||||||
|
"external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rst_help",
|
||||||
|
"target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
|
||||||
|
"external_target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markdown_help",
|
||||||
|
"target": "http://daringfireball.net/projects/markdown/syntax",
|
||||||
|
"external_target": "http://daringfireball.net/projects/markdown/syntax",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rhodecode_official",
|
||||||
|
"target": "https://rhodecode.com",
|
||||||
|
"external_target": "https://rhodecode.com/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rhodecode_support",
|
||||||
|
"target": "https://rhodecode.com/help/",
|
||||||
|
"external_target": "https://rhodecode.com/support",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rhodecode_translations",
|
||||||
|
"target": "https://rhodecode.com/translate/enterprise",
|
||||||
|
"external_target": "https://www.transifex.com/rhodecode/RhodeCode/",
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def connect_redirection_links(rmap):
|
def connect_redirection_links(config):
|
||||||
for link in link_config:
|
for link in link_config:
|
||||||
rmap.connect(link['name'], link['target'], _static=True)
|
config.add_route(link['name'], link['target'], static=True)
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ def attach_context_attributes(context, request):
|
||||||
'rhodecode_markup_renderer', 'rst')
|
'rhodecode_markup_renderer', 'rst')
|
||||||
context.visual.comment_types = ChangesetComment.COMMENT_TYPES
|
context.visual.comment_types = ChangesetComment.COMMENT_TYPES
|
||||||
context.visual.rhodecode_support_url = \
|
context.visual.rhodecode_support_url = \
|
||||||
rc_config.get('rhodecode_support_url') or url('rhodecode_support')
|
rc_config.get('rhodecode_support_url') or h.route_url('rhodecode_support')
|
||||||
|
|
||||||
context.pre_code = rc_config.get('rhodecode_pre_code')
|
context.pre_code = rc_config.get('rhodecode_pre_code')
|
||||||
context.post_code = rc_config.get('rhodecode_post_code')
|
context.post_code = rc_config.get('rhodecode_post_code')
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
## allowed_languages is defined in the users.py
|
## allowed_languages is defined in the users.py
|
||||||
## c.language comes from base.py as a default language
|
## c.language comes from base.py as a default language
|
||||||
${h.select('language', c.language, c.allowed_languages)}
|
${h.select('language', c.language, c.allowed_languages)}
|
||||||
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
% if c.visual.show_version:
|
% if c.visual.show_version:
|
||||||
RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
|
RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
|
||||||
% endif
|
% endif
|
||||||
© 2010-${h.datetime.today().year}, <a href="${h.url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
|
© 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
|
||||||
% if c.visual.rhodecode_support_url:
|
% if c.visual.rhodecode_support_url:
|
||||||
<a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
|
<a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
|
||||||
% endif
|
% endif
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td>
|
<td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td>
|
||||||
<td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td>
|
<td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td>
|
||||||
<td class="td-prefix issue-tracker-example">#</td>
|
<td class="td-prefix issue-tracker-example">#</td>
|
||||||
<td class="issue-tracker-example"><a href="https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html" target="_blank">${_('Read more')}</a></td>
|
<td class="issue-tracker-example"><a href="${h.route_url('enterprise_issue_tracker_settings')}" target="_blank">${_('Read more')}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
%for uid, entry in patterns:
|
%for uid, entry in patterns:
|
||||||
<tr id="entry_${uid}">
|
<tr id="entry_${uid}">
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="help-block">
|
<span class="help-block">
|
||||||
${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')}
|
${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')}
|
||||||
<a href="${h.url('enterprise_svn_setup')}" target="_blank">${_('SVN Protocol setup Documentation')}</a>.
|
<a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('SVN Protocol setup Documentation')}</a>.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-text">
|
<div class="toolbar-text">
|
||||||
${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
|
${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
|
||||||
('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
|
('<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
|
||||||
('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
|
('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
|
||||||
('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
|
('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,12 @@
|
||||||
<div class="inner-column">
|
<div class="inner-column">
|
||||||
<h4>Support</h4>
|
<h4>Support</h4>
|
||||||
<p>For support, go to <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>.
|
<p>For support, go to <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>.
|
||||||
It may be useful to include your log file; see the log file locations <a href="${h.url('enterprise_log_file_locations')}">here</a>.
|
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>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-column">
|
<div class="inner-column">
|
||||||
<h4>Documentation</h4>
|
<h4>Documentation</h4>
|
||||||
<p>For more information, see <a href="${h.url('enterprise_docs')}">docs.rhodecode.com</a>.</p>
|
<p>For more information, see <a href="${h.route_url('enterprise_docs')}">docs.rhodecode.com</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
<input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/>
|
<input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/>
|
||||||
<a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
|
<a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
|
||||||
<a id="clone_by_id" class="clone">${_('Show by ID')}</a>
|
<a id="clone_by_id" class="clone">${_('Show by ID')}</a>
|
||||||
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
%else:
|
%else:
|
||||||
<div class="left-label">
|
<div class="left-label">
|
||||||
|
|
|
||||||
|
|
@ -18,23 +18,28 @@
|
||||||
# RhodeCode Enterprise Edition, including its added features, Support services,
|
# RhodeCode Enterprise Edition, including its added features, Support services,
|
||||||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||||
|
|
||||||
import mock
|
import pytest
|
||||||
|
import requests
|
||||||
from rhodecode.config import routing_links
|
from rhodecode.config import routing_links
|
||||||
|
|
||||||
|
|
||||||
|
def check_connection():
|
||||||
|
try:
|
||||||
|
response = requests.get('https://rhodecode.com')
|
||||||
|
return response.status_code == 200
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
connection_available = pytest.mark.skipif(
|
||||||
|
not check_connection(), reason="No outside internet connection available")
|
||||||
|
|
||||||
|
|
||||||
|
@connection_available
|
||||||
def test_connect_redirection_links():
|
def test_connect_redirection_links():
|
||||||
link_config = [
|
|
||||||
{"name": "example_link",
|
|
||||||
"external_target": "http://example.com",
|
|
||||||
"target": "https://rhodecode.com/r/v1/enterprise/example",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
rmap = mock.Mock()
|
for link_data in routing_links.link_config:
|
||||||
with mock.patch.object(routing_links, 'link_config', link_config):
|
response = requests.get(link_data['target'])
|
||||||
routing_links.connect_redirection_links(rmap)
|
assert response.url == link_data['external_target']
|
||||||
|
|
||||||
rmap.connect.assert_called_with(
|
|
||||||
link_config[0]['name'], link_config[0]['target'],
|
|
||||||
_static=True)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue