Show More
@@ -0,0 +1,111 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | # Copyright (C) 2016-2017 RhodeCode GmbH | |
|
4 | # | |
|
5 | # This program is free software: you can redistribute it and/or modify | |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
|
7 | # (only), as published by the Free Software Foundation. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
|
16 | # | |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
|
20 | ||
|
21 | import logging | |
|
22 | ||
|
23 | import formencode | |
|
24 | import formencode.htmlfill | |
|
25 | ||
|
26 | from pyramid.view import view_config | |
|
27 | from pyramid.httpexceptions import HTTPFound | |
|
28 | from pyramid.renderers import render | |
|
29 | from pyramid.response import Response | |
|
30 | ||
|
31 | from rhodecode.apps._base import BaseAppView | |
|
32 | from rhodecode.lib.auth import ( | |
|
33 | LoginRequired, HasPermissionAllDecorator, CSRFRequired) | |
|
34 | from rhodecode.lib import helpers as h | |
|
35 | from rhodecode.model.forms import DefaultsForm | |
|
36 | from rhodecode.model.meta import Session | |
|
37 | from rhodecode import BACKENDS | |
|
38 | from rhodecode.model.settings import SettingsModel | |
|
39 | ||
|
40 | log = logging.getLogger(__name__) | |
|
41 | ||
|
42 | ||
|
43 | class AdminDefaultSettingsView(BaseAppView): | |
|
44 | def load_default_context(self): | |
|
45 | c = self._get_local_tmpl_context() | |
|
46 | ||
|
47 | self._register_global_c(c) | |
|
48 | return c | |
|
49 | ||
|
50 | @LoginRequired() | |
|
51 | @HasPermissionAllDecorator('hg.admin') | |
|
52 | @view_config( | |
|
53 | route_name='admin_defaults_repositories', request_method='GET', | |
|
54 | renderer='rhodecode:templates/admin/defaults/defaults.mako') | |
|
55 | def defaults_repository_show(self): | |
|
56 | c = self.load_default_context() | |
|
57 | c.backends = BACKENDS.keys() | |
|
58 | c.active = 'repositories' | |
|
59 | defaults = SettingsModel().get_default_repo_settings() | |
|
60 | ||
|
61 | data = render( | |
|
62 | 'rhodecode:templates/admin/defaults/defaults.mako', | |
|
63 | self._get_template_context(c), self.request) | |
|
64 | html = formencode.htmlfill.render( | |
|
65 | data, | |
|
66 | defaults=defaults, | |
|
67 | encoding="UTF-8", | |
|
68 | force_defaults=False | |
|
69 | ) | |
|
70 | return Response(html) | |
|
71 | ||
|
72 | @LoginRequired() | |
|
73 | @HasPermissionAllDecorator('hg.admin') | |
|
74 | @CSRFRequired() | |
|
75 | @view_config( | |
|
76 | route_name='admin_defaults_repositories_update', request_method='POST', | |
|
77 | renderer='rhodecode:templates/admin/defaults/defaults.mako') | |
|
78 | def defaults_repository_update(self): | |
|
79 | _ = self.request.translate | |
|
80 | c = self.load_default_context() | |
|
81 | c.active = 'repositories' | |
|
82 | form = DefaultsForm()() | |
|
83 | ||
|
84 | try: | |
|
85 | form_result = form.to_python(dict(self.request.POST)) | |
|
86 | for k, v in form_result.iteritems(): | |
|
87 | setting = SettingsModel().create_or_update_setting(k, v) | |
|
88 | Session().add(setting) | |
|
89 | Session().commit() | |
|
90 | h.flash(_('Default settings updated successfully'), | |
|
91 | category='success') | |
|
92 | ||
|
93 | except formencode.Invalid as errors: | |
|
94 | data = render( | |
|
95 | 'rhodecode:templates/admin/defaults/defaults.mako', | |
|
96 | self._get_template_context(c), self.request) | |
|
97 | html = formencode.htmlfill.render( | |
|
98 | data, | |
|
99 | defaults=errors.value, | |
|
100 | errors=errors.error_dict or {}, | |
|
101 | prefix_error=False, | |
|
102 | encoding="UTF-8", | |
|
103 | force_defaults=False | |
|
104 | ) | |
|
105 | return Response(html) | |
|
106 | except Exception: | |
|
107 | log.exception('Exception in update action') | |
|
108 | h.flash(_('Error occurred during update of default values'), | |
|
109 | category='error') | |
|
110 | ||
|
111 | raise HTTPFound(h.route_path('admin_defaults_repositories')) |
@@ -1,241 +1,249 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2016-2017 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | from rhodecode.apps.admin.navigation import NavigationRegistry |
|
23 | 23 | from rhodecode.config.routing import ADMIN_PREFIX |
|
24 | 24 | from rhodecode.lib.utils2 import str2bool |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | def admin_routes(config): |
|
28 | 28 | """ |
|
29 | 29 | Admin prefixed routes |
|
30 | 30 | """ |
|
31 | 31 | |
|
32 | 32 | config.add_route( |
|
33 | 33 | name='admin_audit_logs', |
|
34 | 34 | pattern='/audit_logs') |
|
35 | 35 | |
|
36 | 36 | config.add_route( |
|
37 | 37 | name='pull_requests_global_0', # backward compat |
|
38 | 38 | pattern='/pull_requests/{pull_request_id:\d+}') |
|
39 | 39 | config.add_route( |
|
40 | 40 | name='pull_requests_global_1', # backward compat |
|
41 | 41 | pattern='/pull-requests/{pull_request_id:\d+}') |
|
42 | 42 | config.add_route( |
|
43 | 43 | name='pull_requests_global', |
|
44 | 44 | pattern='/pull-request/{pull_request_id:\d+}') |
|
45 | 45 | |
|
46 | 46 | config.add_route( |
|
47 | 47 | name='admin_settings_open_source', |
|
48 | 48 | pattern='/settings/open_source') |
|
49 | 49 | config.add_route( |
|
50 | 50 | name='admin_settings_vcs_svn_generate_cfg', |
|
51 | 51 | pattern='/settings/vcs/svn_generate_cfg') |
|
52 | 52 | |
|
53 | 53 | config.add_route( |
|
54 | 54 | name='admin_settings_system', |
|
55 | 55 | pattern='/settings/system') |
|
56 | 56 | config.add_route( |
|
57 | 57 | name='admin_settings_system_update', |
|
58 | 58 | pattern='/settings/system/updates') |
|
59 | 59 | |
|
60 | 60 | config.add_route( |
|
61 | 61 | name='admin_settings_sessions', |
|
62 | 62 | pattern='/settings/sessions') |
|
63 | 63 | config.add_route( |
|
64 | 64 | name='admin_settings_sessions_cleanup', |
|
65 | 65 | pattern='/settings/sessions/cleanup') |
|
66 | 66 | |
|
67 | 67 | config.add_route( |
|
68 | 68 | name='admin_settings_process_management', |
|
69 | 69 | pattern='/settings/process_management') |
|
70 | 70 | config.add_route( |
|
71 | 71 | name='admin_settings_process_management_signal', |
|
72 | 72 | pattern='/settings/process_management/signal') |
|
73 | 73 | |
|
74 | # default settings | |
|
75 | config.add_route( | |
|
76 | name='admin_defaults_repositories', | |
|
77 | pattern='/defaults/repositories') | |
|
78 | config.add_route( | |
|
79 | name='admin_defaults_repositories_update', | |
|
80 | pattern='/defaults/repositories/update') | |
|
81 | ||
|
74 | 82 | # global permissions |
|
75 | 83 | |
|
76 | 84 | config.add_route( |
|
77 | 85 | name='admin_permissions_application', |
|
78 | 86 | pattern='/permissions/application') |
|
79 | 87 | config.add_route( |
|
80 | 88 | name='admin_permissions_application_update', |
|
81 | 89 | pattern='/permissions/application/update') |
|
82 | 90 | |
|
83 | 91 | config.add_route( |
|
84 | 92 | name='admin_permissions_global', |
|
85 | 93 | pattern='/permissions/global') |
|
86 | 94 | config.add_route( |
|
87 | 95 | name='admin_permissions_global_update', |
|
88 | 96 | pattern='/permissions/global/update') |
|
89 | 97 | |
|
90 | 98 | config.add_route( |
|
91 | 99 | name='admin_permissions_object', |
|
92 | 100 | pattern='/permissions/object') |
|
93 | 101 | config.add_route( |
|
94 | 102 | name='admin_permissions_object_update', |
|
95 | 103 | pattern='/permissions/object/update') |
|
96 | 104 | |
|
97 | 105 | config.add_route( |
|
98 | 106 | name='admin_permissions_ips', |
|
99 | 107 | pattern='/permissions/ips') |
|
100 | 108 | |
|
101 | 109 | config.add_route( |
|
102 | 110 | name='admin_permissions_overview', |
|
103 | 111 | pattern='/permissions/overview') |
|
104 | 112 | |
|
105 | 113 | config.add_route( |
|
106 | 114 | name='admin_permissions_auth_token_access', |
|
107 | 115 | pattern='/permissions/auth_token_access') |
|
108 | 116 | |
|
109 | 117 | config.add_route( |
|
110 | 118 | name='admin_permissions_ssh_keys', |
|
111 | 119 | pattern='/permissions/ssh_keys') |
|
112 | 120 | config.add_route( |
|
113 | 121 | name='admin_permissions_ssh_keys_data', |
|
114 | 122 | pattern='/permissions/ssh_keys/data') |
|
115 | 123 | config.add_route( |
|
116 | 124 | name='admin_permissions_ssh_keys_update', |
|
117 | 125 | pattern='/permissions/ssh_keys/update') |
|
118 | 126 | |
|
119 | 127 | # users admin |
|
120 | 128 | config.add_route( |
|
121 | 129 | name='users', |
|
122 | 130 | pattern='/users') |
|
123 | 131 | |
|
124 | 132 | config.add_route( |
|
125 | 133 | name='users_data', |
|
126 | 134 | pattern='/users_data') |
|
127 | 135 | |
|
128 | 136 | # user auth tokens |
|
129 | 137 | config.add_route( |
|
130 | 138 | name='edit_user_auth_tokens', |
|
131 | 139 | pattern='/users/{user_id:\d+}/edit/auth_tokens') |
|
132 | 140 | config.add_route( |
|
133 | 141 | name='edit_user_auth_tokens_add', |
|
134 | 142 | pattern='/users/{user_id:\d+}/edit/auth_tokens/new') |
|
135 | 143 | config.add_route( |
|
136 | 144 | name='edit_user_auth_tokens_delete', |
|
137 | 145 | pattern='/users/{user_id:\d+}/edit/auth_tokens/delete') |
|
138 | 146 | |
|
139 | 147 | # user ssh keys |
|
140 | 148 | config.add_route( |
|
141 | 149 | name='edit_user_ssh_keys', |
|
142 | 150 | pattern='/users/{user_id:\d+}/edit/ssh_keys') |
|
143 | 151 | config.add_route( |
|
144 | 152 | name='edit_user_ssh_keys_generate_keypair', |
|
145 | 153 | pattern='/users/{user_id:\d+}/edit/ssh_keys/generate') |
|
146 | 154 | config.add_route( |
|
147 | 155 | name='edit_user_ssh_keys_add', |
|
148 | 156 | pattern='/users/{user_id:\d+}/edit/ssh_keys/new') |
|
149 | 157 | config.add_route( |
|
150 | 158 | name='edit_user_ssh_keys_delete', |
|
151 | 159 | pattern='/users/{user_id:\d+}/edit/ssh_keys/delete') |
|
152 | 160 | |
|
153 | 161 | # user emails |
|
154 | 162 | config.add_route( |
|
155 | 163 | name='edit_user_emails', |
|
156 | 164 | pattern='/users/{user_id:\d+}/edit/emails') |
|
157 | 165 | config.add_route( |
|
158 | 166 | name='edit_user_emails_add', |
|
159 | 167 | pattern='/users/{user_id:\d+}/edit/emails/new') |
|
160 | 168 | config.add_route( |
|
161 | 169 | name='edit_user_emails_delete', |
|
162 | 170 | pattern='/users/{user_id:\d+}/edit/emails/delete') |
|
163 | 171 | |
|
164 | 172 | # user IPs |
|
165 | 173 | config.add_route( |
|
166 | 174 | name='edit_user_ips', |
|
167 | 175 | pattern='/users/{user_id:\d+}/edit/ips') |
|
168 | 176 | config.add_route( |
|
169 | 177 | name='edit_user_ips_add', |
|
170 | 178 | pattern='/users/{user_id:\d+}/edit/ips/new') |
|
171 | 179 | config.add_route( |
|
172 | 180 | name='edit_user_ips_delete', |
|
173 | 181 | pattern='/users/{user_id:\d+}/edit/ips/delete') |
|
174 | 182 | |
|
175 | 183 | # user perms |
|
176 | 184 | config.add_route( |
|
177 | 185 | name='edit_user_perms_summary', |
|
178 | 186 | pattern='/users/{user_id:\d+}/edit/permissions_summary') |
|
179 | 187 | config.add_route( |
|
180 | 188 | name='edit_user_perms_summary_json', |
|
181 | 189 | pattern='/users/{user_id:\d+}/edit/permissions_summary/json') |
|
182 | 190 | |
|
183 | 191 | # user user groups management |
|
184 | 192 | config.add_route( |
|
185 | 193 | name='edit_user_groups_management', |
|
186 | 194 | pattern='/users/{user_id:\d+}/edit/groups_management') |
|
187 | 195 | |
|
188 | 196 | config.add_route( |
|
189 | 197 | name='edit_user_groups_management_updates', |
|
190 | 198 | pattern='/users/{user_id:\d+}/edit/edit_user_groups_management/updates') |
|
191 | 199 | |
|
192 | 200 | # user audit logs |
|
193 | 201 | config.add_route( |
|
194 | 202 | name='edit_user_audit_logs', |
|
195 | 203 | pattern='/users/{user_id:\d+}/edit/audit') |
|
196 | 204 | |
|
197 | 205 | # user-groups admin |
|
198 | 206 | config.add_route( |
|
199 | 207 | name='user_groups', |
|
200 | 208 | pattern='/user_groups') |
|
201 | 209 | |
|
202 | 210 | config.add_route( |
|
203 | 211 | name='user_groups_data', |
|
204 | 212 | pattern='/user_groups_data') |
|
205 | 213 | |
|
206 | 214 | config.add_route( |
|
207 | 215 | name='user_groups_new', |
|
208 | 216 | pattern='/user_groups/new') |
|
209 | 217 | |
|
210 | 218 | config.add_route( |
|
211 | 219 | name='user_groups_create', |
|
212 | 220 | pattern='/user_groups/create') |
|
213 | 221 | |
|
214 | 222 | # repos admin |
|
215 | 223 | config.add_route( |
|
216 | 224 | name='repos', |
|
217 | 225 | pattern='/repos') |
|
218 | 226 | |
|
219 | 227 | config.add_route( |
|
220 | 228 | name='repo_new', |
|
221 | 229 | pattern='/repos/new') |
|
222 | 230 | |
|
223 | 231 | config.add_route( |
|
224 | 232 | name='repo_create', |
|
225 | 233 | pattern='/repos/create') |
|
226 | 234 | |
|
227 | 235 | |
|
228 | 236 | def includeme(config): |
|
229 | 237 | settings = config.get_settings() |
|
230 | 238 | |
|
231 | 239 | # Create admin navigation registry and add it to the pyramid registry. |
|
232 | 240 | labs_active = str2bool(settings.get('labs_settings_active', False)) |
|
233 | 241 | navigation_registry = NavigationRegistry(labs_active=labs_active) |
|
234 | 242 | config.registry.registerUtility(navigation_registry) |
|
235 | 243 | |
|
236 | 244 | # main admin routes |
|
237 | 245 | config.add_route(name='admin_home', pattern=ADMIN_PREFIX) |
|
238 | 246 | config.include(admin_routes, route_prefix=ADMIN_PREFIX) |
|
239 | 247 | |
|
240 | 248 | # Scan module for configuration decorators. |
|
241 | 249 | config.scan('.views', ignore='.tests') |
@@ -1,68 +1,85 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2017 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | import pytest |
|
22 | 22 | |
|
23 |
from rhodecode.tests import assert_session_flash |
|
|
23 | from rhodecode.tests import assert_session_flash | |
|
24 | 24 | from rhodecode.model.settings import SettingsModel |
|
25 | 25 | |
|
26 | 26 | |
|
27 | def route_path(name, params=None, **kwargs): | |
|
28 | import urllib | |
|
29 | from rhodecode.apps._base import ADMIN_PREFIX | |
|
30 | ||
|
31 | base_url = { | |
|
32 | 'admin_defaults_repositories': | |
|
33 | ADMIN_PREFIX + '/defaults/repositories', | |
|
34 | 'admin_defaults_repositories_update': | |
|
35 | ADMIN_PREFIX + '/defaults/repositories/update', | |
|
36 | }[name].format(**kwargs) | |
|
37 | ||
|
38 | if params: | |
|
39 | base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) | |
|
40 | return base_url | |
|
41 | ||
|
42 | ||
|
27 | 43 | @pytest.mark.usefixtures("app") |
|
28 | class TestDefaultsController: | |
|
44 | class TestDefaultsController(object): | |
|
29 | 45 | |
|
30 | 46 | def test_index(self, autologin_user): |
|
31 |
response = self.app.get( |
|
|
47 | response = self.app.get(route_path('admin_defaults_repositories')) | |
|
32 | 48 | response.mustcontain('default_repo_private') |
|
33 | 49 | response.mustcontain('default_repo_enable_statistics') |
|
34 | 50 | response.mustcontain('default_repo_enable_downloads') |
|
35 | 51 | response.mustcontain('default_repo_enable_locking') |
|
36 | 52 | |
|
37 | 53 | def test_update_params_true_hg(self, autologin_user, csrf_token): |
|
38 | 54 | params = { |
|
39 | 55 | 'default_repo_enable_locking': True, |
|
40 | 56 | 'default_repo_enable_downloads': True, |
|
41 | 57 | 'default_repo_enable_statistics': True, |
|
42 | 58 | 'default_repo_private': True, |
|
43 | 59 | 'default_repo_type': 'hg', |
|
44 | 60 | 'csrf_token': csrf_token, |
|
45 | 61 | } |
|
46 | 62 | response = self.app.post( |
|
47 |
|
|
|
63 | route_path('admin_defaults_repositories_update'), params=params) | |
|
48 | 64 | assert_session_flash(response, 'Default settings updated successfully') |
|
49 | 65 | |
|
50 | 66 | defs = SettingsModel().get_default_repo_settings() |
|
51 | 67 | del params['csrf_token'] |
|
52 | 68 | assert params == defs |
|
53 | 69 | |
|
54 | 70 | def test_update_params_false_git(self, autologin_user, csrf_token): |
|
55 | 71 | params = { |
|
56 | 72 | 'default_repo_enable_locking': False, |
|
57 | 73 | 'default_repo_enable_downloads': False, |
|
58 | 74 | 'default_repo_enable_statistics': False, |
|
59 | 75 | 'default_repo_private': False, |
|
60 | 76 | 'default_repo_type': 'git', |
|
61 | 77 | 'csrf_token': csrf_token, |
|
62 | 78 | } |
|
63 | 79 | response = self.app.post( |
|
64 |
|
|
|
80 | route_path('admin_defaults_repositories_update'), params=params) | |
|
65 | 81 | assert_session_flash(response, 'Default settings updated successfully') |
|
82 | ||
|
66 | 83 | defs = SettingsModel().get_default_repo_settings() |
|
67 | 84 | del params['csrf_token'] |
|
68 | 85 | assert params == defs |
@@ -1,355 +1,347 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2017 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 | 22 | Routes configuration |
|
23 | 23 | |
|
24 | 24 | The more specific and detailed routes should be defined first so they |
|
25 | 25 | may take precedent over the more generic routes. For more information |
|
26 | 26 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
27 | 27 | |
|
28 | 28 | IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py |
|
29 | 29 | and _route_name variable which uses some of stored naming here to do redirects. |
|
30 | 30 | """ |
|
31 | 31 | import os |
|
32 | 32 | import re |
|
33 | 33 | from routes import Mapper |
|
34 | 34 | |
|
35 | 35 | # prefix for non repository related links needs to be prefixed with `/` |
|
36 | 36 | ADMIN_PREFIX = '/_admin' |
|
37 | 37 | STATIC_FILE_PREFIX = '/_static' |
|
38 | 38 | |
|
39 | 39 | # Default requirements for URL parts |
|
40 | 40 | URL_NAME_REQUIREMENTS = { |
|
41 | 41 | # group name can have a slash in them, but they must not end with a slash |
|
42 | 42 | 'group_name': r'.*?[^/]', |
|
43 | 43 | 'repo_group_name': r'.*?[^/]', |
|
44 | 44 | # repo names can have a slash in them, but they must not end with a slash |
|
45 | 45 | 'repo_name': r'.*?[^/]', |
|
46 | 46 | # file path eats up everything at the end |
|
47 | 47 | 'f_path': r'.*', |
|
48 | 48 | # reference types |
|
49 | 49 | 'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)', |
|
50 | 50 | 'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)', |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | class JSRoutesMapper(Mapper): |
|
55 | 55 | """ |
|
56 | 56 | Wrapper for routes.Mapper to make pyroutes compatible url definitions |
|
57 | 57 | """ |
|
58 | 58 | _named_route_regex = re.compile(r'^[a-z-_0-9A-Z]+$') |
|
59 | 59 | _argument_prog = re.compile('\{(.*?)\}|:\((.*)\)') |
|
60 | 60 | def __init__(self, *args, **kw): |
|
61 | 61 | super(JSRoutesMapper, self).__init__(*args, **kw) |
|
62 | 62 | self._jsroutes = [] |
|
63 | 63 | |
|
64 | 64 | def connect(self, *args, **kw): |
|
65 | 65 | """ |
|
66 | 66 | Wrapper for connect to take an extra argument jsroute=True |
|
67 | 67 | |
|
68 | 68 | :param jsroute: boolean, if True will add the route to the pyroutes list |
|
69 | 69 | """ |
|
70 | 70 | if kw.pop('jsroute', False): |
|
71 | 71 | if not self._named_route_regex.match(args[0]): |
|
72 | 72 | raise Exception('only named routes can be added to pyroutes') |
|
73 | 73 | self._jsroutes.append(args[0]) |
|
74 | 74 | |
|
75 | 75 | super(JSRoutesMapper, self).connect(*args, **kw) |
|
76 | 76 | |
|
77 | 77 | def _extract_route_information(self, route): |
|
78 | 78 | """ |
|
79 | 79 | Convert a route into tuple(name, path, args), eg: |
|
80 | 80 | ('show_user', '/profile/%(username)s', ['username']) |
|
81 | 81 | """ |
|
82 | 82 | routepath = route.routepath |
|
83 | 83 | def replace(matchobj): |
|
84 | 84 | if matchobj.group(1): |
|
85 | 85 | return "%%(%s)s" % matchobj.group(1).split(':')[0] |
|
86 | 86 | else: |
|
87 | 87 | return "%%(%s)s" % matchobj.group(2) |
|
88 | 88 | |
|
89 | 89 | routepath = self._argument_prog.sub(replace, routepath) |
|
90 | 90 | return ( |
|
91 | 91 | route.name, |
|
92 | 92 | routepath, |
|
93 | 93 | [(arg[0].split(':')[0] if arg[0] != '' else arg[1]) |
|
94 | 94 | for arg in self._argument_prog.findall(route.routepath)] |
|
95 | 95 | ) |
|
96 | 96 | |
|
97 | 97 | def jsroutes(self): |
|
98 | 98 | """ |
|
99 | 99 | Return a list of pyroutes.js compatible routes |
|
100 | 100 | """ |
|
101 | 101 | for route_name in self._jsroutes: |
|
102 | 102 | yield self._extract_route_information(self._routenames[route_name]) |
|
103 | 103 | |
|
104 | 104 | |
|
105 | 105 | def make_map(config): |
|
106 | 106 | """Create, configure and return the routes Mapper""" |
|
107 | 107 | rmap = JSRoutesMapper( |
|
108 | 108 | directory=config['pylons.paths']['controllers'], |
|
109 | 109 | always_scan=config['debug']) |
|
110 | 110 | rmap.minimization = False |
|
111 | 111 | rmap.explicit = False |
|
112 | 112 | |
|
113 | 113 | from rhodecode.lib.utils2 import str2bool |
|
114 | 114 | from rhodecode.model import repo, repo_group |
|
115 | 115 | |
|
116 | 116 | def check_repo(environ, match_dict): |
|
117 | 117 | """ |
|
118 | 118 | check for valid repository for proper 404 handling |
|
119 | 119 | |
|
120 | 120 | :param environ: |
|
121 | 121 | :param match_dict: |
|
122 | 122 | """ |
|
123 | 123 | repo_name = match_dict.get('repo_name') |
|
124 | 124 | |
|
125 | 125 | if match_dict.get('f_path'): |
|
126 | 126 | # fix for multiple initial slashes that causes errors |
|
127 | 127 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') |
|
128 | 128 | repo_model = repo.RepoModel() |
|
129 | 129 | by_name_match = repo_model.get_by_repo_name(repo_name) |
|
130 | 130 | # if we match quickly from database, short circuit the operation, |
|
131 | 131 | # and validate repo based on the type. |
|
132 | 132 | if by_name_match: |
|
133 | 133 | return True |
|
134 | 134 | |
|
135 | 135 | by_id_match = repo_model.get_repo_by_id(repo_name) |
|
136 | 136 | if by_id_match: |
|
137 | 137 | repo_name = by_id_match.repo_name |
|
138 | 138 | match_dict['repo_name'] = repo_name |
|
139 | 139 | return True |
|
140 | 140 | |
|
141 | 141 | return False |
|
142 | 142 | |
|
143 | 143 | def check_group(environ, match_dict): |
|
144 | 144 | """ |
|
145 | 145 | check for valid repository group path for proper 404 handling |
|
146 | 146 | |
|
147 | 147 | :param environ: |
|
148 | 148 | :param match_dict: |
|
149 | 149 | """ |
|
150 | 150 | repo_group_name = match_dict.get('group_name') |
|
151 | 151 | repo_group_model = repo_group.RepoGroupModel() |
|
152 | 152 | by_name_match = repo_group_model.get_by_group_name(repo_group_name) |
|
153 | 153 | if by_name_match: |
|
154 | 154 | return True |
|
155 | 155 | |
|
156 | 156 | return False |
|
157 | 157 | |
|
158 | 158 | def check_user_group(environ, match_dict): |
|
159 | 159 | """ |
|
160 | 160 | check for valid user group for proper 404 handling |
|
161 | 161 | |
|
162 | 162 | :param environ: |
|
163 | 163 | :param match_dict: |
|
164 | 164 | """ |
|
165 | 165 | return True |
|
166 | 166 | |
|
167 | 167 | def check_int(environ, match_dict): |
|
168 | 168 | return match_dict.get('id').isdigit() |
|
169 | 169 | |
|
170 | 170 | |
|
171 | 171 | #========================================================================== |
|
172 | 172 | # CUSTOM ROUTES HERE |
|
173 | 173 | #========================================================================== |
|
174 | 174 | |
|
175 | 175 | # ping and pylons error test |
|
176 | 176 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') |
|
177 | 177 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') |
|
178 | 178 | |
|
179 | 179 | # ADMIN REPOSITORY GROUPS ROUTES |
|
180 | 180 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
181 | 181 | controller='admin/repo_groups') as m: |
|
182 | 182 | m.connect('repo_groups', '/repo_groups', |
|
183 | 183 | action='create', conditions={'method': ['POST']}) |
|
184 | 184 | m.connect('repo_groups', '/repo_groups', |
|
185 | 185 | action='index', conditions={'method': ['GET']}) |
|
186 | 186 | m.connect('new_repo_group', '/repo_groups/new', |
|
187 | 187 | action='new', conditions={'method': ['GET']}) |
|
188 | 188 | m.connect('update_repo_group', '/repo_groups/{group_name}', |
|
189 | 189 | action='update', conditions={'method': ['PUT'], |
|
190 | 190 | 'function': check_group}, |
|
191 | 191 | requirements=URL_NAME_REQUIREMENTS) |
|
192 | 192 | |
|
193 | 193 | # EXTRAS REPO GROUP ROUTES |
|
194 | 194 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
195 | 195 | action='edit', |
|
196 | 196 | conditions={'method': ['GET'], 'function': check_group}, |
|
197 | 197 | requirements=URL_NAME_REQUIREMENTS) |
|
198 | 198 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
199 | 199 | action='edit', |
|
200 | 200 | conditions={'method': ['PUT'], 'function': check_group}, |
|
201 | 201 | requirements=URL_NAME_REQUIREMENTS) |
|
202 | 202 | |
|
203 | 203 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
204 | 204 | action='edit_repo_group_advanced', |
|
205 | 205 | conditions={'method': ['GET'], 'function': check_group}, |
|
206 | 206 | requirements=URL_NAME_REQUIREMENTS) |
|
207 | 207 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
208 | 208 | action='edit_repo_group_advanced', |
|
209 | 209 | conditions={'method': ['PUT'], 'function': check_group}, |
|
210 | 210 | requirements=URL_NAME_REQUIREMENTS) |
|
211 | 211 | |
|
212 | 212 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
213 | 213 | action='edit_repo_group_perms', |
|
214 | 214 | conditions={'method': ['GET'], 'function': check_group}, |
|
215 | 215 | requirements=URL_NAME_REQUIREMENTS) |
|
216 | 216 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
217 | 217 | action='update_perms', |
|
218 | 218 | conditions={'method': ['PUT'], 'function': check_group}, |
|
219 | 219 | requirements=URL_NAME_REQUIREMENTS) |
|
220 | 220 | |
|
221 | 221 | m.connect('delete_repo_group', '/repo_groups/{group_name}', |
|
222 | 222 | action='delete', conditions={'method': ['DELETE'], |
|
223 | 223 | 'function': check_group}, |
|
224 | 224 | requirements=URL_NAME_REQUIREMENTS) |
|
225 | 225 | |
|
226 | 226 | # ADMIN USER ROUTES |
|
227 | 227 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
228 | 228 | controller='admin/users') as m: |
|
229 | 229 | m.connect('users', '/users', |
|
230 | 230 | action='create', conditions={'method': ['POST']}) |
|
231 | 231 | m.connect('new_user', '/users/new', |
|
232 | 232 | action='new', conditions={'method': ['GET']}) |
|
233 | 233 | m.connect('update_user', '/users/{user_id}', |
|
234 | 234 | action='update', conditions={'method': ['PUT']}) |
|
235 | 235 | m.connect('delete_user', '/users/{user_id}', |
|
236 | 236 | action='delete', conditions={'method': ['DELETE']}) |
|
237 | 237 | m.connect('edit_user', '/users/{user_id}/edit', |
|
238 | 238 | action='edit', conditions={'method': ['GET']}, jsroute=True) |
|
239 | 239 | m.connect('user', '/users/{user_id}', |
|
240 | 240 | action='show', conditions={'method': ['GET']}) |
|
241 | 241 | m.connect('force_password_reset_user', '/users/{user_id}/password_reset', |
|
242 | 242 | action='reset_password', conditions={'method': ['POST']}) |
|
243 | 243 | m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group', |
|
244 | 244 | action='create_personal_repo_group', conditions={'method': ['POST']}) |
|
245 | 245 | |
|
246 | 246 | # EXTRAS USER ROUTES |
|
247 | 247 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
248 | 248 | action='edit_advanced', conditions={'method': ['GET']}) |
|
249 | 249 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
250 | 250 | action='update_advanced', conditions={'method': ['PUT']}) |
|
251 | 251 | |
|
252 | 252 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
253 | 253 | action='edit_global_perms', conditions={'method': ['GET']}) |
|
254 | 254 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
255 | 255 | action='update_global_perms', conditions={'method': ['PUT']}) |
|
256 | 256 | |
|
257 | # ADMIN DEFAULTS REST ROUTES | |
|
258 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
|
259 | controller='admin/defaults') as m: | |
|
260 | m.connect('admin_defaults_repositories', '/defaults/repositories', | |
|
261 | action='update_repository_defaults', conditions={'method': ['POST']}) | |
|
262 | m.connect('admin_defaults_repositories', '/defaults/repositories', | |
|
263 | action='index', conditions={'method': ['GET']}) | |
|
264 | ||
|
265 | 257 | # ADMIN SETTINGS ROUTES |
|
266 | 258 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
267 | 259 | controller='admin/settings') as m: |
|
268 | 260 | |
|
269 | 261 | # default |
|
270 | 262 | m.connect('admin_settings', '/settings', |
|
271 | 263 | action='settings_global_update', |
|
272 | 264 | conditions={'method': ['POST']}) |
|
273 | 265 | m.connect('admin_settings', '/settings', |
|
274 | 266 | action='settings_global', conditions={'method': ['GET']}) |
|
275 | 267 | |
|
276 | 268 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
277 | 269 | action='settings_vcs_update', |
|
278 | 270 | conditions={'method': ['POST']}) |
|
279 | 271 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
280 | 272 | action='settings_vcs', |
|
281 | 273 | conditions={'method': ['GET']}) |
|
282 | 274 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
283 | 275 | action='delete_svn_pattern', |
|
284 | 276 | conditions={'method': ['DELETE']}) |
|
285 | 277 | |
|
286 | 278 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
287 | 279 | action='settings_mapping_update', |
|
288 | 280 | conditions={'method': ['POST']}) |
|
289 | 281 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
290 | 282 | action='settings_mapping', conditions={'method': ['GET']}) |
|
291 | 283 | |
|
292 | 284 | m.connect('admin_settings_global', '/settings/global', |
|
293 | 285 | action='settings_global_update', |
|
294 | 286 | conditions={'method': ['POST']}) |
|
295 | 287 | m.connect('admin_settings_global', '/settings/global', |
|
296 | 288 | action='settings_global', conditions={'method': ['GET']}) |
|
297 | 289 | |
|
298 | 290 | m.connect('admin_settings_visual', '/settings/visual', |
|
299 | 291 | action='settings_visual_update', |
|
300 | 292 | conditions={'method': ['POST']}) |
|
301 | 293 | m.connect('admin_settings_visual', '/settings/visual', |
|
302 | 294 | action='settings_visual', conditions={'method': ['GET']}) |
|
303 | 295 | |
|
304 | 296 | m.connect('admin_settings_issuetracker', |
|
305 | 297 | '/settings/issue-tracker', action='settings_issuetracker', |
|
306 | 298 | conditions={'method': ['GET']}) |
|
307 | 299 | m.connect('admin_settings_issuetracker_save', |
|
308 | 300 | '/settings/issue-tracker/save', |
|
309 | 301 | action='settings_issuetracker_save', |
|
310 | 302 | conditions={'method': ['POST']}) |
|
311 | 303 | m.connect('admin_issuetracker_test', '/settings/issue-tracker/test', |
|
312 | 304 | action='settings_issuetracker_test', |
|
313 | 305 | conditions={'method': ['POST']}) |
|
314 | 306 | m.connect('admin_issuetracker_delete', |
|
315 | 307 | '/settings/issue-tracker/delete', |
|
316 | 308 | action='settings_issuetracker_delete', |
|
317 | 309 | conditions={'method': ['DELETE']}) |
|
318 | 310 | |
|
319 | 311 | m.connect('admin_settings_email', '/settings/email', |
|
320 | 312 | action='settings_email_update', |
|
321 | 313 | conditions={'method': ['POST']}) |
|
322 | 314 | m.connect('admin_settings_email', '/settings/email', |
|
323 | 315 | action='settings_email', conditions={'method': ['GET']}) |
|
324 | 316 | |
|
325 | 317 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
326 | 318 | action='settings_hooks_update', |
|
327 | 319 | conditions={'method': ['POST', 'DELETE']}) |
|
328 | 320 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
329 | 321 | action='settings_hooks', conditions={'method': ['GET']}) |
|
330 | 322 | |
|
331 | 323 | m.connect('admin_settings_search', '/settings/search', |
|
332 | 324 | action='settings_search', conditions={'method': ['GET']}) |
|
333 | 325 | |
|
334 | 326 | m.connect('admin_settings_supervisor', '/settings/supervisor', |
|
335 | 327 | action='settings_supervisor', conditions={'method': ['GET']}) |
|
336 | 328 | m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log', |
|
337 | 329 | action='settings_supervisor_log', conditions={'method': ['GET']}) |
|
338 | 330 | |
|
339 | 331 | m.connect('admin_settings_labs', '/settings/labs', |
|
340 | 332 | action='settings_labs_update', |
|
341 | 333 | conditions={'method': ['POST']}) |
|
342 | 334 | m.connect('admin_settings_labs', '/settings/labs', |
|
343 | 335 | action='settings_labs', conditions={'method': ['GET']}) |
|
344 | 336 | |
|
345 | 337 | # ADMIN MY ACCOUNT |
|
346 | 338 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
347 | 339 | controller='admin/my_account') as m: |
|
348 | 340 | |
|
349 | 341 | # NOTE(marcink): this needs to be kept for password force flag to be |
|
350 | 342 | # handled in pylons controllers, remove after full migration to pyramid |
|
351 | 343 | m.connect('my_account_password', '/my_account/password', |
|
352 | 344 | action='my_account_password', conditions={'method': ['GET']}) |
|
353 | 345 | |
|
354 | 346 | |
|
355 | 347 | return rmap |
@@ -1,269 +1,271 b'' | |||
|
1 | 1 | |
|
2 | 2 | /****************************************************************************** |
|
3 | 3 | * * |
|
4 | 4 | * DO NOT CHANGE THIS FILE MANUALLY * |
|
5 | 5 | * * |
|
6 | 6 | * * |
|
7 | 7 | * This file is automatically generated when the app starts up with * |
|
8 | 8 | * generate_js_files = true * |
|
9 | 9 | * * |
|
10 | 10 | * To add a route here pass jsroute=True to the route definition in the app * |
|
11 | 11 | * * |
|
12 | 12 | ******************************************************************************/ |
|
13 | 13 | function registerRCRoutes() { |
|
14 | 14 | // routes registration |
|
15 | 15 | pyroutes.register('edit_user', '/_admin/users/%(user_id)s/edit', ['user_id']); |
|
16 | 16 | pyroutes.register('favicon', '/favicon.ico', []); |
|
17 | 17 | pyroutes.register('robots', '/robots.txt', []); |
|
18 | 18 | pyroutes.register('auth_home', '/_admin/auth*traverse', []); |
|
19 | 19 | pyroutes.register('global_integrations_new', '/_admin/integrations/new', []); |
|
20 | 20 | pyroutes.register('global_integrations_home', '/_admin/integrations', []); |
|
21 | 21 | pyroutes.register('global_integrations_list', '/_admin/integrations/%(integration)s', ['integration']); |
|
22 | 22 | pyroutes.register('global_integrations_create', '/_admin/integrations/%(integration)s/new', ['integration']); |
|
23 | 23 | pyroutes.register('global_integrations_edit', '/_admin/integrations/%(integration)s/%(integration_id)s', ['integration', 'integration_id']); |
|
24 | 24 | pyroutes.register('repo_group_integrations_home', '/%(repo_group_name)s/settings/integrations', ['repo_group_name']); |
|
25 | 25 | pyroutes.register('repo_group_integrations_new', '/%(repo_group_name)s/settings/integrations/new', ['repo_group_name']); |
|
26 | 26 | pyroutes.register('repo_group_integrations_list', '/%(repo_group_name)s/settings/integrations/%(integration)s', ['repo_group_name', 'integration']); |
|
27 | 27 | pyroutes.register('repo_group_integrations_create', '/%(repo_group_name)s/settings/integrations/%(integration)s/new', ['repo_group_name', 'integration']); |
|
28 | 28 | pyroutes.register('repo_group_integrations_edit', '/%(repo_group_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_group_name', 'integration', 'integration_id']); |
|
29 | 29 | pyroutes.register('repo_integrations_home', '/%(repo_name)s/settings/integrations', ['repo_name']); |
|
30 | 30 | pyroutes.register('repo_integrations_new', '/%(repo_name)s/settings/integrations/new', ['repo_name']); |
|
31 | 31 | pyroutes.register('repo_integrations_list', '/%(repo_name)s/settings/integrations/%(integration)s', ['repo_name', 'integration']); |
|
32 | 32 | pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); |
|
33 | 33 | pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); |
|
34 | 34 | pyroutes.register('ops_ping', '/_admin/ops/ping', []); |
|
35 | 35 | pyroutes.register('ops_error_test', '/_admin/ops/error', []); |
|
36 | 36 | pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []); |
|
37 | 37 | pyroutes.register('admin_home', '/_admin', []); |
|
38 | 38 | pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []); |
|
39 | 39 | pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']); |
|
40 | 40 | pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']); |
|
41 | 41 | pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']); |
|
42 | 42 | pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []); |
|
43 | 43 | pyroutes.register('admin_settings_vcs_svn_generate_cfg', '/_admin/settings/vcs/svn_generate_cfg', []); |
|
44 | 44 | pyroutes.register('admin_settings_system', '/_admin/settings/system', []); |
|
45 | 45 | pyroutes.register('admin_settings_system_update', '/_admin/settings/system/updates', []); |
|
46 | 46 | pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []); |
|
47 | 47 | pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []); |
|
48 | 48 | pyroutes.register('admin_settings_process_management', '/_admin/settings/process_management', []); |
|
49 | 49 | pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []); |
|
50 | pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []); | |
|
51 | pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []); | |
|
50 | 52 | pyroutes.register('admin_permissions_application', '/_admin/permissions/application', []); |
|
51 | 53 | pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []); |
|
52 | 54 | pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []); |
|
53 | 55 | pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []); |
|
54 | 56 | pyroutes.register('admin_permissions_object', '/_admin/permissions/object', []); |
|
55 | 57 | pyroutes.register('admin_permissions_object_update', '/_admin/permissions/object/update', []); |
|
56 | 58 | pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []); |
|
57 | 59 | pyroutes.register('admin_permissions_overview', '/_admin/permissions/overview', []); |
|
58 | 60 | pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []); |
|
59 | 61 | pyroutes.register('admin_permissions_ssh_keys', '/_admin/permissions/ssh_keys', []); |
|
60 | 62 | pyroutes.register('admin_permissions_ssh_keys_data', '/_admin/permissions/ssh_keys/data', []); |
|
61 | 63 | pyroutes.register('admin_permissions_ssh_keys_update', '/_admin/permissions/ssh_keys/update', []); |
|
62 | 64 | pyroutes.register('users', '/_admin/users', []); |
|
63 | 65 | pyroutes.register('users_data', '/_admin/users_data', []); |
|
64 | 66 | pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']); |
|
65 | 67 | pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']); |
|
66 | 68 | pyroutes.register('edit_user_auth_tokens_delete', '/_admin/users/%(user_id)s/edit/auth_tokens/delete', ['user_id']); |
|
67 | 69 | pyroutes.register('edit_user_ssh_keys', '/_admin/users/%(user_id)s/edit/ssh_keys', ['user_id']); |
|
68 | 70 | pyroutes.register('edit_user_ssh_keys_generate_keypair', '/_admin/users/%(user_id)s/edit/ssh_keys/generate', ['user_id']); |
|
69 | 71 | pyroutes.register('edit_user_ssh_keys_add', '/_admin/users/%(user_id)s/edit/ssh_keys/new', ['user_id']); |
|
70 | 72 | pyroutes.register('edit_user_ssh_keys_delete', '/_admin/users/%(user_id)s/edit/ssh_keys/delete', ['user_id']); |
|
71 | 73 | pyroutes.register('edit_user_emails', '/_admin/users/%(user_id)s/edit/emails', ['user_id']); |
|
72 | 74 | pyroutes.register('edit_user_emails_add', '/_admin/users/%(user_id)s/edit/emails/new', ['user_id']); |
|
73 | 75 | pyroutes.register('edit_user_emails_delete', '/_admin/users/%(user_id)s/edit/emails/delete', ['user_id']); |
|
74 | 76 | pyroutes.register('edit_user_ips', '/_admin/users/%(user_id)s/edit/ips', ['user_id']); |
|
75 | 77 | pyroutes.register('edit_user_ips_add', '/_admin/users/%(user_id)s/edit/ips/new', ['user_id']); |
|
76 | 78 | pyroutes.register('edit_user_ips_delete', '/_admin/users/%(user_id)s/edit/ips/delete', ['user_id']); |
|
77 | 79 | pyroutes.register('edit_user_perms_summary', '/_admin/users/%(user_id)s/edit/permissions_summary', ['user_id']); |
|
78 | 80 | pyroutes.register('edit_user_perms_summary_json', '/_admin/users/%(user_id)s/edit/permissions_summary/json', ['user_id']); |
|
79 | 81 | pyroutes.register('edit_user_groups_management', '/_admin/users/%(user_id)s/edit/groups_management', ['user_id']); |
|
80 | 82 | pyroutes.register('edit_user_groups_management_updates', '/_admin/users/%(user_id)s/edit/edit_user_groups_management/updates', ['user_id']); |
|
81 | 83 | pyroutes.register('edit_user_audit_logs', '/_admin/users/%(user_id)s/edit/audit', ['user_id']); |
|
82 | 84 | pyroutes.register('user_groups', '/_admin/user_groups', []); |
|
83 | 85 | pyroutes.register('user_groups_data', '/_admin/user_groups_data', []); |
|
84 | 86 | pyroutes.register('user_groups_new', '/_admin/user_groups/new', []); |
|
85 | 87 | pyroutes.register('user_groups_create', '/_admin/user_groups/create', []); |
|
86 | 88 | pyroutes.register('repos', '/_admin/repos', []); |
|
87 | 89 | pyroutes.register('repo_new', '/_admin/repos/new', []); |
|
88 | 90 | pyroutes.register('repo_create', '/_admin/repos/create', []); |
|
89 | 91 | pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []); |
|
90 | 92 | pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []); |
|
91 | 93 | pyroutes.register('channelstream_proxy', '/_channelstream', []); |
|
92 | 94 | pyroutes.register('login', '/_admin/login', []); |
|
93 | 95 | pyroutes.register('logout', '/_admin/logout', []); |
|
94 | 96 | pyroutes.register('register', '/_admin/register', []); |
|
95 | 97 | pyroutes.register('reset_password', '/_admin/password_reset', []); |
|
96 | 98 | pyroutes.register('reset_password_confirmation', '/_admin/password_reset_confirmation', []); |
|
97 | 99 | pyroutes.register('home', '/', []); |
|
98 | 100 | pyroutes.register('user_autocomplete_data', '/_users', []); |
|
99 | 101 | pyroutes.register('user_group_autocomplete_data', '/_user_groups', []); |
|
100 | 102 | pyroutes.register('repo_list_data', '/_repos', []); |
|
101 | 103 | pyroutes.register('goto_switcher_data', '/_goto_data', []); |
|
102 | 104 | pyroutes.register('journal', '/_admin/journal', []); |
|
103 | 105 | pyroutes.register('journal_rss', '/_admin/journal/rss', []); |
|
104 | 106 | pyroutes.register('journal_atom', '/_admin/journal/atom', []); |
|
105 | 107 | pyroutes.register('journal_public', '/_admin/public_journal', []); |
|
106 | 108 | pyroutes.register('journal_public_atom', '/_admin/public_journal/atom', []); |
|
107 | 109 | pyroutes.register('journal_public_atom_old', '/_admin/public_journal_atom', []); |
|
108 | 110 | pyroutes.register('journal_public_rss', '/_admin/public_journal/rss', []); |
|
109 | 111 | pyroutes.register('journal_public_rss_old', '/_admin/public_journal_rss', []); |
|
110 | 112 | pyroutes.register('toggle_following', '/_admin/toggle_following', []); |
|
111 | 113 | pyroutes.register('repo_creating', '/%(repo_name)s/repo_creating', ['repo_name']); |
|
112 | 114 | pyroutes.register('repo_creating_check', '/%(repo_name)s/repo_creating_check', ['repo_name']); |
|
113 | 115 | pyroutes.register('repo_summary_explicit', '/%(repo_name)s/summary', ['repo_name']); |
|
114 | 116 | pyroutes.register('repo_summary_commits', '/%(repo_name)s/summary-commits', ['repo_name']); |
|
115 | 117 | pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']); |
|
116 | 118 | pyroutes.register('repo_commit_children', '/%(repo_name)s/changeset_children/%(commit_id)s', ['repo_name', 'commit_id']); |
|
117 | 119 | pyroutes.register('repo_commit_parents', '/%(repo_name)s/changeset_parents/%(commit_id)s', ['repo_name', 'commit_id']); |
|
118 | 120 | pyroutes.register('repo_commit_raw', '/%(repo_name)s/changeset-diff/%(commit_id)s', ['repo_name', 'commit_id']); |
|
119 | 121 | pyroutes.register('repo_commit_patch', '/%(repo_name)s/changeset-patch/%(commit_id)s', ['repo_name', 'commit_id']); |
|
120 | 122 | pyroutes.register('repo_commit_download', '/%(repo_name)s/changeset-download/%(commit_id)s', ['repo_name', 'commit_id']); |
|
121 | 123 | pyroutes.register('repo_commit_data', '/%(repo_name)s/changeset-data/%(commit_id)s', ['repo_name', 'commit_id']); |
|
122 | 124 | pyroutes.register('repo_commit_comment_create', '/%(repo_name)s/changeset/%(commit_id)s/comment/create', ['repo_name', 'commit_id']); |
|
123 | 125 | pyroutes.register('repo_commit_comment_preview', '/%(repo_name)s/changeset/%(commit_id)s/comment/preview', ['repo_name', 'commit_id']); |
|
124 | 126 | pyroutes.register('repo_commit_comment_delete', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/delete', ['repo_name', 'commit_id', 'comment_id']); |
|
125 | 127 | pyroutes.register('repo_commit_raw_deprecated', '/%(repo_name)s/raw-changeset/%(commit_id)s', ['repo_name', 'commit_id']); |
|
126 | 128 | pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']); |
|
127 | 129 | pyroutes.register('repo_files_diff', '/%(repo_name)s/diff/%(f_path)s', ['repo_name', 'f_path']); |
|
128 | 130 | pyroutes.register('repo_files_diff_2way_redirect', '/%(repo_name)s/diff-2way/%(f_path)s', ['repo_name', 'f_path']); |
|
129 | 131 | pyroutes.register('repo_files', '/%(repo_name)s/files/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
130 | 132 | pyroutes.register('repo_files:default_path', '/%(repo_name)s/files/%(commit_id)s/', ['repo_name', 'commit_id']); |
|
131 | 133 | pyroutes.register('repo_files:default_commit', '/%(repo_name)s/files', ['repo_name']); |
|
132 | 134 | pyroutes.register('repo_files:rendered', '/%(repo_name)s/render/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
133 | 135 | pyroutes.register('repo_files:annotated', '/%(repo_name)s/annotate/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
134 | 136 | pyroutes.register('repo_files:annotated_previous', '/%(repo_name)s/annotate-previous/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
135 | 137 | pyroutes.register('repo_nodetree_full', '/%(repo_name)s/nodetree_full/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
136 | 138 | pyroutes.register('repo_nodetree_full:default_path', '/%(repo_name)s/nodetree_full/%(commit_id)s/', ['repo_name', 'commit_id']); |
|
137 | 139 | pyroutes.register('repo_files_nodelist', '/%(repo_name)s/nodelist/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
138 | 140 | pyroutes.register('repo_file_raw', '/%(repo_name)s/raw/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
139 | 141 | pyroutes.register('repo_file_download', '/%(repo_name)s/download/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
140 | 142 | pyroutes.register('repo_file_download:legacy', '/%(repo_name)s/rawfile/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
141 | 143 | pyroutes.register('repo_file_history', '/%(repo_name)s/history/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
142 | 144 | pyroutes.register('repo_file_authors', '/%(repo_name)s/authors/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
143 | 145 | pyroutes.register('repo_files_remove_file', '/%(repo_name)s/remove_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
144 | 146 | pyroutes.register('repo_files_delete_file', '/%(repo_name)s/delete_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
145 | 147 | pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
146 | 148 | pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
147 | 149 | pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
148 | 150 | pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
149 | 151 | pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']); |
|
150 | 152 | pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']); |
|
151 | 153 | pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']); |
|
152 | 154 | pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']); |
|
153 | 155 | pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
154 | 156 | pyroutes.register('repo_changelog_elements', '/%(repo_name)s/changelog_elements', ['repo_name']); |
|
155 | 157 | pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']); |
|
156 | 158 | pyroutes.register('repo_compare', '/%(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']); |
|
157 | 159 | pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']); |
|
158 | 160 | pyroutes.register('branches_home', '/%(repo_name)s/branches', ['repo_name']); |
|
159 | 161 | pyroutes.register('bookmarks_home', '/%(repo_name)s/bookmarks', ['repo_name']); |
|
160 | 162 | pyroutes.register('repo_fork_new', '/%(repo_name)s/fork', ['repo_name']); |
|
161 | 163 | pyroutes.register('repo_fork_create', '/%(repo_name)s/fork/create', ['repo_name']); |
|
162 | 164 | pyroutes.register('repo_forks_show_all', '/%(repo_name)s/forks', ['repo_name']); |
|
163 | 165 | pyroutes.register('repo_forks_data', '/%(repo_name)s/forks/data', ['repo_name']); |
|
164 | 166 | pyroutes.register('pullrequest_show', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']); |
|
165 | 167 | pyroutes.register('pullrequest_show_all', '/%(repo_name)s/pull-request', ['repo_name']); |
|
166 | 168 | pyroutes.register('pullrequest_show_all_data', '/%(repo_name)s/pull-request-data', ['repo_name']); |
|
167 | 169 | pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']); |
|
168 | 170 | pyroutes.register('pullrequest_repo_destinations', '/%(repo_name)s/pull-request/repo-destinations', ['repo_name']); |
|
169 | 171 | pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']); |
|
170 | 172 | pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']); |
|
171 | 173 | pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s/update', ['repo_name', 'pull_request_id']); |
|
172 | 174 | pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']); |
|
173 | 175 | pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']); |
|
174 | 176 | pyroutes.register('pullrequest_comment_create', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment', ['repo_name', 'pull_request_id']); |
|
175 | 177 | pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/delete', ['repo_name', 'pull_request_id', 'comment_id']); |
|
176 | 178 | pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); |
|
177 | 179 | pyroutes.register('edit_repo_advanced', '/%(repo_name)s/settings/advanced', ['repo_name']); |
|
178 | 180 | pyroutes.register('edit_repo_advanced_delete', '/%(repo_name)s/settings/advanced/delete', ['repo_name']); |
|
179 | 181 | pyroutes.register('edit_repo_advanced_locking', '/%(repo_name)s/settings/advanced/locking', ['repo_name']); |
|
180 | 182 | pyroutes.register('edit_repo_advanced_journal', '/%(repo_name)s/settings/advanced/journal', ['repo_name']); |
|
181 | 183 | pyroutes.register('edit_repo_advanced_fork', '/%(repo_name)s/settings/advanced/fork', ['repo_name']); |
|
182 | 184 | pyroutes.register('edit_repo_caches', '/%(repo_name)s/settings/caches', ['repo_name']); |
|
183 | 185 | pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']); |
|
184 | 186 | pyroutes.register('edit_repo_maintenance', '/%(repo_name)s/settings/maintenance', ['repo_name']); |
|
185 | 187 | pyroutes.register('edit_repo_maintenance_execute', '/%(repo_name)s/settings/maintenance/execute', ['repo_name']); |
|
186 | 188 | pyroutes.register('edit_repo_fields', '/%(repo_name)s/settings/fields', ['repo_name']); |
|
187 | 189 | pyroutes.register('edit_repo_fields_create', '/%(repo_name)s/settings/fields/create', ['repo_name']); |
|
188 | 190 | pyroutes.register('edit_repo_fields_delete', '/%(repo_name)s/settings/fields/%(field_id)s/delete', ['repo_name', 'field_id']); |
|
189 | 191 | pyroutes.register('repo_edit_toggle_locking', '/%(repo_name)s/settings/toggle_locking', ['repo_name']); |
|
190 | 192 | pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']); |
|
191 | 193 | pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']); |
|
192 | 194 | pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']); |
|
193 | 195 | pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']); |
|
194 | 196 | pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']); |
|
195 | 197 | pyroutes.register('edit_repo_issuetracker_test', '/%(repo_name)s/settings/issue_trackers/test', ['repo_name']); |
|
196 | 198 | pyroutes.register('edit_repo_issuetracker_delete', '/%(repo_name)s/settings/issue_trackers/delete', ['repo_name']); |
|
197 | 199 | pyroutes.register('edit_repo_issuetracker_update', '/%(repo_name)s/settings/issue_trackers/update', ['repo_name']); |
|
198 | 200 | pyroutes.register('edit_repo_vcs', '/%(repo_name)s/settings/vcs', ['repo_name']); |
|
199 | 201 | pyroutes.register('edit_repo_vcs_update', '/%(repo_name)s/settings/vcs/update', ['repo_name']); |
|
200 | 202 | pyroutes.register('edit_repo_vcs_svn_pattern_delete', '/%(repo_name)s/settings/vcs/svn_pattern/delete', ['repo_name']); |
|
201 | 203 | pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']); |
|
202 | 204 | pyroutes.register('repo_default_reviewers_data', '/%(repo_name)s/settings/review/default-reviewers', ['repo_name']); |
|
203 | 205 | pyroutes.register('edit_repo_strip', '/%(repo_name)s/settings/strip', ['repo_name']); |
|
204 | 206 | pyroutes.register('strip_check', '/%(repo_name)s/settings/strip_check', ['repo_name']); |
|
205 | 207 | pyroutes.register('strip_execute', '/%(repo_name)s/settings/strip_execute', ['repo_name']); |
|
206 | 208 | pyroutes.register('rss_feed_home', '/%(repo_name)s/feed/rss', ['repo_name']); |
|
207 | 209 | pyroutes.register('atom_feed_home', '/%(repo_name)s/feed/atom', ['repo_name']); |
|
208 | 210 | pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']); |
|
209 | 211 | pyroutes.register('repo_summary_slash', '/%(repo_name)s/', ['repo_name']); |
|
210 | 212 | pyroutes.register('repo_group_home', '/%(repo_group_name)s', ['repo_group_name']); |
|
211 | 213 | pyroutes.register('repo_group_home_slash', '/%(repo_group_name)s/', ['repo_group_name']); |
|
212 | 214 | pyroutes.register('user_group_members_data', '/_admin/user_groups/%(user_group_id)s/members', ['user_group_id']); |
|
213 | 215 | pyroutes.register('edit_user_group_perms_summary', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary', ['user_group_id']); |
|
214 | 216 | pyroutes.register('edit_user_group_perms_summary_json', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary/json', ['user_group_id']); |
|
215 | 217 | pyroutes.register('edit_user_group', '/_admin/user_groups/%(user_group_id)s/edit', ['user_group_id']); |
|
216 | 218 | pyroutes.register('user_groups_update', '/_admin/user_groups/%(user_group_id)s/update', ['user_group_id']); |
|
217 | 219 | pyroutes.register('edit_user_group_global_perms', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions', ['user_group_id']); |
|
218 | 220 | pyroutes.register('edit_user_group_global_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions/update', ['user_group_id']); |
|
219 | 221 | pyroutes.register('edit_user_group_perms', '/_admin/user_groups/%(user_group_id)s/edit/permissions', ['user_group_id']); |
|
220 | 222 | pyroutes.register('edit_user_group_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/permissions/update', ['user_group_id']); |
|
221 | 223 | pyroutes.register('edit_user_group_advanced', '/_admin/user_groups/%(user_group_id)s/edit/advanced', ['user_group_id']); |
|
222 | 224 | pyroutes.register('edit_user_group_advanced_sync', '/_admin/user_groups/%(user_group_id)s/edit/advanced/sync', ['user_group_id']); |
|
223 | 225 | pyroutes.register('user_groups_delete', '/_admin/user_groups/%(user_group_id)s/delete', ['user_group_id']); |
|
224 | 226 | pyroutes.register('search', '/_admin/search', []); |
|
225 | 227 | pyroutes.register('search_repo', '/%(repo_name)s/search', ['repo_name']); |
|
226 | 228 | pyroutes.register('user_profile', '/_profiles/%(username)s', ['username']); |
|
227 | 229 | pyroutes.register('my_account_profile', '/_admin/my_account/profile', []); |
|
228 | 230 | pyroutes.register('my_account_edit', '/_admin/my_account/edit', []); |
|
229 | 231 | pyroutes.register('my_account_update', '/_admin/my_account/update', []); |
|
230 | 232 | pyroutes.register('my_account_password', '/_admin/my_account/password', []); |
|
231 | 233 | pyroutes.register('my_account_password_update', '/_admin/my_account/password/update', []); |
|
232 | 234 | pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []); |
|
233 | 235 | pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []); |
|
234 | 236 | pyroutes.register('my_account_auth_tokens_delete', '/_admin/my_account/auth_tokens/delete', []); |
|
235 | 237 | pyroutes.register('my_account_ssh_keys', '/_admin/my_account/ssh_keys', []); |
|
236 | 238 | pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []); |
|
237 | 239 | pyroutes.register('my_account_ssh_keys_add', '/_admin/my_account/ssh_keys/new', []); |
|
238 | 240 | pyroutes.register('my_account_ssh_keys_delete', '/_admin/my_account/ssh_keys/delete', []); |
|
239 | 241 | pyroutes.register('my_account_emails', '/_admin/my_account/emails', []); |
|
240 | 242 | pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []); |
|
241 | 243 | pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []); |
|
242 | 244 | pyroutes.register('my_account_repos', '/_admin/my_account/repos', []); |
|
243 | 245 | pyroutes.register('my_account_watched', '/_admin/my_account/watched', []); |
|
244 | 246 | pyroutes.register('my_account_perms', '/_admin/my_account/perms', []); |
|
245 | 247 | pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []); |
|
246 | 248 | pyroutes.register('my_account_notifications_toggle_visibility', '/_admin/my_account/toggle_visibility', []); |
|
247 | 249 | pyroutes.register('my_account_pullrequests', '/_admin/my_account/pull_requests', []); |
|
248 | 250 | pyroutes.register('my_account_pullrequests_data', '/_admin/my_account/pull_requests/data', []); |
|
249 | 251 | pyroutes.register('notifications_show_all', '/_admin/notifications', []); |
|
250 | 252 | pyroutes.register('notifications_mark_all_read', '/_admin/notifications/mark_all_read', []); |
|
251 | 253 | pyroutes.register('notifications_show', '/_admin/notifications/%(notification_id)s', ['notification_id']); |
|
252 | 254 | pyroutes.register('notifications_update', '/_admin/notifications/%(notification_id)s/update', ['notification_id']); |
|
253 | 255 | pyroutes.register('notifications_delete', '/_admin/notifications/%(notification_id)s/delete', ['notification_id']); |
|
254 | 256 | pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []); |
|
255 | 257 | pyroutes.register('gists_show', '/_admin/gists', []); |
|
256 | 258 | pyroutes.register('gists_new', '/_admin/gists/new', []); |
|
257 | 259 | pyroutes.register('gists_create', '/_admin/gists/create', []); |
|
258 | 260 | pyroutes.register('gist_show', '/_admin/gists/%(gist_id)s', ['gist_id']); |
|
259 | 261 | pyroutes.register('gist_delete', '/_admin/gists/%(gist_id)s/delete', ['gist_id']); |
|
260 | 262 | pyroutes.register('gist_edit', '/_admin/gists/%(gist_id)s/edit', ['gist_id']); |
|
261 | 263 | pyroutes.register('gist_edit_check_revision', '/_admin/gists/%(gist_id)s/edit/check_revision', ['gist_id']); |
|
262 | 264 | pyroutes.register('gist_update', '/_admin/gists/%(gist_id)s/update', ['gist_id']); |
|
263 | 265 | pyroutes.register('gist_show_rev', '/_admin/gists/%(gist_id)s/%(revision)s', ['gist_id', 'revision']); |
|
264 | 266 | pyroutes.register('gist_show_formatted', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s', ['gist_id', 'revision', 'format']); |
|
265 | 267 | pyroutes.register('gist_show_formatted_path', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s/%(f_path)s', ['gist_id', 'revision', 'format', 'f_path']); |
|
266 | 268 | pyroutes.register('debug_style_home', '/_admin/debug_style', []); |
|
267 | 269 | pyroutes.register('debug_style_template', '/_admin/debug_style/t/%(t_path)s', ['t_path']); |
|
268 | 270 | pyroutes.register('apiv2', '/_admin/api', []); |
|
269 | 271 | } |
@@ -1,42 +1,42 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="/base/base.mako"/> |
|
3 | 3 | |
|
4 | 4 | <%def name="title()"> |
|
5 | 5 | ${_('Repositories defaults')} |
|
6 | 6 | %if c.rhodecode_name: |
|
7 | 7 | · ${h.branding(c.rhodecode_name)} |
|
8 | 8 | %endif |
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | 11 | <%def name="breadcrumbs_links()"> |
|
12 | 12 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} |
|
13 | 13 | » |
|
14 | 14 | ${_('Repositories defaults')} |
|
15 | 15 | </%def> |
|
16 | 16 | |
|
17 | 17 | <%def name="menu_bar_nav()"> |
|
18 | 18 | ${self.menu_items(active='admin')} |
|
19 | 19 | </%def> |
|
20 | 20 | |
|
21 | 21 | <%def name="main()"> |
|
22 | 22 | <div class="box"> |
|
23 | 23 | <div class="title"> |
|
24 | 24 | ${self.breadcrumbs()} |
|
25 | 25 | </div> |
|
26 | 26 | |
|
27 | 27 | ##main |
|
28 | 28 | <div class="sidebar-col-wrapper"> |
|
29 | 29 | <div class="sidebar"> |
|
30 | 30 | <ul class="nav nav-pills nav-stacked"> |
|
31 |
<li class="${'active' if c.active=='repositories' else ''}"><a href="${h. |
|
|
31 | <li class="${'active' if c.active=='repositories' else ''}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Repository')}</a></li> | |
|
32 | 32 | </ul> |
|
33 | 33 | </div> |
|
34 | 34 | |
|
35 | 35 | <div class="main-content-full-width"> |
|
36 | 36 | <%include file="/admin/defaults/defaults_${c.active}.mako"/> |
|
37 | 37 | </div> |
|
38 | 38 | |
|
39 | 39 | </div> |
|
40 | 40 | </div> |
|
41 | 41 | |
|
42 | 42 | </%def> |
@@ -1,81 +1,81 b'' | |||
|
1 | 1 | <div class="panel panel-default"> |
|
2 | 2 | <div class="panel-heading"> |
|
3 | 3 | <h3 class="panel-title">${_('Default Settings For New Repositories')}</h3> |
|
4 | 4 | </div> |
|
5 | 5 | <div class="panel-body"> |
|
6 |
${h.secure_form(h. |
|
|
6 | ${h.secure_form(h.route_path('admin_defaults_repositories_update'), method='POST', request=request)} | |
|
7 | 7 | <div class="form"> |
|
8 | 8 | <!-- fields --> |
|
9 | 9 | |
|
10 | 10 | <div class="fields"> |
|
11 | 11 | |
|
12 | 12 | <div class="field"> |
|
13 | 13 | <div class="label"> |
|
14 | 14 | <label for="default_repo_type">${_('Type')}:</label> |
|
15 | 15 | </div> |
|
16 | 16 | <div class="select"> |
|
17 | 17 | ${h.select('default_repo_type','hg',c.backends,class_="medium")} |
|
18 | 18 | </div> |
|
19 | 19 | </div> |
|
20 | 20 | |
|
21 | 21 | <div class="field"> |
|
22 | 22 | <div class="label label-checkbox"> |
|
23 | 23 | <label for="default_repo_private">${_('Private Repository')}:</label> |
|
24 | 24 | </div> |
|
25 | 25 | <div class="checkboxes"> |
|
26 | 26 | ${h.checkbox('default_repo_private',value="True")} |
|
27 | 27 | <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span> |
|
28 | 28 | </div> |
|
29 | 29 | </div> |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | <div class="field"> |
|
33 | 33 | <div class="label label-checkbox"> |
|
34 | 34 | <label for="default_repo_enable_statistics">${_('Enable Statistics')}:</label> |
|
35 | 35 | </div> |
|
36 | 36 | <div class="checkboxes"> |
|
37 | 37 | ${h.checkbox('default_repo_enable_statistics',value="True")} |
|
38 | 38 | <span class="help-block">${_('Enable a statistics window on the repository summary page.')}</span> |
|
39 | 39 | </div> |
|
40 | 40 | </div> |
|
41 | 41 | |
|
42 | 42 | <div class="field"> |
|
43 | 43 | <div class="label label-checkbox"> |
|
44 | 44 | <label for="default_repo_enable_downloads">${_('Enable Downloads')}:</label> |
|
45 | 45 | </div> |
|
46 | 46 | <div class="checkboxes"> |
|
47 | 47 | ${h.checkbox('default_repo_enable_downloads',value="True")} |
|
48 | 48 | <span class="help-block">${_('Enable the download option on the repository summary page.')}</span> |
|
49 | 49 | </div> |
|
50 | 50 | </div> |
|
51 | 51 | |
|
52 | 52 | <div class="field"> |
|
53 | 53 | <div class="label label-checkbox"> |
|
54 | 54 | <label for="default_repo_enable_locking">${_('Enable Locking')}:</label> |
|
55 | 55 | </div> |
|
56 | 56 | <div class="checkboxes"> |
|
57 | 57 | ${h.checkbox('default_repo_enable_locking',value="True")} |
|
58 | 58 | <span class="help-block">${_('Enable automatic repository locking. Pulling from a repository will lock it, and it is unlocked by pushing back by the same user.')}</span> |
|
59 | 59 | </div> |
|
60 | 60 | </div> |
|
61 | 61 | |
|
62 | 62 | <div class="buttons"> |
|
63 | 63 | ${h.submit('save',_('Save'),class_="btn")} |
|
64 | 64 | </div> |
|
65 | 65 | </div> |
|
66 | 66 | </div> |
|
67 | 67 | ${h.end_form()} |
|
68 | 68 | </div> |
|
69 | 69 | |
|
70 | 70 | </div> |
|
71 | 71 | |
|
72 | 72 | <script> |
|
73 | 73 | $(document).ready(function(){ |
|
74 | 74 | $("#default_repo_type").select2({ |
|
75 | 75 | containerCssClass: 'drop-menu', |
|
76 | 76 | dropdownCssClass: 'drop-menu-dropdown', |
|
77 | 77 | dropdownAutoWidth: true, |
|
78 | 78 | minimumResultsForSearch: -1 |
|
79 | 79 | }); |
|
80 | 80 | }) |
|
81 | 81 | </script> |
@@ -1,609 +1,609 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="root.mako"/> |
|
3 | 3 | |
|
4 | 4 | <div class="outerwrapper"> |
|
5 | 5 | <!-- HEADER --> |
|
6 | 6 | <div class="header"> |
|
7 | 7 | <div id="header-inner" class="wrapper"> |
|
8 | 8 | <div id="logo"> |
|
9 | 9 | <div class="logo-wrapper"> |
|
10 | 10 | <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> |
|
11 | 11 | </div> |
|
12 | 12 | %if c.rhodecode_name: |
|
13 | 13 | <div class="branding">- ${h.branding(c.rhodecode_name)}</div> |
|
14 | 14 | %endif |
|
15 | 15 | </div> |
|
16 | 16 | <!-- MENU BAR NAV --> |
|
17 | 17 | ${self.menu_bar_nav()} |
|
18 | 18 | <!-- END MENU BAR NAV --> |
|
19 | 19 | </div> |
|
20 | 20 | </div> |
|
21 | 21 | ${self.menu_bar_subnav()} |
|
22 | 22 | <!-- END HEADER --> |
|
23 | 23 | |
|
24 | 24 | <!-- CONTENT --> |
|
25 | 25 | <div id="content" class="wrapper"> |
|
26 | 26 | |
|
27 | 27 | <rhodecode-toast id="notifications"></rhodecode-toast> |
|
28 | 28 | |
|
29 | 29 | <div class="main"> |
|
30 | 30 | ${next.main()} |
|
31 | 31 | </div> |
|
32 | 32 | </div> |
|
33 | 33 | <!-- END CONTENT --> |
|
34 | 34 | |
|
35 | 35 | </div> |
|
36 | 36 | <!-- FOOTER --> |
|
37 | 37 | <div id="footer"> |
|
38 | 38 | <div id="footer-inner" class="title wrapper"> |
|
39 | 39 | <div> |
|
40 | 40 | <p class="footer-link-right"> |
|
41 | 41 | % if c.visual.show_version: |
|
42 | 42 | RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition} |
|
43 | 43 | % endif |
|
44 | 44 | © 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved. |
|
45 | 45 | % if c.visual.rhodecode_support_url: |
|
46 | 46 | <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a> |
|
47 | 47 | % endif |
|
48 | 48 | </p> |
|
49 | 49 | <% sid = 'block' if request.GET.get('showrcid') else 'none' %> |
|
50 | 50 | <p class="server-instance" style="display:${sid}"> |
|
51 | 51 | ## display hidden instance ID if specially defined |
|
52 | 52 | % if c.rhodecode_instanceid: |
|
53 | 53 | ${_('RhodeCode instance id: %s') % c.rhodecode_instanceid} |
|
54 | 54 | % endif |
|
55 | 55 | </p> |
|
56 | 56 | </div> |
|
57 | 57 | </div> |
|
58 | 58 | </div> |
|
59 | 59 | |
|
60 | 60 | <!-- END FOOTER --> |
|
61 | 61 | |
|
62 | 62 | ### MAKO DEFS ### |
|
63 | 63 | |
|
64 | 64 | <%def name="menu_bar_subnav()"> |
|
65 | 65 | </%def> |
|
66 | 66 | |
|
67 | 67 | <%def name="breadcrumbs(class_='breadcrumbs')"> |
|
68 | 68 | <div class="${class_}"> |
|
69 | 69 | ${self.breadcrumbs_links()} |
|
70 | 70 | </div> |
|
71 | 71 | </%def> |
|
72 | 72 | |
|
73 | 73 | <%def name="admin_menu()"> |
|
74 | 74 | <ul class="admin_menu submenu"> |
|
75 | 75 | <li><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li> |
|
76 | 76 | <li><a href="${h.route_path('repos')}">${_('Repositories')}</a></li> |
|
77 | 77 | <li><a href="${h.url('repo_groups')}">${_('Repository groups')}</a></li> |
|
78 | 78 | <li><a href="${h.route_path('users')}">${_('Users')}</a></li> |
|
79 | 79 | <li><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li> |
|
80 | 80 | <li><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li> |
|
81 | 81 | <li><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li> |
|
82 | 82 | <li><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li> |
|
83 |
<li><a href="${h. |
|
|
83 | <li><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li> | |
|
84 | 84 | <li class="last"><a href="${h.url('admin_settings')}">${_('Settings')}</a></li> |
|
85 | 85 | </ul> |
|
86 | 86 | </%def> |
|
87 | 87 | |
|
88 | 88 | |
|
89 | 89 | <%def name="dt_info_panel(elements)"> |
|
90 | 90 | <dl class="dl-horizontal"> |
|
91 | 91 | %for dt, dd, title, show_items in elements: |
|
92 | 92 | <dt>${dt}:</dt> |
|
93 | 93 | <dd title="${h.tooltip(title)}"> |
|
94 | 94 | %if callable(dd): |
|
95 | 95 | ## allow lazy evaluation of elements |
|
96 | 96 | ${dd()} |
|
97 | 97 | %else: |
|
98 | 98 | ${dd} |
|
99 | 99 | %endif |
|
100 | 100 | %if show_items: |
|
101 | 101 | <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span> |
|
102 | 102 | %endif |
|
103 | 103 | </dd> |
|
104 | 104 | |
|
105 | 105 | %if show_items: |
|
106 | 106 | <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none"> |
|
107 | 107 | %for item in show_items: |
|
108 | 108 | <dt></dt> |
|
109 | 109 | <dd>${item}</dd> |
|
110 | 110 | %endfor |
|
111 | 111 | </div> |
|
112 | 112 | %endif |
|
113 | 113 | |
|
114 | 114 | %endfor |
|
115 | 115 | </dl> |
|
116 | 116 | </%def> |
|
117 | 117 | |
|
118 | 118 | |
|
119 | 119 | <%def name="gravatar(email, size=16)"> |
|
120 | 120 | <% |
|
121 | 121 | if (size > 16): |
|
122 | 122 | gravatar_class = 'gravatar gravatar-large' |
|
123 | 123 | else: |
|
124 | 124 | gravatar_class = 'gravatar' |
|
125 | 125 | %> |
|
126 | 126 | <%doc> |
|
127 | 127 | TODO: johbo: For now we serve double size images to make it smooth |
|
128 | 128 | for retina. This is how it worked until now. Should be replaced |
|
129 | 129 | with a better solution at some point. |
|
130 | 130 | </%doc> |
|
131 | 131 | <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}"> |
|
132 | 132 | </%def> |
|
133 | 133 | |
|
134 | 134 | |
|
135 | 135 | <%def name="gravatar_with_user(contact, size=16, show_disabled=False)"> |
|
136 | 136 | <% email = h.email_or_none(contact) %> |
|
137 | 137 | <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}"> |
|
138 | 138 | ${self.gravatar(email, size)} |
|
139 | 139 | <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span> |
|
140 | 140 | </div> |
|
141 | 141 | </%def> |
|
142 | 142 | |
|
143 | 143 | |
|
144 | 144 | ## admin menu used for people that have some admin resources |
|
145 | 145 | <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)"> |
|
146 | 146 | <ul class="submenu"> |
|
147 | 147 | %if repositories: |
|
148 | 148 | <li class="local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li> |
|
149 | 149 | %endif |
|
150 | 150 | %if repository_groups: |
|
151 | 151 | <li class="local-admin-repo-groups"><a href="${h.url('repo_groups')}">${_('Repository groups')}</a></li> |
|
152 | 152 | %endif |
|
153 | 153 | %if user_groups: |
|
154 | 154 | <li class="local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li> |
|
155 | 155 | %endif |
|
156 | 156 | </ul> |
|
157 | 157 | </%def> |
|
158 | 158 | |
|
159 | 159 | <%def name="repo_page_title(repo_instance)"> |
|
160 | 160 | <div class="title-content"> |
|
161 | 161 | <div class="title-main"> |
|
162 | 162 | ## SVN/HG/GIT icons |
|
163 | 163 | %if h.is_hg(repo_instance): |
|
164 | 164 | <i class="icon-hg"></i> |
|
165 | 165 | %endif |
|
166 | 166 | %if h.is_git(repo_instance): |
|
167 | 167 | <i class="icon-git"></i> |
|
168 | 168 | %endif |
|
169 | 169 | %if h.is_svn(repo_instance): |
|
170 | 170 | <i class="icon-svn"></i> |
|
171 | 171 | %endif |
|
172 | 172 | |
|
173 | 173 | ## public/private |
|
174 | 174 | %if repo_instance.private: |
|
175 | 175 | <i class="icon-repo-private"></i> |
|
176 | 176 | %else: |
|
177 | 177 | <i class="icon-repo-public"></i> |
|
178 | 178 | %endif |
|
179 | 179 | |
|
180 | 180 | ## repo name with group name |
|
181 | 181 | ${h.breadcrumb_repo_link(c.rhodecode_db_repo)} |
|
182 | 182 | |
|
183 | 183 | </div> |
|
184 | 184 | |
|
185 | 185 | ## FORKED |
|
186 | 186 | %if repo_instance.fork: |
|
187 | 187 | <p> |
|
188 | 188 | <i class="icon-code-fork"></i> ${_('Fork of')} |
|
189 | 189 | <a href="${h.route_path('repo_summary',repo_name=repo_instance.fork.repo_name)}">${repo_instance.fork.repo_name}</a> |
|
190 | 190 | </p> |
|
191 | 191 | %endif |
|
192 | 192 | |
|
193 | 193 | ## IMPORTED FROM REMOTE |
|
194 | 194 | %if repo_instance.clone_uri: |
|
195 | 195 | <p> |
|
196 | 196 | <i class="icon-code-fork"></i> ${_('Clone from')} |
|
197 | 197 | <a href="${h.url(h.safe_str(h.hide_credentials(repo_instance.clone_uri)))}">${h.hide_credentials(repo_instance.clone_uri)}</a> |
|
198 | 198 | </p> |
|
199 | 199 | %endif |
|
200 | 200 | |
|
201 | 201 | ## LOCKING STATUS |
|
202 | 202 | %if repo_instance.locked[0]: |
|
203 | 203 | <p class="locking_locked"> |
|
204 | 204 | <i class="icon-repo-lock"></i> |
|
205 | 205 | ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}} |
|
206 | 206 | </p> |
|
207 | 207 | %elif repo_instance.enable_locking: |
|
208 | 208 | <p class="locking_unlocked"> |
|
209 | 209 | <i class="icon-repo-unlock"></i> |
|
210 | 210 | ${_('Repository not locked. Pull repository to lock it.')} |
|
211 | 211 | </p> |
|
212 | 212 | %endif |
|
213 | 213 | |
|
214 | 214 | </div> |
|
215 | 215 | </%def> |
|
216 | 216 | |
|
217 | 217 | <%def name="repo_menu(active=None)"> |
|
218 | 218 | <% |
|
219 | 219 | def is_active(selected): |
|
220 | 220 | if selected == active: |
|
221 | 221 | return "active" |
|
222 | 222 | %> |
|
223 | 223 | |
|
224 | 224 | <!--- CONTEXT BAR --> |
|
225 | 225 | <div id="context-bar"> |
|
226 | 226 | <div class="wrapper"> |
|
227 | 227 | <ul id="context-pages" class="horizontal-list navigation"> |
|
228 | 228 | <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li> |
|
229 | 229 | <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li> |
|
230 | 230 | <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li> |
|
231 | 231 | <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li> |
|
232 | 232 | ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()" |
|
233 | 233 | %if c.rhodecode_db_repo.repo_type in ['git','hg']: |
|
234 | 234 | <li class="${is_active('showpullrequest')}"> |
|
235 | 235 | <a class="menulink" href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}" title="${h.tooltip(_('Show Pull Requests for %s') % c.repo_name)}"> |
|
236 | 236 | %if c.repository_pull_requests: |
|
237 | 237 | <span class="pr_notifications">${c.repository_pull_requests}</span> |
|
238 | 238 | %endif |
|
239 | 239 | <div class="menulabel">${_('Pull Requests')}</div> |
|
240 | 240 | </a> |
|
241 | 241 | </li> |
|
242 | 242 | %endif |
|
243 | 243 | <li class="${is_active('options')}"> |
|
244 | 244 | <a class="menulink dropdown"> |
|
245 | 245 | <div class="menulabel">${_('Options')} <div class="show_more"></div></div> |
|
246 | 246 | </a> |
|
247 | 247 | <ul class="submenu"> |
|
248 | 248 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
249 | 249 | <li><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}">${_('Settings')}</a></li> |
|
250 | 250 | %endif |
|
251 | 251 | %if c.rhodecode_db_repo.fork: |
|
252 | 252 | <li> |
|
253 | 253 | <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}" |
|
254 | 254 | href="${h.route_path('repo_compare', |
|
255 | 255 | repo_name=c.rhodecode_db_repo.fork.repo_name, |
|
256 | 256 | source_ref_type=c.rhodecode_db_repo.landing_rev[0], |
|
257 | 257 | source_ref=c.rhodecode_db_repo.landing_rev[1], |
|
258 | 258 | target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0], |
|
259 | 259 | target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1], |
|
260 | 260 | _query=dict(merge=1))}" |
|
261 | 261 | > |
|
262 | 262 | ${_('Compare fork')} |
|
263 | 263 | </a> |
|
264 | 264 | </li> |
|
265 | 265 | %endif |
|
266 | 266 | |
|
267 | 267 | <li><a href="${h.route_path('search_repo',repo_name=c.repo_name)}">${_('Search')}</a></li> |
|
268 | 268 | |
|
269 | 269 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: |
|
270 | 270 | %if c.rhodecode_db_repo.locked[0]: |
|
271 | 271 | <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li> |
|
272 | 272 | %else: |
|
273 | 273 | <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li> |
|
274 | 274 | %endif |
|
275 | 275 | %endif |
|
276 | 276 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
277 | 277 | %if c.rhodecode_db_repo.repo_type in ['git','hg']: |
|
278 | 278 | <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li> |
|
279 | 279 | <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li> |
|
280 | 280 | %endif |
|
281 | 281 | %endif |
|
282 | 282 | </ul> |
|
283 | 283 | </li> |
|
284 | 284 | </ul> |
|
285 | 285 | </div> |
|
286 | 286 | <div class="clear"></div> |
|
287 | 287 | </div> |
|
288 | 288 | <!--- END CONTEXT BAR --> |
|
289 | 289 | |
|
290 | 290 | </%def> |
|
291 | 291 | |
|
292 | 292 | <%def name="usermenu(active=False)"> |
|
293 | 293 | ## USER MENU |
|
294 | 294 | <li id="quick_login_li" class="${'active' if active else ''}"> |
|
295 | 295 | <a id="quick_login_link" class="menulink childs"> |
|
296 | 296 | ${gravatar(c.rhodecode_user.email, 20)} |
|
297 | 297 | <span class="user"> |
|
298 | 298 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
299 | 299 | <span class="menu_link_user">${c.rhodecode_user.username}</span><div class="show_more"></div> |
|
300 | 300 | %else: |
|
301 | 301 | <span>${_('Sign in')}</span> |
|
302 | 302 | %endif |
|
303 | 303 | </span> |
|
304 | 304 | </a> |
|
305 | 305 | |
|
306 | 306 | <div class="user-menu submenu"> |
|
307 | 307 | <div id="quick_login"> |
|
308 | 308 | %if c.rhodecode_user.username == h.DEFAULT_USER: |
|
309 | 309 | <h4>${_('Sign in to your account')}</h4> |
|
310 | 310 | ${h.form(h.route_path('login', _query={'came_from': h.url.current()}), needs_csrf_token=False)} |
|
311 | 311 | <div class="form form-vertical"> |
|
312 | 312 | <div class="fields"> |
|
313 | 313 | <div class="field"> |
|
314 | 314 | <div class="label"> |
|
315 | 315 | <label for="username">${_('Username')}:</label> |
|
316 | 316 | </div> |
|
317 | 317 | <div class="input"> |
|
318 | 318 | ${h.text('username',class_='focus',tabindex=1)} |
|
319 | 319 | </div> |
|
320 | 320 | |
|
321 | 321 | </div> |
|
322 | 322 | <div class="field"> |
|
323 | 323 | <div class="label"> |
|
324 | 324 | <label for="password">${_('Password')}:</label> |
|
325 | 325 | %if h.HasPermissionAny('hg.password_reset.enabled')(): |
|
326 | 326 | <span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.route_path('reset_password'), class_='pwd_reset')}</span> |
|
327 | 327 | %endif |
|
328 | 328 | </div> |
|
329 | 329 | <div class="input"> |
|
330 | 330 | ${h.password('password',class_='focus',tabindex=2)} |
|
331 | 331 | </div> |
|
332 | 332 | </div> |
|
333 | 333 | <div class="buttons"> |
|
334 | 334 | <div class="register"> |
|
335 | 335 | %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): |
|
336 | 336 | ${h.link_to(_("Don't have an account?"),h.route_path('register'))} <br/> |
|
337 | 337 | %endif |
|
338 | 338 | ${h.link_to(_("Using external auth? Sign In here."),h.route_path('login'))} |
|
339 | 339 | </div> |
|
340 | 340 | <div class="submit"> |
|
341 | 341 | ${h.submit('sign_in',_('Sign In'),class_="btn btn-small",tabindex=3)} |
|
342 | 342 | </div> |
|
343 | 343 | </div> |
|
344 | 344 | </div> |
|
345 | 345 | </div> |
|
346 | 346 | ${h.end_form()} |
|
347 | 347 | %else: |
|
348 | 348 | <div class=""> |
|
349 | 349 | <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div> |
|
350 | 350 | <div class="full_name">${c.rhodecode_user.full_name_or_username}</div> |
|
351 | 351 | <div class="email">${c.rhodecode_user.email}</div> |
|
352 | 352 | </div> |
|
353 | 353 | <div class=""> |
|
354 | 354 | <ol class="links"> |
|
355 | 355 | <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li> |
|
356 | 356 | % if c.rhodecode_user.personal_repo_group: |
|
357 | 357 | <li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li> |
|
358 | 358 | % endif |
|
359 | 359 | <li class="logout"> |
|
360 | 360 | ${h.secure_form(h.route_path('logout'), request=request)} |
|
361 | 361 | ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")} |
|
362 | 362 | ${h.end_form()} |
|
363 | 363 | </li> |
|
364 | 364 | </ol> |
|
365 | 365 | </div> |
|
366 | 366 | %endif |
|
367 | 367 | </div> |
|
368 | 368 | </div> |
|
369 | 369 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
370 | 370 | <div class="pill_container"> |
|
371 | 371 | <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a> |
|
372 | 372 | </div> |
|
373 | 373 | % endif |
|
374 | 374 | </li> |
|
375 | 375 | </%def> |
|
376 | 376 | |
|
377 | 377 | <%def name="menu_items(active=None)"> |
|
378 | 378 | <% |
|
379 | 379 | def is_active(selected): |
|
380 | 380 | if selected == active: |
|
381 | 381 | return "active" |
|
382 | 382 | return "" |
|
383 | 383 | %> |
|
384 | 384 | <ul id="quick" class="main_nav navigation horizontal-list"> |
|
385 | 385 | <!-- repo switcher --> |
|
386 | 386 | <li class="${is_active('repositories')} repo_switcher_li has_select2"> |
|
387 | 387 | <input id="repo_switcher" name="repo_switcher" type="hidden"> |
|
388 | 388 | </li> |
|
389 | 389 | |
|
390 | 390 | ## ROOT MENU |
|
391 | 391 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
392 | 392 | <li class="${is_active('journal')}"> |
|
393 | 393 | <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}"> |
|
394 | 394 | <div class="menulabel">${_('Journal')}</div> |
|
395 | 395 | </a> |
|
396 | 396 | </li> |
|
397 | 397 | %else: |
|
398 | 398 | <li class="${is_active('journal')}"> |
|
399 | 399 | <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}"> |
|
400 | 400 | <div class="menulabel">${_('Public journal')}</div> |
|
401 | 401 | </a> |
|
402 | 402 | </li> |
|
403 | 403 | %endif |
|
404 | 404 | <li class="${is_active('gists')}"> |
|
405 | 405 | <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}"> |
|
406 | 406 | <div class="menulabel">${_('Gists')}</div> |
|
407 | 407 | </a> |
|
408 | 408 | </li> |
|
409 | 409 | <li class="${is_active('search')}"> |
|
410 | 410 | <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}"> |
|
411 | 411 | <div class="menulabel">${_('Search')}</div> |
|
412 | 412 | </a> |
|
413 | 413 | </li> |
|
414 | 414 | % if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
415 | 415 | <li class="${is_active('admin')}"> |
|
416 | 416 | <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;"> |
|
417 | 417 | <div class="menulabel">${_('Admin')} <div class="show_more"></div></div> |
|
418 | 418 | </a> |
|
419 | 419 | ${admin_menu()} |
|
420 | 420 | </li> |
|
421 | 421 | % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin: |
|
422 | 422 | <li class="${is_active('admin')}"> |
|
423 | 423 | <a class="menulink childs" title="${_('Delegated Admin settings')}"> |
|
424 | 424 | <div class="menulabel">${_('Admin')} <div class="show_more"></div></div> |
|
425 | 425 | </a> |
|
426 | 426 | ${admin_menu_simple(c.rhodecode_user.repositories_admin, |
|
427 | 427 | c.rhodecode_user.repository_groups_admin, |
|
428 | 428 | c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())} |
|
429 | 429 | </li> |
|
430 | 430 | % endif |
|
431 | 431 | % if c.debug_style: |
|
432 | 432 | <li class="${is_active('debug_style')}"> |
|
433 | 433 | <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}"> |
|
434 | 434 | <div class="menulabel">${_('Style')}</div> |
|
435 | 435 | </a> |
|
436 | 436 | </li> |
|
437 | 437 | % endif |
|
438 | 438 | ## render extra user menu |
|
439 | 439 | ${usermenu(active=(active=='my_account'))} |
|
440 | 440 | </ul> |
|
441 | 441 | |
|
442 | 442 | <script type="text/javascript"> |
|
443 | 443 | var visual_show_public_icon = "${c.visual.show_public_icon}" == "True"; |
|
444 | 444 | |
|
445 | 445 | /*format the look of items in the list*/ |
|
446 | 446 | var format = function(state, escapeMarkup){ |
|
447 | 447 | if (!state.id){ |
|
448 | 448 | return state.text; // optgroup |
|
449 | 449 | } |
|
450 | 450 | var obj_dict = state.obj; |
|
451 | 451 | var tmpl = ''; |
|
452 | 452 | |
|
453 | 453 | if(obj_dict && state.type == 'repo'){ |
|
454 | 454 | if(obj_dict['repo_type'] === 'hg'){ |
|
455 | 455 | tmpl += '<i class="icon-hg"></i> '; |
|
456 | 456 | } |
|
457 | 457 | else if(obj_dict['repo_type'] === 'git'){ |
|
458 | 458 | tmpl += '<i class="icon-git"></i> '; |
|
459 | 459 | } |
|
460 | 460 | else if(obj_dict['repo_type'] === 'svn'){ |
|
461 | 461 | tmpl += '<i class="icon-svn"></i> '; |
|
462 | 462 | } |
|
463 | 463 | if(obj_dict['private']){ |
|
464 | 464 | tmpl += '<i class="icon-lock" ></i> '; |
|
465 | 465 | } |
|
466 | 466 | else if(visual_show_public_icon){ |
|
467 | 467 | tmpl += '<i class="icon-unlock-alt"></i> '; |
|
468 | 468 | } |
|
469 | 469 | } |
|
470 | 470 | if(obj_dict && state.type == 'commit') { |
|
471 | 471 | tmpl += '<i class="icon-tag"></i>'; |
|
472 | 472 | } |
|
473 | 473 | if(obj_dict && state.type == 'group'){ |
|
474 | 474 | tmpl += '<i class="icon-folder-close"></i> '; |
|
475 | 475 | } |
|
476 | 476 | tmpl += escapeMarkup(state.text); |
|
477 | 477 | return tmpl; |
|
478 | 478 | }; |
|
479 | 479 | |
|
480 | 480 | var formatResult = function(result, container, query, escapeMarkup) { |
|
481 | 481 | return format(result, escapeMarkup); |
|
482 | 482 | }; |
|
483 | 483 | |
|
484 | 484 | var formatSelection = function(data, container, escapeMarkup) { |
|
485 | 485 | return format(data, escapeMarkup); |
|
486 | 486 | }; |
|
487 | 487 | |
|
488 | 488 | $("#repo_switcher").select2({ |
|
489 | 489 | cachedDataSource: {}, |
|
490 | 490 | minimumInputLength: 2, |
|
491 | 491 | placeholder: '<div class="menulabel">${_('Go to')} <div class="show_more"></div></div>', |
|
492 | 492 | dropdownAutoWidth: true, |
|
493 | 493 | formatResult: formatResult, |
|
494 | 494 | formatSelection: formatSelection, |
|
495 | 495 | containerCssClass: "repo-switcher", |
|
496 | 496 | dropdownCssClass: "repo-switcher-dropdown", |
|
497 | 497 | escapeMarkup: function(m){ |
|
498 | 498 | // don't escape our custom placeholder |
|
499 | 499 | if(m.substr(0,23) == '<div class="menulabel">'){ |
|
500 | 500 | return m; |
|
501 | 501 | } |
|
502 | 502 | |
|
503 | 503 | return Select2.util.escapeMarkup(m); |
|
504 | 504 | }, |
|
505 | 505 | query: $.debounce(250, function(query){ |
|
506 | 506 | self = this; |
|
507 | 507 | var cacheKey = query.term; |
|
508 | 508 | var cachedData = self.cachedDataSource[cacheKey]; |
|
509 | 509 | |
|
510 | 510 | if (cachedData) { |
|
511 | 511 | query.callback({results: cachedData.results}); |
|
512 | 512 | } else { |
|
513 | 513 | $.ajax({ |
|
514 | 514 | url: pyroutes.url('goto_switcher_data'), |
|
515 | 515 | data: {'query': query.term}, |
|
516 | 516 | dataType: 'json', |
|
517 | 517 | type: 'GET', |
|
518 | 518 | success: function(data) { |
|
519 | 519 | self.cachedDataSource[cacheKey] = data; |
|
520 | 520 | query.callback({results: data.results}); |
|
521 | 521 | }, |
|
522 | 522 | error: function(data, textStatus, errorThrown) { |
|
523 | 523 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); |
|
524 | 524 | } |
|
525 | 525 | }) |
|
526 | 526 | } |
|
527 | 527 | }) |
|
528 | 528 | }); |
|
529 | 529 | |
|
530 | 530 | $("#repo_switcher").on('select2-selecting', function(e){ |
|
531 | 531 | e.preventDefault(); |
|
532 | 532 | window.location = e.choice.url; |
|
533 | 533 | }); |
|
534 | 534 | |
|
535 | 535 | </script> |
|
536 | 536 | <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script> |
|
537 | 537 | </%def> |
|
538 | 538 | |
|
539 | 539 | <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
|
540 | 540 | <div class="modal-dialog"> |
|
541 | 541 | <div class="modal-content"> |
|
542 | 542 | <div class="modal-header"> |
|
543 | 543 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
|
544 | 544 | <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4> |
|
545 | 545 | </div> |
|
546 | 546 | <div class="modal-body"> |
|
547 | 547 | <div class="block-left"> |
|
548 | 548 | <table class="keyboard-mappings"> |
|
549 | 549 | <tbody> |
|
550 | 550 | <tr> |
|
551 | 551 | <th></th> |
|
552 | 552 | <th>${_('Site-wide shortcuts')}</th> |
|
553 | 553 | </tr> |
|
554 | 554 | <% |
|
555 | 555 | elems = [ |
|
556 | 556 | ('/', 'Open quick search box'), |
|
557 | 557 | ('g h', 'Goto home page'), |
|
558 | 558 | ('g g', 'Goto my private gists page'), |
|
559 | 559 | ('g G', 'Goto my public gists page'), |
|
560 | 560 | ('n r', 'New repository page'), |
|
561 | 561 | ('n g', 'New gist page'), |
|
562 | 562 | ] |
|
563 | 563 | %> |
|
564 | 564 | %for key, desc in elems: |
|
565 | 565 | <tr> |
|
566 | 566 | <td class="keys"> |
|
567 | 567 | <span class="key tag">${key}</span> |
|
568 | 568 | </td> |
|
569 | 569 | <td>${desc}</td> |
|
570 | 570 | </tr> |
|
571 | 571 | %endfor |
|
572 | 572 | </tbody> |
|
573 | 573 | </table> |
|
574 | 574 | </div> |
|
575 | 575 | <div class="block-left"> |
|
576 | 576 | <table class="keyboard-mappings"> |
|
577 | 577 | <tbody> |
|
578 | 578 | <tr> |
|
579 | 579 | <th></th> |
|
580 | 580 | <th>${_('Repositories')}</th> |
|
581 | 581 | </tr> |
|
582 | 582 | <% |
|
583 | 583 | elems = [ |
|
584 | 584 | ('g s', 'Goto summary page'), |
|
585 | 585 | ('g c', 'Goto changelog page'), |
|
586 | 586 | ('g f', 'Goto files page'), |
|
587 | 587 | ('g F', 'Goto files page with file search activated'), |
|
588 | 588 | ('g p', 'Goto pull requests page'), |
|
589 | 589 | ('g o', 'Goto repository settings'), |
|
590 | 590 | ('g O', 'Goto repository permissions settings'), |
|
591 | 591 | ] |
|
592 | 592 | %> |
|
593 | 593 | %for key, desc in elems: |
|
594 | 594 | <tr> |
|
595 | 595 | <td class="keys"> |
|
596 | 596 | <span class="key tag">${key}</span> |
|
597 | 597 | </td> |
|
598 | 598 | <td>${desc}</td> |
|
599 | 599 | </tr> |
|
600 | 600 | %endfor |
|
601 | 601 | </tbody> |
|
602 | 602 | </table> |
|
603 | 603 | </div> |
|
604 | 604 | </div> |
|
605 | 605 | <div class="modal-footer"> |
|
606 | 606 | </div> |
|
607 | 607 | </div><!-- /.modal-content --> |
|
608 | 608 | </div><!-- /.modal-dialog --> |
|
609 | 609 | </div><!-- /.modal --> |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now