##// END OF EJS Templates
refactor: made javascript routes autogenerate based on python routes
dan -
r94:6379077c default
parent child Browse files
Show More
@@ -0,0 +1,26 b''
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
2 // #
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
6 // #
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
19
20 /*
21 * Deferred functions that must run before any rhodecode javascript go here
22 */
23
24 registerRCRoutes();
25
26 // TODO: move i18n here
@@ -60,7 +60,7 b' module.exports = function(grunt) {'
60 60 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
61 61
62 62 // Rhodecode components
63 '<%= dirs.js.src %>/rhodecode/pyroutes.js',
63 '<%= dirs.js.src %>/rhodecode/init.js',
64 64 '<%= dirs.js.src %>/rhodecode/codemirror.js',
65 65 '<%= dirs.js.src %>/rhodecode/comments.js',
66 66 '<%= dirs.js.src %>/rhodecode/constants.js',
@@ -80,6 +80,35 b' def load_environment(global_conf, app_co'
80 80 config['app_conf'].get('celery.always.eager'))
81 81
82 82 config['routes.map'] = make_map(config)
83 jsroutes = config['routes.map'].jsroutes()
84 statements = []
85 for url_name, url, fields in jsroutes:
86 statements.append(
87 "pyroutes.register('%s', '%s', %s);" % (url_name, url, fields))
88 import io
89 import textwrap
90 template = textwrap.dedent(u'''
91 /******************************************************************************
92 * *
93 * DO NOT CHANGE THIS FILE MANUALLY *
94 * *
95 * *
96 * This file is automatically generated when the app starts up. *
97 * *
98 * To add a route here pass jsroute=True to the route definition in the app *
99 * *
100 ******************************************************************************/
101 function registerRCRoutes() {
102 // routes registration
103 %s
104 }
105 ''').strip()
106 content = template % '\n '.join(statements)
107 js_routes_filepath = os.path.join(
108 paths['static_files'], 'js', 'rhodecode', 'routes.js')
109 with io.open(js_routes_filepath, 'w', encoding='utf-8') as f:
110 f.write(content)
111
83 112 config['pylons.app_globals'] = app_globals.Globals(config)
84 113 config['pylons.h'] = helpers
85 114 rhodecode.CONFIG = config
@@ -29,6 +29,7 b' IMPORTANT: if you change any routing her'
29 29 and _route_name variable which uses some of stored naming here to do redirects.
30 30 """
31 31 import os
32 import re
32 33 from routes import Mapper
33 34
34 35 from rhodecode.config import routing_links
@@ -50,9 +51,61 b' URL_NAME_REQUIREMENTS = {'
50 51 }
51 52
52 53
54 class JSRoutesAwareMapper(Mapper):
55 """
56 Wrapper for routes.Mapper to make pyroutes compatible url definitions
57 """
58 _named_route_regex = re.compile(r'^[a-z-_0-9A-Z]+$')
59 _argument_prog = re.compile('\{(.*?)\}|:\((.*)\)')
60 def __init__(self, *args, **kw):
61 super(JSRoutesAwareMapper, self).__init__(*args, **kw)
62 self._jsroutes = []
63
64 def connect(self, *args, **kw):
65 """
66 Wrapper for connect to take an extra argument jsroute=True
67
68 :param jsroute: boolean, if True will add the route to the pyroutes list
69 """
70 if kw.pop('jsroute', False):
71 if not self._named_route_regex.match(args[0]):
72 # import pdb;pdb.set_trace()
73 raise Exception('only named routes can be added to pyroutes')
74 self._jsroutes.append(args[0])
75
76 super(JSRoutesAwareMapper, self).connect(*args, **kw)
77
78 def _extract_route_information(self, route):
79 """
80 Convert a route into tuple(name, path, args), eg:
81 ('user_profile', '/profile/%(username)s', ['username'])
82 """
83 routepath = route.routepath
84 def replace(matchobj):
85 if matchobj.group(1):
86 return "%%(%s)s" % matchobj.group(1).split(':')[0]
87 else:
88 return "%%(%s)s" % matchobj.group(2)
89
90 routepath = self._argument_prog.sub(replace, routepath)
91 return (
92 route.name,
93 routepath,
94 [(arg[0].split(':')[0] if arg[0] != '' else arg[1])
95 for arg in self._argument_prog.findall(route.routepath)]
96 )
97
98 def jsroutes(self):
99 """
100 Return a list of pyroutes.js compatible routes
101 """
102 for route_name in self._jsroutes:
103 yield self._extract_route_information(self._routenames[route_name])
104
105
53 106 def make_map(config):
54 107 """Create, configure and return the routes Mapper"""
55 rmap = Mapper(directory=config['pylons.paths']['controllers'],
108 rmap = JSRoutesAwareMapper(directory=config['pylons.paths']['controllers'],
56 109 always_scan=config['debug'])
57 110 rmap.minimization = False
58 111 rmap.explicit = False
@@ -124,14 +177,14 b' def make_map(config):'
124 177 #==========================================================================
125 178
126 179 # MAIN PAGE
127 rmap.connect('home', '/', controller='home', action='index')
180 rmap.connect('home', '/', controller='home', action='index', jsroute=True)
128 181 rmap.connect('goto_switcher_data', '/_goto_data', controller='home',
129 182 action='goto_switcher_data')
130 183 rmap.connect('repo_list_data', '/_repos', controller='home',
131 184 action='repo_list_data')
132 185
133 186 rmap.connect('user_autocomplete_data', '/_users', controller='home',
134 action='user_autocomplete_data')
187 action='user_autocomplete_data', jsroute=True)
135 188 rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home',
136 189 action='user_group_autocomplete_data')
137 190
@@ -167,7 +220,7 b' def make_map(config):'
167 220 action='create', conditions={'method': ['POST']})
168 221 m.connect('repos', '/repos',
169 222 action='index', conditions={'method': ['GET']})
170 m.connect('new_repo', '/create_repository',
223 m.connect('new_repo', '/create_repository', jsroute=True,
171 224 action='create_repository', conditions={'method': ['GET']})
172 225 m.connect('/repos/{repo_name}',
173 226 action='update', conditions={'method': ['PUT'],
@@ -303,22 +356,29 b' def make_map(config):'
303 356 function=check_user_group)
304 357
305 358 # EXTRAS USER GROUP ROUTES
306 m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions',
359 m.connect('edit_user_group_global_perms',
360 '/user_groups/{user_group_id}/edit/global_permissions',
307 361 action='edit_global_perms', conditions={'method': ['GET']})
308 m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions',
362 m.connect('edit_user_group_global_perms',
363 '/user_groups/{user_group_id}/edit/global_permissions',
309 364 action='update_global_perms', conditions={'method': ['PUT']})
310 m.connect('edit_user_group_perms_summary', '/user_groups/{user_group_id}/edit/permissions_summary',
365 m.connect('edit_user_group_perms_summary',
366 '/user_groups/{user_group_id}/edit/permissions_summary',
311 367 action='edit_perms_summary', conditions={'method': ['GET']})
312 368
313 m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions',
369 m.connect('edit_user_group_perms',
370 '/user_groups/{user_group_id}/edit/permissions',
314 371 action='edit_perms', conditions={'method': ['GET']})
315 m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions',
372 m.connect('edit_user_group_perms',
373 '/user_groups/{user_group_id}/edit/permissions',
316 374 action='update_perms', conditions={'method': ['PUT']})
317 375
318 m.connect('edit_user_group_advanced', '/user_groups/{user_group_id}/edit/advanced',
376 m.connect('edit_user_group_advanced',
377 '/user_groups/{user_group_id}/edit/advanced',
319 378 action='edit_advanced', conditions={'method': ['GET']})
320 379
321 m.connect('edit_user_group_members', '/user_groups/{user_group_id}/edit/members',
380 m.connect('edit_user_group_members',
381 '/user_groups/{user_group_id}/edit/members', jsroute=True,
322 382 action='edit_members', conditions={'method': ['GET']})
323 383
324 384 # ADMIN PERMISSIONS ROUTES
@@ -516,9 +576,9 b' def make_map(config):'
516 576 controller='admin/gists') as m:
517 577 m.connect('gists', '/gists',
518 578 action='create', conditions={'method': ['POST']})
519 m.connect('gists', '/gists',
579 m.connect('gists', '/gists', jsroute=True,
520 580 action='index', conditions={'method': ['GET']})
521 m.connect('new_gist', '/gists/new',
581 m.connect('new_gist', '/gists/new', jsroute=True,
522 582 action='new', conditions={'method': ['GET']})
523 583
524 584 m.connect('/gists/{gist_id}',
@@ -584,7 +644,7 b' def make_map(config):'
584 644 action='public_journal_atom')
585 645
586 646 rmap.connect('toggle_following', '%s/toggle_following' % (ADMIN_PREFIX,),
587 controller='journal', action='toggle_following',
647 controller='journal', action='toggle_following', jsroute=True,
588 648 conditions={'method': ['POST']})
589 649
590 650 # FULL TEXT SEARCH
@@ -621,17 +681,17 b' def make_map(config):'
621 681 rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}',
622 682 controller='summary', action='repo_stats',
623 683 conditions={'function': check_repo},
624 requirements=URL_NAME_REQUIREMENTS)
684 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
625 685
626 686 rmap.connect('repo_refs_data', '/{repo_name}/refs-data',
627 controller='summary', action='repo_refs_data',
687 controller='summary', action='repo_refs_data', jsroute=True,
628 688 requirements=URL_NAME_REQUIREMENTS)
629 689 rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog',
630 690 controller='summary', action='repo_refs_changelog_data',
631 requirements=URL_NAME_REQUIREMENTS)
691 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
632 692
633 693 rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}',
634 controller='changeset', revision='tip',
694 controller='changeset', revision='tip', jsroute=True,
635 695 conditions={'function': check_repo},
636 696 requirements=URL_NAME_REQUIREMENTS)
637 697 rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}',
@@ -644,12 +704,13 b' def make_map(config):'
644 704 requirements=URL_NAME_REQUIREMENTS)
645 705
646 706 # repo edit options
647 rmap.connect('edit_repo', '/{repo_name}/settings',
707 rmap.connect('edit_repo', '/{repo_name}/settings', jsroute=True,
648 708 controller='admin/repos', action='edit',
649 709 conditions={'method': ['GET'], 'function': check_repo},
650 710 requirements=URL_NAME_REQUIREMENTS)
651 711
652 712 rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions',
713 jsroute=True,
653 714 controller='admin/repos', action='edit_permissions',
654 715 conditions={'method': ['GET'], 'function': check_repo},
655 716 requirements=URL_NAME_REQUIREMENTS)
@@ -781,13 +842,13 b' def make_map(config):'
781 842 requirements=URL_NAME_REQUIREMENTS)
782 843
783 844 rmap.connect('changeset_comment',
784 '/{repo_name}/changeset/{revision}/comment',
845 '/{repo_name}/changeset/{revision}/comment', jsroute=True,
785 846 controller='changeset', revision='tip', action='comment',
786 847 conditions={'function': check_repo},
787 848 requirements=URL_NAME_REQUIREMENTS)
788 849
789 850 rmap.connect('changeset_comment_preview',
790 '/{repo_name}/changeset/comment/preview',
851 '/{repo_name}/changeset/comment/preview', jsroute=True,
791 852 controller='changeset', action='preview_comment',
792 853 conditions={'function': check_repo, 'method': ['POST']},
793 854 requirements=URL_NAME_REQUIREMENTS)
@@ -796,11 +857,11 b' def make_map(config):'
796 857 '/{repo_name}/changeset/comment/{comment_id}/delete',
797 858 controller='changeset', action='delete_comment',
798 859 conditions={'function': check_repo, 'method': ['DELETE']},
799 requirements=URL_NAME_REQUIREMENTS)
860 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
800 861
801 862 rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}',
802 863 controller='changeset', action='changeset_info',
803 requirements=URL_NAME_REQUIREMENTS)
864 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
804 865
805 866 rmap.connect('compare_home',
806 867 '/{repo_name}/compare',
@@ -812,33 +873,33 b' def make_map(config):'
812 873 '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}',
813 874 controller='compare', action='compare',
814 875 conditions={'function': check_repo},
815 requirements=URL_NAME_REQUIREMENTS)
876 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
816 877
817 878 rmap.connect('pullrequest_home',
818 879 '/{repo_name}/pull-request/new', controller='pullrequests',
819 880 action='index', conditions={'function': check_repo,
820 881 'method': ['GET']},
821 requirements=URL_NAME_REQUIREMENTS)
882 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
822 883
823 884 rmap.connect('pullrequest',
824 885 '/{repo_name}/pull-request/new', controller='pullrequests',
825 886 action='create', conditions={'function': check_repo,
826 887 'method': ['POST']},
827 requirements=URL_NAME_REQUIREMENTS)
888 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
828 889
829 890 rmap.connect('pullrequest_repo_refs',
830 891 '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}',
831 892 controller='pullrequests',
832 893 action='get_repo_refs',
833 894 conditions={'function': check_repo, 'method': ['GET']},
834 requirements=URL_NAME_REQUIREMENTS)
895 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
835 896
836 897 rmap.connect('pullrequest_repo_destinations',
837 898 '/{repo_name}/pull-request/repo-destinations',
838 899 controller='pullrequests',
839 900 action='get_repo_destinations',
840 901 conditions={'function': check_repo, 'method': ['GET']},
841 requirements=URL_NAME_REQUIREMENTS)
902 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
842 903
843 904 rmap.connect('pullrequest_show',
844 905 '/{repo_name}/pull-request/{pull_request_id}',
@@ -852,7 +913,7 b' def make_map(config):'
852 913 controller='pullrequests',
853 914 action='update', conditions={'function': check_repo,
854 915 'method': ['PUT']},
855 requirements=URL_NAME_REQUIREMENTS)
916 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
856 917
857 918 rmap.connect('pullrequest_merge',
858 919 '/{repo_name}/pull-request/{pull_request_id}',
@@ -873,20 +934,20 b' def make_map(config):'
873 934 controller='pullrequests',
874 935 action='show_all', conditions={'function': check_repo,
875 936 'method': ['GET']},
876 requirements=URL_NAME_REQUIREMENTS)
937 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
877 938
878 939 rmap.connect('pullrequest_comment',
879 940 '/{repo_name}/pull-request-comment/{pull_request_id}',
880 941 controller='pullrequests',
881 942 action='comment', conditions={'function': check_repo,
882 943 'method': ['POST']},
883 requirements=URL_NAME_REQUIREMENTS)
944 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
884 945
885 946 rmap.connect('pullrequest_comment_delete',
886 947 '/{repo_name}/pull-request-comment/{comment_id}/delete',
887 948 controller='pullrequests', action='delete_comment',
888 949 conditions={'function': check_repo, 'method': ['DELETE']},
889 requirements=URL_NAME_REQUIREMENTS)
950 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
890 951
891 952 rmap.connect('summary_home_explicit', '/{repo_name}/summary',
892 953 controller='summary', conditions={'function': check_repo},
@@ -904,7 +965,7 b' def make_map(config):'
904 965 controller='bookmarks', conditions={'function': check_repo},
905 966 requirements=URL_NAME_REQUIREMENTS)
906 967
907 rmap.connect('changelog_home', '/{repo_name}/changelog',
968 rmap.connect('changelog_home', '/{repo_name}/changelog', jsroute=True,
908 969 controller='changelog', conditions={'function': check_repo},
909 970 requirements=URL_NAME_REQUIREMENTS)
910 971
@@ -913,21 +974,21 b' def make_map(config):'
913 974 conditions={'function': check_repo},
914 975 requirements=URL_NAME_REQUIREMENTS)
915 976
916 rmap.connect('changelog_file_home', '/{repo_name}/changelog/{revision}/{f_path}',
977 rmap.connect('changelog_file_home',
978 '/{repo_name}/changelog/{revision}/{f_path}',
917 979 controller='changelog', f_path=None,
918 980 conditions={'function': check_repo},
919 requirements=URL_NAME_REQUIREMENTS)
981 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
920 982
921 983 rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}',
922 984 controller='changelog', action='changelog_details',
923 985 conditions={'function': check_repo},
924 986 requirements=URL_NAME_REQUIREMENTS)
925 987
926 rmap.connect('files_home',
927 '/{repo_name}/files/{revision}/{f_path}',
988 rmap.connect('files_home', '/{repo_name}/files/{revision}/{f_path}',
928 989 controller='files', revision='tip', f_path='',
929 990 conditions={'function': check_repo},
930 requirements=URL_NAME_REQUIREMENTS)
991 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
931 992
932 993 rmap.connect('files_home_simple_catchrev',
933 994 '/{repo_name}/files/{revision}',
@@ -945,13 +1006,13 b' def make_map(config):'
945 1006 '/{repo_name}/history/{revision}/{f_path}',
946 1007 controller='files', action='history', revision='tip', f_path='',
947 1008 conditions={'function': check_repo},
948 requirements=URL_NAME_REQUIREMENTS)
1009 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
949 1010
950 1011 rmap.connect('files_authors_home',
951 1012 '/{repo_name}/authors/{revision}/{f_path}',
952 1013 controller='files', action='authors', revision='tip', f_path='',
953 1014 conditions={'function': check_repo},
954 requirements=URL_NAME_REQUIREMENTS)
1015 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
955 1016
956 1017 rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}',
957 1018 controller='files', action='diff', f_path='',
@@ -1030,19 +1091,19 b' def make_map(config):'
1030 1091 rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}',
1031 1092 controller='files', action='archivefile',
1032 1093 conditions={'function': check_repo},
1033 requirements=URL_NAME_REQUIREMENTS)
1094 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1034 1095
1035 1096 rmap.connect('files_nodelist_home',
1036 1097 '/{repo_name}/nodelist/{revision}/{f_path}',
1037 1098 controller='files', action='nodelist',
1038 1099 conditions={'function': check_repo},
1039 requirements=URL_NAME_REQUIREMENTS)
1100 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1040 1101
1041 1102 rmap.connect('files_metadata_list_home',
1042 1103 '/{repo_name}/metadata_list/{revision}/{f_path}',
1043 1104 controller='files', action='metadata_list',
1044 1105 conditions={'function': check_repo},
1045 requirements=URL_NAME_REQUIREMENTS)
1106 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1046 1107
1047 1108 rmap.connect('repo_fork_create_home', '/{repo_name}/fork',
1048 1109 controller='forks', action='fork_create',
@@ -1073,11 +1134,12 b' def make_map(config):'
1073 1134
1074 1135 # catch all, at the end
1075 1136 _connect_with_slash(
1076 rmap, 'summary_home', '/{repo_name}',
1137 rmap, 'summary_home', '/{repo_name}', jsroute=True,
1077 1138 controller='summary', action='index',
1078 1139 conditions={'function': check_repo},
1079 1140 requirements=URL_NAME_REQUIREMENTS)
1080 1141
1142 rmap.jsroutes()
1081 1143 return rmap
1082 1144
1083 1145
@@ -1,46 +1,49 b''
1 /* This file is automatically generated. DO NOT change it manually.
2 * If this file needs to be modified, edit
3 * rhodecode/utils/file_generation/js_routes_data.py
4 * and run the script invoke -r scripts/ generate.js-routes .
5 */
1 /******************************************************************************
2 * *
3 * DO NOT CHANGE THIS FILE MANUALLY *
4 * *
5 * *
6 * This file is automatically generated when the app starts up. *
7 * *
8 * To add a route here pass jsroute=True to the route definition in the app *
9 * *
10 ******************************************************************************/
6 11 function registerRCRoutes() {
7 12 // routes registration
8 13 pyroutes.register('home', '/', []);
9 pyroutes.register('new_gist', '/_admin/gists/new', []);
10 pyroutes.register('gists', '/_admin/gists', []);
14 pyroutes.register('user_autocomplete_data', '/_users', []);
11 15 pyroutes.register('new_repo', '/_admin/create_repository', []);
12 pyroutes.register('summary_home', '/%(repo_name)s', ['repo_name']);
13 pyroutes.register('changelog_home', '/%(repo_name)s/changelog', ['repo_name']);
14 pyroutes.register('files_home', '/%(repo_name)s/files/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
16 pyroutes.register('edit_user_group_members', '/_admin/user_groups/%(user_group_id)s/edit/members', ['user_group_id']);
17 pyroutes.register('gists', '/_admin/gists', []);
18 pyroutes.register('new_gist', '/_admin/gists/new', []);
19 pyroutes.register('toggle_following', '/_admin/toggle_following', []);
20 pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
21 pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
22 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
23 pyroutes.register('changeset_home', '/%(repo_name)s/changeset/%(revision)s', ['repo_name', 'revision']);
15 24 pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']);
16 25 pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']);
17 pyroutes.register('edit_user_group_members', '/_admin/user_groups/%(user_group_id)s/edit/members', ['user_group_id']);
18 pyroutes.register('pullrequest_home', '/%(repo_name)s/pull-request/new', ['repo_name']);
19 pyroutes.register('user_autocomplete_data', '/_users', []);
20 pyroutes.register('toggle_following', '/_admin/toggle_following', []);
21 pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
22 pyroutes.register('changeset_info', '/changeset_info/%(repo_name)s/%(revision)s', ['repo_name', 'revision']);
23 pyroutes.register('changeset_home', '/%(repo_name)s/changeset/%(revision)s', ['repo_name', 'revision']);
24 26 pyroutes.register('changeset_comment', '/%(repo_name)s/changeset/%(revision)s/comment', ['repo_name', 'revision']);
25 27 pyroutes.register('changeset_comment_preview', '/%(repo_name)s/changeset/comment/preview', ['repo_name']);
26 28 pyroutes.register('changeset_comment_delete', '/%(repo_name)s/changeset/comment/%(comment_id)s/delete', ['repo_name', 'comment_id']);
27 pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
28 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
29 pyroutes.register('changeset_info', '/changeset_info/%(repo_name)s/%(revision)s', ['repo_name', 'revision']);
30 pyroutes.register('compare_url', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']);
31 pyroutes.register('pullrequest_home', '/%(repo_name)s/pull-request/new', ['repo_name']);
32 pyroutes.register('pullrequest', '/%(repo_name)s/pull-request/new', ['repo_name']);
33 pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']);
34 pyroutes.register('pullrequest_repo_destinations', '/%(repo_name)s/pull-request/repo-destinations', ['repo_name']);
35 pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']);
36 pyroutes.register('pullrequest_show_all', '/%(repo_name)s/pull-request', ['repo_name']);
37 pyroutes.register('pullrequest_comment', '/%(repo_name)s/pull-request-comment/%(pull_request_id)s', ['repo_name', 'pull_request_id']);
38 pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request-comment/%(comment_id)s/delete', ['repo_name', 'comment_id']);
39 pyroutes.register('changelog_home', '/%(repo_name)s/changelog', ['repo_name']);
40 pyroutes.register('changelog_file_home', '/%(repo_name)s/changelog/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
41 pyroutes.register('files_home', '/%(repo_name)s/files/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
42 pyroutes.register('files_history_home', '/%(repo_name)s/history/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
43 pyroutes.register('files_authors_home', '/%(repo_name)s/authors/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
29 44 pyroutes.register('files_archive_home', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']);
30 45 pyroutes.register('files_nodelist_home', '/%(repo_name)s/nodelist/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
31 46 pyroutes.register('files_metadata_list_home', '/%(repo_name)s/metadata_list/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
32 pyroutes.register('files_history_home', '/%(repo_name)s/history/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
33 pyroutes.register('files_authors_home', '/%(repo_name)s/authors/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
34 pyroutes.register('changelog_file_home', '/%(repo_name)s/changelog/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
35 pyroutes.register('pullrequest', '/%(repo_name)s/pull-request/new', ['repo_name']);
36 pyroutes.register('pullrequest_home', '/%(repo_name)s/pull-request/new', ['repo_name']);
37 pyroutes.register('pullrequest_show_all', '/%(repo_name)s/pull-request', ['repo_name']);
38 pyroutes.register('pullrequest_comment', '/%(repo_name)s/pull-request-comment/%(pull_request_id)s', ['repo_name', 'pull_request_id']);
39 pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request-comment/%(comment_id)s/delete', ['repo_name', 'comment_id']);
40 pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']);
41 pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']);
42 pyroutes.register('pullrequest_repo_destinations', '/%(repo_name)s/pull-request/repo-destinations', ['repo_name']);
43 pyroutes.register('compare_url', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']);
44 }
45
46 registerRCRoutes(); No newline at end of file
47 pyroutes.register('summary_home_slash', '/%(repo_name)s/', ['repo_name']);
48 pyroutes.register('summary_home', '/%(repo_name)s', ['repo_name']);
49 } No newline at end of file
@@ -115,6 +115,7 b''
115 115 <!--[if lt IE 9]>
116 116 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
117 117 <![endif]-->
118 <script language="javascript" type="text/javascript" src="${h.url('/js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
118 119 <script language="javascript" type="text/javascript" src="${h.url('/js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 120 <script>CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";</script>
120 121
General Comments 0
You need to be logged in to leave comments. Login now