##// 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 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
60 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
61
61
62 // Rhodecode components
62 // Rhodecode components
63 '<%= dirs.js.src %>/rhodecode/pyroutes.js',
63 '<%= dirs.js.src %>/rhodecode/init.js',
64 '<%= dirs.js.src %>/rhodecode/codemirror.js',
64 '<%= dirs.js.src %>/rhodecode/codemirror.js',
65 '<%= dirs.js.src %>/rhodecode/comments.js',
65 '<%= dirs.js.src %>/rhodecode/comments.js',
66 '<%= dirs.js.src %>/rhodecode/constants.js',
66 '<%= dirs.js.src %>/rhodecode/constants.js',
@@ -80,6 +80,35 b' def load_environment(global_conf, app_co'
80 config['app_conf'].get('celery.always.eager'))
80 config['app_conf'].get('celery.always.eager'))
81
81
82 config['routes.map'] = make_map(config)
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 config['pylons.app_globals'] = app_globals.Globals(config)
112 config['pylons.app_globals'] = app_globals.Globals(config)
84 config['pylons.h'] = helpers
113 config['pylons.h'] = helpers
85 rhodecode.CONFIG = config
114 rhodecode.CONFIG = config
@@ -29,6 +29,7 b' IMPORTANT: if you change any routing her'
29 and _route_name variable which uses some of stored naming here to do redirects.
29 and _route_name variable which uses some of stored naming here to do redirects.
30 """
30 """
31 import os
31 import os
32 import re
32 from routes import Mapper
33 from routes import Mapper
33
34
34 from rhodecode.config import routing_links
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 def make_map(config):
106 def make_map(config):
54 """Create, configure and return the routes Mapper"""
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 always_scan=config['debug'])
109 always_scan=config['debug'])
57 rmap.minimization = False
110 rmap.minimization = False
58 rmap.explicit = False
111 rmap.explicit = False
@@ -124,14 +177,14 b' def make_map(config):'
124 #==========================================================================
177 #==========================================================================
125
178
126 # MAIN PAGE
179 # MAIN PAGE
127 rmap.connect('home', '/', controller='home', action='index')
180 rmap.connect('home', '/', controller='home', action='index', jsroute=True)
128 rmap.connect('goto_switcher_data', '/_goto_data', controller='home',
181 rmap.connect('goto_switcher_data', '/_goto_data', controller='home',
129 action='goto_switcher_data')
182 action='goto_switcher_data')
130 rmap.connect('repo_list_data', '/_repos', controller='home',
183 rmap.connect('repo_list_data', '/_repos', controller='home',
131 action='repo_list_data')
184 action='repo_list_data')
132
185
133 rmap.connect('user_autocomplete_data', '/_users', controller='home',
186 rmap.connect('user_autocomplete_data', '/_users', controller='home',
134 action='user_autocomplete_data')
187 action='user_autocomplete_data', jsroute=True)
135 rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home',
188 rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home',
136 action='user_group_autocomplete_data')
189 action='user_group_autocomplete_data')
137
190
@@ -167,7 +220,7 b' def make_map(config):'
167 action='create', conditions={'method': ['POST']})
220 action='create', conditions={'method': ['POST']})
168 m.connect('repos', '/repos',
221 m.connect('repos', '/repos',
169 action='index', conditions={'method': ['GET']})
222 action='index', conditions={'method': ['GET']})
170 m.connect('new_repo', '/create_repository',
223 m.connect('new_repo', '/create_repository', jsroute=True,
171 action='create_repository', conditions={'method': ['GET']})
224 action='create_repository', conditions={'method': ['GET']})
172 m.connect('/repos/{repo_name}',
225 m.connect('/repos/{repo_name}',
173 action='update', conditions={'method': ['PUT'],
226 action='update', conditions={'method': ['PUT'],
@@ -303,22 +356,29 b' def make_map(config):'
303 function=check_user_group)
356 function=check_user_group)
304
357
305 # EXTRAS USER GROUP ROUTES
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 action='edit_global_perms', conditions={'method': ['GET']})
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 action='update_global_perms', conditions={'method': ['PUT']})
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 action='edit_perms_summary', conditions={'method': ['GET']})
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 action='edit_perms', conditions={'method': ['GET']})
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 action='update_perms', conditions={'method': ['PUT']})
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 action='edit_advanced', conditions={'method': ['GET']})
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 action='edit_members', conditions={'method': ['GET']})
382 action='edit_members', conditions={'method': ['GET']})
323
383
324 # ADMIN PERMISSIONS ROUTES
384 # ADMIN PERMISSIONS ROUTES
@@ -516,9 +576,9 b' def make_map(config):'
516 controller='admin/gists') as m:
576 controller='admin/gists') as m:
517 m.connect('gists', '/gists',
577 m.connect('gists', '/gists',
518 action='create', conditions={'method': ['POST']})
578 action='create', conditions={'method': ['POST']})
519 m.connect('gists', '/gists',
579 m.connect('gists', '/gists', jsroute=True,
520 action='index', conditions={'method': ['GET']})
580 action='index', conditions={'method': ['GET']})
521 m.connect('new_gist', '/gists/new',
581 m.connect('new_gist', '/gists/new', jsroute=True,
522 action='new', conditions={'method': ['GET']})
582 action='new', conditions={'method': ['GET']})
523
583
524 m.connect('/gists/{gist_id}',
584 m.connect('/gists/{gist_id}',
@@ -584,7 +644,7 b' def make_map(config):'
584 action='public_journal_atom')
644 action='public_journal_atom')
585
645
586 rmap.connect('toggle_following', '%s/toggle_following' % (ADMIN_PREFIX,),
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 conditions={'method': ['POST']})
648 conditions={'method': ['POST']})
589
649
590 # FULL TEXT SEARCH
650 # FULL TEXT SEARCH
@@ -621,17 +681,17 b' def make_map(config):'
621 rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}',
681 rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}',
622 controller='summary', action='repo_stats',
682 controller='summary', action='repo_stats',
623 conditions={'function': check_repo},
683 conditions={'function': check_repo},
624 requirements=URL_NAME_REQUIREMENTS)
684 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
625
685
626 rmap.connect('repo_refs_data', '/{repo_name}/refs-data',
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 requirements=URL_NAME_REQUIREMENTS)
688 requirements=URL_NAME_REQUIREMENTS)
629 rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog',
689 rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog',
630 controller='summary', action='repo_refs_changelog_data',
690 controller='summary', action='repo_refs_changelog_data',
631 requirements=URL_NAME_REQUIREMENTS)
691 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
632
692
633 rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}',
693 rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}',
634 controller='changeset', revision='tip',
694 controller='changeset', revision='tip', jsroute=True,
635 conditions={'function': check_repo},
695 conditions={'function': check_repo},
636 requirements=URL_NAME_REQUIREMENTS)
696 requirements=URL_NAME_REQUIREMENTS)
637 rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}',
697 rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}',
@@ -644,12 +704,13 b' def make_map(config):'
644 requirements=URL_NAME_REQUIREMENTS)
704 requirements=URL_NAME_REQUIREMENTS)
645
705
646 # repo edit options
706 # repo edit options
647 rmap.connect('edit_repo', '/{repo_name}/settings',
707 rmap.connect('edit_repo', '/{repo_name}/settings', jsroute=True,
648 controller='admin/repos', action='edit',
708 controller='admin/repos', action='edit',
649 conditions={'method': ['GET'], 'function': check_repo},
709 conditions={'method': ['GET'], 'function': check_repo},
650 requirements=URL_NAME_REQUIREMENTS)
710 requirements=URL_NAME_REQUIREMENTS)
651
711
652 rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions',
712 rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions',
713 jsroute=True,
653 controller='admin/repos', action='edit_permissions',
714 controller='admin/repos', action='edit_permissions',
654 conditions={'method': ['GET'], 'function': check_repo},
715 conditions={'method': ['GET'], 'function': check_repo},
655 requirements=URL_NAME_REQUIREMENTS)
716 requirements=URL_NAME_REQUIREMENTS)
@@ -781,13 +842,13 b' def make_map(config):'
781 requirements=URL_NAME_REQUIREMENTS)
842 requirements=URL_NAME_REQUIREMENTS)
782
843
783 rmap.connect('changeset_comment',
844 rmap.connect('changeset_comment',
784 '/{repo_name}/changeset/{revision}/comment',
845 '/{repo_name}/changeset/{revision}/comment', jsroute=True,
785 controller='changeset', revision='tip', action='comment',
846 controller='changeset', revision='tip', action='comment',
786 conditions={'function': check_repo},
847 conditions={'function': check_repo},
787 requirements=URL_NAME_REQUIREMENTS)
848 requirements=URL_NAME_REQUIREMENTS)
788
849
789 rmap.connect('changeset_comment_preview',
850 rmap.connect('changeset_comment_preview',
790 '/{repo_name}/changeset/comment/preview',
851 '/{repo_name}/changeset/comment/preview', jsroute=True,
791 controller='changeset', action='preview_comment',
852 controller='changeset', action='preview_comment',
792 conditions={'function': check_repo, 'method': ['POST']},
853 conditions={'function': check_repo, 'method': ['POST']},
793 requirements=URL_NAME_REQUIREMENTS)
854 requirements=URL_NAME_REQUIREMENTS)
@@ -796,11 +857,11 b' def make_map(config):'
796 '/{repo_name}/changeset/comment/{comment_id}/delete',
857 '/{repo_name}/changeset/comment/{comment_id}/delete',
797 controller='changeset', action='delete_comment',
858 controller='changeset', action='delete_comment',
798 conditions={'function': check_repo, 'method': ['DELETE']},
859 conditions={'function': check_repo, 'method': ['DELETE']},
799 requirements=URL_NAME_REQUIREMENTS)
860 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
800
861
801 rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}',
862 rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}',
802 controller='changeset', action='changeset_info',
863 controller='changeset', action='changeset_info',
803 requirements=URL_NAME_REQUIREMENTS)
864 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
804
865
805 rmap.connect('compare_home',
866 rmap.connect('compare_home',
806 '/{repo_name}/compare',
867 '/{repo_name}/compare',
@@ -812,33 +873,33 b' def make_map(config):'
812 '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}',
873 '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}',
813 controller='compare', action='compare',
874 controller='compare', action='compare',
814 conditions={'function': check_repo},
875 conditions={'function': check_repo},
815 requirements=URL_NAME_REQUIREMENTS)
876 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
816
877
817 rmap.connect('pullrequest_home',
878 rmap.connect('pullrequest_home',
818 '/{repo_name}/pull-request/new', controller='pullrequests',
879 '/{repo_name}/pull-request/new', controller='pullrequests',
819 action='index', conditions={'function': check_repo,
880 action='index', conditions={'function': check_repo,
820 'method': ['GET']},
881 'method': ['GET']},
821 requirements=URL_NAME_REQUIREMENTS)
882 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
822
883
823 rmap.connect('pullrequest',
884 rmap.connect('pullrequest',
824 '/{repo_name}/pull-request/new', controller='pullrequests',
885 '/{repo_name}/pull-request/new', controller='pullrequests',
825 action='create', conditions={'function': check_repo,
886 action='create', conditions={'function': check_repo,
826 'method': ['POST']},
887 'method': ['POST']},
827 requirements=URL_NAME_REQUIREMENTS)
888 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
828
889
829 rmap.connect('pullrequest_repo_refs',
890 rmap.connect('pullrequest_repo_refs',
830 '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}',
891 '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}',
831 controller='pullrequests',
892 controller='pullrequests',
832 action='get_repo_refs',
893 action='get_repo_refs',
833 conditions={'function': check_repo, 'method': ['GET']},
894 conditions={'function': check_repo, 'method': ['GET']},
834 requirements=URL_NAME_REQUIREMENTS)
895 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
835
896
836 rmap.connect('pullrequest_repo_destinations',
897 rmap.connect('pullrequest_repo_destinations',
837 '/{repo_name}/pull-request/repo-destinations',
898 '/{repo_name}/pull-request/repo-destinations',
838 controller='pullrequests',
899 controller='pullrequests',
839 action='get_repo_destinations',
900 action='get_repo_destinations',
840 conditions={'function': check_repo, 'method': ['GET']},
901 conditions={'function': check_repo, 'method': ['GET']},
841 requirements=URL_NAME_REQUIREMENTS)
902 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
842
903
843 rmap.connect('pullrequest_show',
904 rmap.connect('pullrequest_show',
844 '/{repo_name}/pull-request/{pull_request_id}',
905 '/{repo_name}/pull-request/{pull_request_id}',
@@ -852,7 +913,7 b' def make_map(config):'
852 controller='pullrequests',
913 controller='pullrequests',
853 action='update', conditions={'function': check_repo,
914 action='update', conditions={'function': check_repo,
854 'method': ['PUT']},
915 'method': ['PUT']},
855 requirements=URL_NAME_REQUIREMENTS)
916 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
856
917
857 rmap.connect('pullrequest_merge',
918 rmap.connect('pullrequest_merge',
858 '/{repo_name}/pull-request/{pull_request_id}',
919 '/{repo_name}/pull-request/{pull_request_id}',
@@ -873,20 +934,20 b' def make_map(config):'
873 controller='pullrequests',
934 controller='pullrequests',
874 action='show_all', conditions={'function': check_repo,
935 action='show_all', conditions={'function': check_repo,
875 'method': ['GET']},
936 'method': ['GET']},
876 requirements=URL_NAME_REQUIREMENTS)
937 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
877
938
878 rmap.connect('pullrequest_comment',
939 rmap.connect('pullrequest_comment',
879 '/{repo_name}/pull-request-comment/{pull_request_id}',
940 '/{repo_name}/pull-request-comment/{pull_request_id}',
880 controller='pullrequests',
941 controller='pullrequests',
881 action='comment', conditions={'function': check_repo,
942 action='comment', conditions={'function': check_repo,
882 'method': ['POST']},
943 'method': ['POST']},
883 requirements=URL_NAME_REQUIREMENTS)
944 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
884
945
885 rmap.connect('pullrequest_comment_delete',
946 rmap.connect('pullrequest_comment_delete',
886 '/{repo_name}/pull-request-comment/{comment_id}/delete',
947 '/{repo_name}/pull-request-comment/{comment_id}/delete',
887 controller='pullrequests', action='delete_comment',
948 controller='pullrequests', action='delete_comment',
888 conditions={'function': check_repo, 'method': ['DELETE']},
949 conditions={'function': check_repo, 'method': ['DELETE']},
889 requirements=URL_NAME_REQUIREMENTS)
950 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
890
951
891 rmap.connect('summary_home_explicit', '/{repo_name}/summary',
952 rmap.connect('summary_home_explicit', '/{repo_name}/summary',
892 controller='summary', conditions={'function': check_repo},
953 controller='summary', conditions={'function': check_repo},
@@ -904,7 +965,7 b' def make_map(config):'
904 controller='bookmarks', conditions={'function': check_repo},
965 controller='bookmarks', conditions={'function': check_repo},
905 requirements=URL_NAME_REQUIREMENTS)
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 controller='changelog', conditions={'function': check_repo},
969 controller='changelog', conditions={'function': check_repo},
909 requirements=URL_NAME_REQUIREMENTS)
970 requirements=URL_NAME_REQUIREMENTS)
910
971
@@ -913,21 +974,21 b' def make_map(config):'
913 conditions={'function': check_repo},
974 conditions={'function': check_repo},
914 requirements=URL_NAME_REQUIREMENTS)
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 controller='changelog', f_path=None,
979 controller='changelog', f_path=None,
918 conditions={'function': check_repo},
980 conditions={'function': check_repo},
919 requirements=URL_NAME_REQUIREMENTS)
981 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
920
982
921 rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}',
983 rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}',
922 controller='changelog', action='changelog_details',
984 controller='changelog', action='changelog_details',
923 conditions={'function': check_repo},
985 conditions={'function': check_repo},
924 requirements=URL_NAME_REQUIREMENTS)
986 requirements=URL_NAME_REQUIREMENTS)
925
987
926 rmap.connect('files_home',
988 rmap.connect('files_home', '/{repo_name}/files/{revision}/{f_path}',
927 '/{repo_name}/files/{revision}/{f_path}',
928 controller='files', revision='tip', f_path='',
989 controller='files', revision='tip', f_path='',
929 conditions={'function': check_repo},
990 conditions={'function': check_repo},
930 requirements=URL_NAME_REQUIREMENTS)
991 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
931
992
932 rmap.connect('files_home_simple_catchrev',
993 rmap.connect('files_home_simple_catchrev',
933 '/{repo_name}/files/{revision}',
994 '/{repo_name}/files/{revision}',
@@ -945,13 +1006,13 b' def make_map(config):'
945 '/{repo_name}/history/{revision}/{f_path}',
1006 '/{repo_name}/history/{revision}/{f_path}',
946 controller='files', action='history', revision='tip', f_path='',
1007 controller='files', action='history', revision='tip', f_path='',
947 conditions={'function': check_repo},
1008 conditions={'function': check_repo},
948 requirements=URL_NAME_REQUIREMENTS)
1009 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
949
1010
950 rmap.connect('files_authors_home',
1011 rmap.connect('files_authors_home',
951 '/{repo_name}/authors/{revision}/{f_path}',
1012 '/{repo_name}/authors/{revision}/{f_path}',
952 controller='files', action='authors', revision='tip', f_path='',
1013 controller='files', action='authors', revision='tip', f_path='',
953 conditions={'function': check_repo},
1014 conditions={'function': check_repo},
954 requirements=URL_NAME_REQUIREMENTS)
1015 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
955
1016
956 rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}',
1017 rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}',
957 controller='files', action='diff', f_path='',
1018 controller='files', action='diff', f_path='',
@@ -1030,19 +1091,19 b' def make_map(config):'
1030 rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}',
1091 rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}',
1031 controller='files', action='archivefile',
1092 controller='files', action='archivefile',
1032 conditions={'function': check_repo},
1093 conditions={'function': check_repo},
1033 requirements=URL_NAME_REQUIREMENTS)
1094 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1034
1095
1035 rmap.connect('files_nodelist_home',
1096 rmap.connect('files_nodelist_home',
1036 '/{repo_name}/nodelist/{revision}/{f_path}',
1097 '/{repo_name}/nodelist/{revision}/{f_path}',
1037 controller='files', action='nodelist',
1098 controller='files', action='nodelist',
1038 conditions={'function': check_repo},
1099 conditions={'function': check_repo},
1039 requirements=URL_NAME_REQUIREMENTS)
1100 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1040
1101
1041 rmap.connect('files_metadata_list_home',
1102 rmap.connect('files_metadata_list_home',
1042 '/{repo_name}/metadata_list/{revision}/{f_path}',
1103 '/{repo_name}/metadata_list/{revision}/{f_path}',
1043 controller='files', action='metadata_list',
1104 controller='files', action='metadata_list',
1044 conditions={'function': check_repo},
1105 conditions={'function': check_repo},
1045 requirements=URL_NAME_REQUIREMENTS)
1106 requirements=URL_NAME_REQUIREMENTS, jsroute=True)
1046
1107
1047 rmap.connect('repo_fork_create_home', '/{repo_name}/fork',
1108 rmap.connect('repo_fork_create_home', '/{repo_name}/fork',
1048 controller='forks', action='fork_create',
1109 controller='forks', action='fork_create',
@@ -1073,11 +1134,12 b' def make_map(config):'
1073
1134
1074 # catch all, at the end
1135 # catch all, at the end
1075 _connect_with_slash(
1136 _connect_with_slash(
1076 rmap, 'summary_home', '/{repo_name}',
1137 rmap, 'summary_home', '/{repo_name}', jsroute=True,
1077 controller='summary', action='index',
1138 controller='summary', action='index',
1078 conditions={'function': check_repo},
1139 conditions={'function': check_repo},
1079 requirements=URL_NAME_REQUIREMENTS)
1140 requirements=URL_NAME_REQUIREMENTS)
1080
1141
1142 rmap.jsroutes()
1081 return rmap
1143 return rmap
1082
1144
1083
1145
@@ -1,46 +1,49 b''
1 /* This file is automatically generated. DO NOT change it manually.
1 /******************************************************************************
2 * If this file needs to be modified, edit
2 * *
3 * rhodecode/utils/file_generation/js_routes_data.py
3 * DO NOT CHANGE THIS FILE MANUALLY *
4 * and run the script invoke -r scripts/ generate.js-routes .
4 * *
5 */
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 function registerRCRoutes() {
11 function registerRCRoutes() {
7 // routes registration
12 // routes registration
8 pyroutes.register('home', '/', []);
13 pyroutes.register('home', '/', []);
9 pyroutes.register('new_gist', '/_admin/gists/new', []);
14 pyroutes.register('user_autocomplete_data', '/_users', []);
10 pyroutes.register('gists', '/_admin/gists', []);
11 pyroutes.register('new_repo', '/_admin/create_repository', []);
15 pyroutes.register('new_repo', '/_admin/create_repository', []);
12 pyroutes.register('summary_home', '/%(repo_name)s', ['repo_name']);
16 pyroutes.register('edit_user_group_members', '/_admin/user_groups/%(user_group_id)s/edit/members', ['user_group_id']);
13 pyroutes.register('changelog_home', '/%(repo_name)s/changelog', ['repo_name']);
17 pyroutes.register('gists', '/_admin/gists', []);
14 pyroutes.register('files_home', '/%(repo_name)s/files/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
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 pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']);
24 pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']);
16 pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']);
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 pyroutes.register('changeset_comment', '/%(repo_name)s/changeset/%(revision)s/comment', ['repo_name', 'revision']);
26 pyroutes.register('changeset_comment', '/%(repo_name)s/changeset/%(revision)s/comment', ['repo_name', 'revision']);
25 pyroutes.register('changeset_comment_preview', '/%(repo_name)s/changeset/comment/preview', ['repo_name']);
27 pyroutes.register('changeset_comment_preview', '/%(repo_name)s/changeset/comment/preview', ['repo_name']);
26 pyroutes.register('changeset_comment_delete', '/%(repo_name)s/changeset/comment/%(comment_id)s/delete', ['repo_name', 'comment_id']);
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']);
29 pyroutes.register('changeset_info', '/changeset_info/%(repo_name)s/%(revision)s', ['repo_name', 'revision']);
28 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
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 pyroutes.register('files_archive_home', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']);
44 pyroutes.register('files_archive_home', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']);
30 pyroutes.register('files_nodelist_home', '/%(repo_name)s/nodelist/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
45 pyroutes.register('files_nodelist_home', '/%(repo_name)s/nodelist/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
31 pyroutes.register('files_metadata_list_home', '/%(repo_name)s/metadata_list/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
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']);
47 pyroutes.register('summary_home_slash', '/%(repo_name)s/', ['repo_name']);
33 pyroutes.register('files_authors_home', '/%(repo_name)s/authors/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
48 pyroutes.register('summary_home', '/%(repo_name)s', ['repo_name']);
34 pyroutes.register('changelog_file_home', '/%(repo_name)s/changelog/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']);
49 } No newline at end of file
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
@@ -115,6 +115,7 b''
115 <!--[if lt IE 9]>
115 <!--[if lt IE 9]>
116 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
116 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
117 <![endif]-->
117 <![endif]-->
118 <script language="javascript" type="text/javascript" src="${h.url('/js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
118 <script language="javascript" type="text/javascript" src="${h.url('/js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 <script language="javascript" type="text/javascript" src="${h.url('/js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 <script>CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";</script>
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