diff --git a/rhodecode/apps/home/__init__.py b/rhodecode/apps/home/__init__.py --- a/rhodecode/apps/home/__init__.py +++ b/rhodecode/apps/home/__init__.py @@ -17,6 +17,7 @@ # This program is dual-licensed. If you wish to learn more about the # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +from rhodecode.config import routing_links def includeme(config): @@ -37,5 +38,8 @@ def includeme(config): name='goto_switcher_data', pattern='/_goto_data') + # register our static links via redirection mechanismy + routing_links.connect_redirection_links(config) + # Scan module for configuration decorators. config.scan() diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -32,8 +32,6 @@ import os import re from routes import Mapper -from rhodecode.config import routing_links - # prefix for non repository related links needs to be prefixed with `/` ADMIN_PREFIX = '/_admin' STATIC_FILE_PREFIX = '/_static' @@ -189,24 +187,7 @@ def make_map(config): # MAIN PAGE rmap.connect('home', '/', controller='home', action='index', jsroute=True) - # TODO: johbo: Static links, to be replaced by our redirection mechanism - 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) - + # ping and pylons error test 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') diff --git a/rhodecode/config/routing_links.py b/rhodecode/config/routing_links.py --- a/rhodecode/config/routing_links.py +++ b/rhodecode/config/routing_links.py @@ -46,27 +46,56 @@ you can see it working. # flake8: noqa from __future__ import unicode_literals +link_config = [ + { + "name": "enterprise_docs", + "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_issue_tracker_settings", + "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_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/", + }, -link_config = [ - {"name": "enterprise_docs", - "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_issue_tracker_settings", - "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_svn_setup", - "target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/", - "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html", - }, ] -def connect_redirection_links(rmap): +def connect_redirection_links(config): for link in link_config: - rmap.connect(link['name'], link['target'], _static=True) + config.add_route(link['name'], link['target'], static=True) diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -302,7 +302,7 @@ def attach_context_attributes(context, r 'rhodecode_markup_renderer', 'rst') context.visual.comment_types = ChangesetComment.COMMENT_TYPES 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.post_code = rc_config.get('rhodecode_post_code') diff --git a/rhodecode/templates/admin/users/user_edit_profile.mako b/rhodecode/templates/admin/users/user_edit_profile.mako --- a/rhodecode/templates/admin/users/user_edit_profile.mako +++ b/rhodecode/templates/admin/users/user_edit_profile.mako @@ -127,7 +127,7 @@ ## allowed_languages is defined in the users.py ## c.language comes from base.py as a default language ${h.select('language', c.language, c.allowed_languages)} -
${h.literal(_('Help translate %(rc_link)s into your language.') % {'rc_link': h.link_to('RhodeCode Enterprise', h.url('rhodecode_translations'))})}
+${h.literal(_('Help translate %(rc_link)s into your language.') % {'rc_link': h.link_to('RhodeCode Enterprise', h.route_url('rhodecode_translations'))})}