Show More
@@ -1,648 +1,648 b'' | |||||
1 | """ |
|
1 | """ | |
2 | Routes configuration |
|
2 | Routes configuration | |
3 |
|
3 | |||
4 | The more specific and detailed routes should be defined first so they |
|
4 | The more specific and detailed routes should be defined first so they | |
5 | may take precedent over the more generic routes. For more information |
|
5 | may take precedent over the more generic routes. For more information | |
6 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
6 | refer to the routes manual at http://routes.groovie.org/docs/ | |
7 | """ |
|
7 | """ | |
8 | from __future__ import with_statement |
|
8 | from __future__ import with_statement | |
9 | from routes import Mapper |
|
9 | from routes import Mapper | |
10 |
|
10 | |||
11 | # prefix for non repository related links needs to be prefixed with `/` |
|
11 | # prefix for non repository related links needs to be prefixed with `/` | |
12 | ADMIN_PREFIX = '/_admin' |
|
12 | ADMIN_PREFIX = '/_admin' | |
13 |
|
13 | |||
14 |
|
14 | |||
15 | def make_map(config): |
|
15 | def make_map(config): | |
16 | """Create, configure and return the routes Mapper""" |
|
16 | """Create, configure and return the routes Mapper""" | |
17 | rmap = Mapper(directory=config['pylons.paths']['controllers'], |
|
17 | rmap = Mapper(directory=config['pylons.paths']['controllers'], | |
18 | always_scan=config['debug']) |
|
18 | always_scan=config['debug']) | |
19 | rmap.minimization = False |
|
19 | rmap.minimization = False | |
20 | rmap.explicit = False |
|
20 | rmap.explicit = False | |
21 |
|
21 | |||
22 | from rhodecode.lib.utils import is_valid_repo |
|
22 | from rhodecode.lib.utils import is_valid_repo | |
23 | from rhodecode.lib.utils import is_valid_repos_group |
|
23 | from rhodecode.lib.utils import is_valid_repos_group | |
24 |
|
24 | |||
25 | def check_repo(environ, match_dict): |
|
25 | def check_repo(environ, match_dict): | |
26 | """ |
|
26 | """ | |
27 | check for valid repository for proper 404 handling |
|
27 | check for valid repository for proper 404 handling | |
28 |
|
28 | |||
29 | :param environ: |
|
29 | :param environ: | |
30 | :param match_dict: |
|
30 | :param match_dict: | |
31 | """ |
|
31 | """ | |
32 | from rhodecode.model.db import Repository |
|
32 | from rhodecode.model.db import Repository | |
33 | repo_name = match_dict.get('repo_name') |
|
33 | repo_name = match_dict.get('repo_name') | |
34 |
|
34 | |||
35 | if match_dict.get('f_path'): |
|
35 | if match_dict.get('f_path'): | |
36 | #fix for multiple initial slashes that causes errors |
|
36 | #fix for multiple initial slashes that causes errors | |
37 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') |
|
37 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') | |
38 |
|
38 | |||
39 | try: |
|
39 | try: | |
40 | by_id = repo_name.split('_') |
|
40 | by_id = repo_name.split('_') | |
41 | if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '': |
|
41 | if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '': | |
42 | repo_name = Repository.get(by_id[1]).repo_name |
|
42 | repo_name = Repository.get(by_id[1]).repo_name | |
43 | match_dict['repo_name'] = repo_name |
|
43 | match_dict['repo_name'] = repo_name | |
44 | except: |
|
44 | except: | |
45 | pass |
|
45 | pass | |
46 |
|
46 | |||
47 | return is_valid_repo(repo_name, config['base_path']) |
|
47 | return is_valid_repo(repo_name, config['base_path']) | |
48 |
|
48 | |||
49 | def check_group(environ, match_dict): |
|
49 | def check_group(environ, match_dict): | |
50 | """ |
|
50 | """ | |
51 | check for valid repositories group for proper 404 handling |
|
51 | check for valid repositories group for proper 404 handling | |
52 |
|
52 | |||
53 | :param environ: |
|
53 | :param environ: | |
54 | :param match_dict: |
|
54 | :param match_dict: | |
55 | """ |
|
55 | """ | |
56 | repos_group_name = match_dict.get('group_name') |
|
56 | repos_group_name = match_dict.get('group_name') | |
57 | return is_valid_repos_group(repos_group_name, config['base_path']) |
|
57 | return is_valid_repos_group(repos_group_name, config['base_path']) | |
58 |
|
58 | |||
59 | def check_int(environ, match_dict): |
|
59 | def check_int(environ, match_dict): | |
60 | return match_dict.get('id').isdigit() |
|
60 | return match_dict.get('id').isdigit() | |
61 |
|
61 | |||
62 | # The ErrorController route (handles 404/500 error pages); it should |
|
62 | # The ErrorController route (handles 404/500 error pages); it should | |
63 | # likely stay at the top, ensuring it can always be resolved |
|
63 | # likely stay at the top, ensuring it can always be resolved | |
64 | rmap.connect('/error/{action}', controller='error') |
|
64 | rmap.connect('/error/{action}', controller='error') | |
65 | rmap.connect('/error/{action}/{id}', controller='error') |
|
65 | rmap.connect('/error/{action}/{id}', controller='error') | |
66 |
|
66 | |||
67 | #========================================================================== |
|
67 | #========================================================================== | |
68 | # CUSTOM ROUTES HERE |
|
68 | # CUSTOM ROUTES HERE | |
69 | #========================================================================== |
|
69 | #========================================================================== | |
70 |
|
70 | |||
71 | #MAIN PAGE |
|
71 | #MAIN PAGE | |
72 | rmap.connect('home', '/', controller='home', action='index') |
|
72 | rmap.connect('home', '/', controller='home', action='index') | |
73 | rmap.connect('repo_switcher', '/repos', controller='home', |
|
73 | rmap.connect('repo_switcher', '/repos', controller='home', | |
74 | action='repo_switcher') |
|
74 | action='repo_switcher') | |
75 | rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}', |
|
75 | rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}', | |
76 | controller='home', action='branch_tag_switcher') |
|
76 | controller='home', action='branch_tag_switcher') | |
77 | rmap.connect('bugtracker', |
|
77 | rmap.connect('bugtracker', | |
78 | "http://bitbucket.org/marcinkuzminski/rhodecode/issues", |
|
78 | "http://bitbucket.org/marcinkuzminski/rhodecode/issues", | |
79 | _static=True) |
|
79 | _static=True) | |
80 | rmap.connect('rst_help', |
|
80 | rmap.connect('rst_help', | |
81 | "http://docutils.sourceforge.net/docs/user/rst/quickref.html", |
|
81 | "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |
82 | _static=True) |
|
82 | _static=True) | |
83 | rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True) |
|
83 | rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True) | |
84 |
|
84 | |||
85 | #ADMIN REPOSITORY REST ROUTES |
|
85 | #ADMIN REPOSITORY REST ROUTES | |
86 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
86 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
87 | controller='admin/repos') as m: |
|
87 | controller='admin/repos') as m: | |
88 | m.connect("repos", "/repos", |
|
88 | m.connect("repos", "/repos", | |
89 | action="create", conditions=dict(method=["POST"])) |
|
89 | action="create", conditions=dict(method=["POST"])) | |
90 | m.connect("repos", "/repos", |
|
90 | m.connect("repos", "/repos", | |
91 | action="index", conditions=dict(method=["GET"])) |
|
91 | action="index", conditions=dict(method=["GET"])) | |
92 | m.connect("formatted_repos", "/repos.{format}", |
|
92 | m.connect("formatted_repos", "/repos.{format}", | |
93 | action="index", |
|
93 | action="index", | |
94 | conditions=dict(method=["GET"])) |
|
94 | conditions=dict(method=["GET"])) | |
95 | m.connect("new_repo", "/repos/new", |
|
95 | m.connect("new_repo", "/repos/new", | |
96 | action="new", conditions=dict(method=["GET"])) |
|
96 | action="new", conditions=dict(method=["GET"])) | |
97 | m.connect("formatted_new_repo", "/repos/new.{format}", |
|
97 | m.connect("formatted_new_repo", "/repos/new.{format}", | |
98 | action="new", conditions=dict(method=["GET"])) |
|
98 | action="new", conditions=dict(method=["GET"])) | |
99 | m.connect("/repos/{repo_name:.*?}", |
|
99 | m.connect("/repos/{repo_name:.*?}", | |
100 | action="update", conditions=dict(method=["PUT"], |
|
100 | action="update", conditions=dict(method=["PUT"], | |
101 | function=check_repo)) |
|
101 | function=check_repo)) | |
102 | m.connect("/repos/{repo_name:.*?}", |
|
102 | m.connect("/repos/{repo_name:.*?}", | |
103 | action="delete", conditions=dict(method=["DELETE"], |
|
103 | action="delete", conditions=dict(method=["DELETE"], | |
104 | function=check_repo)) |
|
104 | function=check_repo)) | |
105 | # no longer used: |
|
105 | # no longer used: | |
106 | m.connect("edit_repo_admin", "/repos/{repo_name:.*?}/edit", |
|
106 | m.connect("edit_repo_admin", "/repos/{repo_name:.*?}/edit", | |
107 | action="edit", conditions=dict(method=["GET"], |
|
107 | action="edit", conditions=dict(method=["GET"], | |
108 | function=check_repo)) |
|
108 | function=check_repo)) | |
109 | m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit", |
|
109 | m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit", | |
110 | action="edit", conditions=dict(method=["GET"], |
|
110 | action="edit", conditions=dict(method=["GET"], | |
111 | function=check_repo)) |
|
111 | function=check_repo)) | |
112 | m.connect("repo", "/repos/{repo_name:.*?}", |
|
112 | m.connect("repo", "/repos/{repo_name:.*?}", | |
113 | action="show", conditions=dict(method=["GET"], |
|
113 | action="show", conditions=dict(method=["GET"], | |
114 | function=check_repo)) |
|
114 | function=check_repo)) | |
115 | m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}", |
|
115 | m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}", | |
116 | action="show", conditions=dict(method=["GET"], |
|
116 | action="show", conditions=dict(method=["GET"], | |
117 | function=check_repo)) |
|
117 | function=check_repo)) | |
118 | #ajax delete repo perm user |
|
118 | #ajax delete repo perm user | |
119 | m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*?}", |
|
119 | m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*?}", | |
120 | action="delete_perm_user", |
|
120 | action="delete_perm_user", | |
121 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
121 | conditions=dict(method=["DELETE"], function=check_repo)) | |
122 |
|
122 | |||
123 | #ajax delete repo perm users_group |
|
123 | #ajax delete repo perm users_group | |
124 | m.connect('delete_repo_users_group', |
|
124 | m.connect('delete_repo_users_group', | |
125 | "/repos_delete_users_group/{repo_name:.*?}", |
|
125 | "/repos_delete_users_group/{repo_name:.*?}", | |
126 | action="delete_perm_users_group", |
|
126 | action="delete_perm_users_group", | |
127 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
127 | conditions=dict(method=["DELETE"], function=check_repo)) | |
128 |
|
128 | |||
129 | #settings actions |
|
129 | #settings actions | |
130 | m.connect('repo_stats', "/repos_stats/{repo_name:.*?}", |
|
130 | m.connect('repo_stats', "/repos_stats/{repo_name:.*?}", | |
131 | action="repo_stats", conditions=dict(method=["DELETE"], |
|
131 | action="repo_stats", conditions=dict(method=["DELETE"], | |
132 | function=check_repo)) |
|
132 | function=check_repo)) | |
133 | m.connect('repo_cache', "/repos_cache/{repo_name:.*?}", |
|
133 | m.connect('repo_cache', "/repos_cache/{repo_name:.*?}", | |
134 | action="repo_cache", conditions=dict(method=["DELETE"], |
|
134 | action="repo_cache", conditions=dict(method=["DELETE"], | |
135 | function=check_repo)) |
|
135 | function=check_repo)) | |
136 | m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}", |
|
136 | m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}", | |
137 | action="repo_public_journal", conditions=dict(method=["PUT"], |
|
137 | action="repo_public_journal", conditions=dict(method=["PUT"], | |
138 | function=check_repo)) |
|
138 | function=check_repo)) | |
139 | m.connect('repo_pull', "/repo_pull/{repo_name:.*?}", |
|
139 | m.connect('repo_pull', "/repo_pull/{repo_name:.*?}", | |
140 | action="repo_pull", conditions=dict(method=["PUT"], |
|
140 | action="repo_pull", conditions=dict(method=["PUT"], | |
141 | function=check_repo)) |
|
141 | function=check_repo)) | |
142 | m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}", |
|
142 | m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}", | |
143 | action="repo_as_fork", conditions=dict(method=["PUT"], |
|
143 | action="repo_as_fork", conditions=dict(method=["PUT"], | |
144 | function=check_repo)) |
|
144 | function=check_repo)) | |
145 | m.connect('repo_locking', "/repo_locking/{repo_name:.*?}", |
|
145 | m.connect('repo_locking', "/repo_locking/{repo_name:.*?}", | |
146 | action="repo_locking", conditions=dict(method=["PUT"], |
|
146 | action="repo_locking", conditions=dict(method=["PUT"], | |
147 | function=check_repo)) |
|
147 | function=check_repo)) | |
148 | #repo fields |
|
148 | #repo fields | |
149 | m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new", |
|
149 | m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new", | |
150 | action="create_repo_field", conditions=dict(method=["PUT"], |
|
150 | action="create_repo_field", conditions=dict(method=["PUT"], | |
151 | function=check_repo)) |
|
151 | function=check_repo)) | |
152 |
|
152 | |||
153 | m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}", |
|
153 | m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}", | |
154 | action="delete_repo_field", conditions=dict(method=["DELETE"], |
|
154 | action="delete_repo_field", conditions=dict(method=["DELETE"], | |
155 | function=check_repo)) |
|
155 | function=check_repo)) | |
156 |
|
156 | |||
157 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
157 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
158 | controller='admin/repos_groups') as m: |
|
158 | controller='admin/repos_groups') as m: | |
159 | m.connect("repos_groups", "/repos_groups", |
|
159 | m.connect("repos_groups", "/repos_groups", | |
160 | action="create", conditions=dict(method=["POST"])) |
|
160 | action="create", conditions=dict(method=["POST"])) | |
161 | m.connect("repos_groups", "/repos_groups", |
|
161 | m.connect("repos_groups", "/repos_groups", | |
162 | action="index", conditions=dict(method=["GET"])) |
|
162 | action="index", conditions=dict(method=["GET"])) | |
163 | m.connect("formatted_repos_groups", "/repos_groups.{format}", |
|
163 | m.connect("formatted_repos_groups", "/repos_groups.{format}", | |
164 | action="index", conditions=dict(method=["GET"])) |
|
164 | action="index", conditions=dict(method=["GET"])) | |
165 | m.connect("new_repos_group", "/repos_groups/new", |
|
165 | m.connect("new_repos_group", "/repos_groups/new", | |
166 | action="new", conditions=dict(method=["GET"])) |
|
166 | action="new", conditions=dict(method=["GET"])) | |
167 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", |
|
167 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", | |
168 | action="new", conditions=dict(method=["GET"])) |
|
168 | action="new", conditions=dict(method=["GET"])) | |
169 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", |
|
169 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", | |
170 | action="update", conditions=dict(method=["PUT"], |
|
170 | action="update", conditions=dict(method=["PUT"], | |
171 | function=check_group)) |
|
171 | function=check_group)) | |
172 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", |
|
172 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", | |
173 | action="delete", conditions=dict(method=["DELETE"], |
|
173 | action="delete", conditions=dict(method=["DELETE"], | |
174 | function=check_group)) |
|
174 | function=check_group)) | |
175 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", |
|
175 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", | |
176 | action="edit", conditions=dict(method=["GET"],)) |
|
176 | action="edit", conditions=dict(method=["GET"],)) | |
177 | m.connect("formatted_edit_repos_group", |
|
177 | m.connect("formatted_edit_repos_group", | |
178 | "/repos_groups/{group_name:.*?}.{format}/edit", |
|
178 | "/repos_groups/{group_name:.*?}.{format}/edit", | |
179 | action="edit", conditions=dict(method=["GET"], |
|
179 | action="edit", conditions=dict(method=["GET"], | |
180 | function=check_group)) |
|
180 | function=check_group)) | |
181 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", |
|
181 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", | |
182 | action="show", conditions=dict(method=["GET"], |
|
182 | action="show", conditions=dict(method=["GET"], | |
183 | function=check_group)) |
|
183 | function=check_group)) | |
184 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", |
|
184 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", | |
185 | action="show", conditions=dict(method=["GET"], |
|
185 | action="show", conditions=dict(method=["GET"], | |
186 | function=check_group)) |
|
186 | function=check_group)) | |
187 | # ajax delete repos group perm user |
|
187 | # ajax delete repos group perm user | |
188 | m.connect('delete_repos_group_user_perm', |
|
188 | m.connect('delete_repos_group_user_perm', | |
189 | "/delete_repos_group_user_perm/{group_name:.*?}", |
|
189 | "/delete_repos_group_user_perm/{group_name:.*?}", | |
190 | action="delete_repos_group_user_perm", |
|
190 | action="delete_repos_group_user_perm", | |
191 | conditions=dict(method=["DELETE"], function=check_group)) |
|
191 | conditions=dict(method=["DELETE"], function=check_group)) | |
192 |
|
192 | |||
193 | # ajax delete repos group perm users_group |
|
193 | # ajax delete repos group perm users_group | |
194 | m.connect('delete_repos_group_users_group_perm', |
|
194 | m.connect('delete_repos_group_users_group_perm', | |
195 | "/delete_repos_group_users_group_perm/{group_name:.*?}", |
|
195 | "/delete_repos_group_users_group_perm/{group_name:.*?}", | |
196 | action="delete_repos_group_users_group_perm", |
|
196 | action="delete_repos_group_users_group_perm", | |
197 | conditions=dict(method=["DELETE"], function=check_group)) |
|
197 | conditions=dict(method=["DELETE"], function=check_group)) | |
198 |
|
198 | |||
199 | #ADMIN USER REST ROUTES |
|
199 | #ADMIN USER REST ROUTES | |
200 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
200 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
201 | controller='admin/users') as m: |
|
201 | controller='admin/users') as m: | |
202 | m.connect("users", "/users", |
|
202 | m.connect("users", "/users", | |
203 | action="create", conditions=dict(method=["POST"])) |
|
203 | action="create", conditions=dict(method=["POST"])) | |
204 | m.connect("users", "/users", |
|
204 | m.connect("users", "/users", | |
205 | action="index", conditions=dict(method=["GET"])) |
|
205 | action="index", conditions=dict(method=["GET"])) | |
206 | m.connect("formatted_users", "/users.{format}", |
|
206 | m.connect("formatted_users", "/users.{format}", | |
207 | action="index", conditions=dict(method=["GET"])) |
|
207 | action="index", conditions=dict(method=["GET"])) | |
208 | m.connect("new_user", "/users/new", |
|
208 | m.connect("new_user", "/users/new", | |
209 | action="new", conditions=dict(method=["GET"])) |
|
209 | action="new", conditions=dict(method=["GET"])) | |
210 | m.connect("formatted_new_user", "/users/new.{format}", |
|
210 | m.connect("formatted_new_user", "/users/new.{format}", | |
211 | action="new", conditions=dict(method=["GET"])) |
|
211 | action="new", conditions=dict(method=["GET"])) | |
212 | m.connect("update_user", "/users/{id}", |
|
212 | m.connect("update_user", "/users/{id}", | |
213 | action="update", conditions=dict(method=["PUT"])) |
|
213 | action="update", conditions=dict(method=["PUT"])) | |
214 | m.connect("delete_user", "/users/{id}", |
|
214 | m.connect("delete_user", "/users/{id}", | |
215 | action="delete", conditions=dict(method=["DELETE"])) |
|
215 | action="delete", conditions=dict(method=["DELETE"])) | |
216 | m.connect("edit_user", "/users/{id}/edit", |
|
216 | m.connect("edit_user", "/users/{id}/edit", | |
217 | action="edit", conditions=dict(method=["GET"])) |
|
217 | action="edit", conditions=dict(method=["GET"])) | |
218 | m.connect("formatted_edit_user", |
|
218 | m.connect("formatted_edit_user", | |
219 | "/users/{id}.{format}/edit", |
|
219 | "/users/{id}.{format}/edit", | |
220 | action="edit", conditions=dict(method=["GET"])) |
|
220 | action="edit", conditions=dict(method=["GET"])) | |
221 | m.connect("user", "/users/{id}", |
|
221 | m.connect("user", "/users/{id}", | |
222 | action="show", conditions=dict(method=["GET"])) |
|
222 | action="show", conditions=dict(method=["GET"])) | |
223 | m.connect("formatted_user", "/users/{id}.{format}", |
|
223 | m.connect("formatted_user", "/users/{id}.{format}", | |
224 | action="show", conditions=dict(method=["GET"])) |
|
224 | action="show", conditions=dict(method=["GET"])) | |
225 |
|
225 | |||
226 | #EXTRAS USER ROUTES |
|
226 | #EXTRAS USER ROUTES | |
227 | m.connect("user_perm", "/users_perm/{id}", |
|
227 | m.connect("user_perm", "/users_perm/{id}", | |
228 | action="update_perm", conditions=dict(method=["PUT"])) |
|
228 | action="update_perm", conditions=dict(method=["PUT"])) | |
229 | m.connect("user_emails", "/users_emails/{id}", |
|
229 | m.connect("user_emails", "/users_emails/{id}", | |
230 | action="add_email", conditions=dict(method=["PUT"])) |
|
230 | action="add_email", conditions=dict(method=["PUT"])) | |
231 | m.connect("user_emails_delete", "/users_emails/{id}", |
|
231 | m.connect("user_emails_delete", "/users_emails/{id}", | |
232 | action="delete_email", conditions=dict(method=["DELETE"])) |
|
232 | action="delete_email", conditions=dict(method=["DELETE"])) | |
233 | m.connect("user_ips", "/users_ips/{id}", |
|
233 | m.connect("user_ips", "/users_ips/{id}", | |
234 | action="add_ip", conditions=dict(method=["PUT"])) |
|
234 | action="add_ip", conditions=dict(method=["PUT"])) | |
235 | m.connect("user_ips_delete", "/users_ips/{id}", |
|
235 | m.connect("user_ips_delete", "/users_ips/{id}", | |
236 | action="delete_ip", conditions=dict(method=["DELETE"])) |
|
236 | action="delete_ip", conditions=dict(method=["DELETE"])) | |
237 |
|
237 | |||
238 | #ADMIN USERS GROUPS REST ROUTES |
|
238 | #ADMIN USERS GROUPS REST ROUTES | |
239 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
239 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
240 | controller='admin/users_groups') as m: |
|
240 | controller='admin/users_groups') as m: | |
241 | m.connect("users_groups", "/users_groups", |
|
241 | m.connect("users_groups", "/users_groups", | |
242 | action="create", conditions=dict(method=["POST"])) |
|
242 | action="create", conditions=dict(method=["POST"])) | |
243 | m.connect("users_groups", "/users_groups", |
|
243 | m.connect("users_groups", "/users_groups", | |
244 | action="index", conditions=dict(method=["GET"])) |
|
244 | action="index", conditions=dict(method=["GET"])) | |
245 | m.connect("formatted_users_groups", "/users_groups.{format}", |
|
245 | m.connect("formatted_users_groups", "/users_groups.{format}", | |
246 | action="index", conditions=dict(method=["GET"])) |
|
246 | action="index", conditions=dict(method=["GET"])) | |
247 | m.connect("new_users_group", "/users_groups/new", |
|
247 | m.connect("new_users_group", "/users_groups/new", | |
248 | action="new", conditions=dict(method=["GET"])) |
|
248 | action="new", conditions=dict(method=["GET"])) | |
249 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", |
|
249 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", | |
250 | action="new", conditions=dict(method=["GET"])) |
|
250 | action="new", conditions=dict(method=["GET"])) | |
251 | m.connect("update_users_group", "/users_groups/{id}", |
|
251 | m.connect("update_users_group", "/users_groups/{id}", | |
252 | action="update", conditions=dict(method=["PUT"])) |
|
252 | action="update", conditions=dict(method=["PUT"])) | |
253 | m.connect("delete_users_group", "/users_groups/{id}", |
|
253 | m.connect("delete_users_group", "/users_groups/{id}", | |
254 | action="delete", conditions=dict(method=["DELETE"])) |
|
254 | action="delete", conditions=dict(method=["DELETE"])) | |
255 | m.connect("edit_users_group", "/users_groups/{id}/edit", |
|
255 | m.connect("edit_users_group", "/users_groups/{id}/edit", | |
256 | action="edit", conditions=dict(method=["GET"])) |
|
256 | action="edit", conditions=dict(method=["GET"])) | |
257 | m.connect("formatted_edit_users_group", |
|
257 | m.connect("formatted_edit_users_group", | |
258 | "/users_groups/{id}.{format}/edit", |
|
258 | "/users_groups/{id}.{format}/edit", | |
259 | action="edit", conditions=dict(method=["GET"])) |
|
259 | action="edit", conditions=dict(method=["GET"])) | |
260 | m.connect("users_group", "/users_groups/{id}", |
|
260 | m.connect("users_group", "/users_groups/{id}", | |
261 | action="show", conditions=dict(method=["GET"])) |
|
261 | action="show", conditions=dict(method=["GET"])) | |
262 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", |
|
262 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", | |
263 | action="show", conditions=dict(method=["GET"])) |
|
263 | action="show", conditions=dict(method=["GET"])) | |
264 |
|
264 | |||
265 | #EXTRAS USER ROUTES |
|
265 | #EXTRAS USER ROUTES | |
266 | m.connect("users_group_perm", "/users_groups_perm/{id}", |
|
266 | m.connect("users_group_perm", "/users_groups_perm/{id}", | |
267 | action="update_perm", conditions=dict(method=["PUT"])) |
|
267 | action="update_perm", conditions=dict(method=["PUT"])) | |
268 |
|
268 | |||
269 | #ADMIN GROUP REST ROUTES |
|
269 | #ADMIN GROUP REST ROUTES | |
270 | rmap.resource('group', 'groups', |
|
270 | rmap.resource('group', 'groups', | |
271 | controller='admin/groups', path_prefix=ADMIN_PREFIX) |
|
271 | controller='admin/groups', path_prefix=ADMIN_PREFIX) | |
272 |
|
272 | |||
273 | #ADMIN PERMISSIONS REST ROUTES |
|
273 | #ADMIN PERMISSIONS REST ROUTES | |
274 | rmap.resource('permission', 'permissions', |
|
274 | rmap.resource('permission', 'permissions', | |
275 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) |
|
275 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) | |
276 |
|
276 | |||
277 | #ADMIN DEFAULTS REST ROUTES |
|
277 | #ADMIN DEFAULTS REST ROUTES | |
278 | rmap.resource('default', 'defaults', |
|
278 | rmap.resource('default', 'defaults', | |
279 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) |
|
279 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) | |
280 |
|
280 | |||
281 | ##ADMIN LDAP SETTINGS |
|
281 | ##ADMIN LDAP SETTINGS | |
282 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, |
|
282 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, | |
283 | controller='admin/ldap_settings', action='ldap_settings', |
|
283 | controller='admin/ldap_settings', action='ldap_settings', | |
284 | conditions=dict(method=["POST"])) |
|
284 | conditions=dict(method=["POST"])) | |
285 |
|
285 | |||
286 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, |
|
286 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, | |
287 | controller='admin/ldap_settings') |
|
287 | controller='admin/ldap_settings') | |
288 |
|
288 | |||
289 | #ADMIN SETTINGS REST ROUTES |
|
289 | #ADMIN SETTINGS REST ROUTES | |
290 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
290 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
291 | controller='admin/settings') as m: |
|
291 | controller='admin/settings') as m: | |
292 | m.connect("admin_settings", "/settings", |
|
292 | m.connect("admin_settings", "/settings", | |
293 | action="create", conditions=dict(method=["POST"])) |
|
293 | action="create", conditions=dict(method=["POST"])) | |
294 | m.connect("admin_settings", "/settings", |
|
294 | m.connect("admin_settings", "/settings", | |
295 | action="index", conditions=dict(method=["GET"])) |
|
295 | action="index", conditions=dict(method=["GET"])) | |
296 | m.connect("formatted_admin_settings", "/settings.{format}", |
|
296 | m.connect("formatted_admin_settings", "/settings.{format}", | |
297 | action="index", conditions=dict(method=["GET"])) |
|
297 | action="index", conditions=dict(method=["GET"])) | |
298 | m.connect("admin_new_setting", "/settings/new", |
|
298 | m.connect("admin_new_setting", "/settings/new", | |
299 | action="new", conditions=dict(method=["GET"])) |
|
299 | action="new", conditions=dict(method=["GET"])) | |
300 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", |
|
300 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", | |
301 | action="new", conditions=dict(method=["GET"])) |
|
301 | action="new", conditions=dict(method=["GET"])) | |
302 | m.connect("/settings/{setting_id}", |
|
302 | m.connect("/settings/{setting_id}", | |
303 | action="update", conditions=dict(method=["PUT"])) |
|
303 | action="update", conditions=dict(method=["PUT"])) | |
304 | m.connect("/settings/{setting_id}", |
|
304 | m.connect("/settings/{setting_id}", | |
305 | action="delete", conditions=dict(method=["DELETE"])) |
|
305 | action="delete", conditions=dict(method=["DELETE"])) | |
306 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", |
|
306 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", | |
307 | action="edit", conditions=dict(method=["GET"])) |
|
307 | action="edit", conditions=dict(method=["GET"])) | |
308 | m.connect("formatted_admin_edit_setting", |
|
308 | m.connect("formatted_admin_edit_setting", | |
309 | "/settings/{setting_id}.{format}/edit", |
|
309 | "/settings/{setting_id}.{format}/edit", | |
310 | action="edit", conditions=dict(method=["GET"])) |
|
310 | action="edit", conditions=dict(method=["GET"])) | |
311 | m.connect("admin_setting", "/settings/{setting_id}", |
|
311 | m.connect("admin_setting", "/settings/{setting_id}", | |
312 | action="show", conditions=dict(method=["GET"])) |
|
312 | action="show", conditions=dict(method=["GET"])) | |
313 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", |
|
313 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", | |
314 | action="show", conditions=dict(method=["GET"])) |
|
314 | action="show", conditions=dict(method=["GET"])) | |
315 | m.connect("admin_settings_my_account", "/my_account", |
|
315 | m.connect("admin_settings_my_account", "/my_account", | |
316 | action="my_account", conditions=dict(method=["GET"])) |
|
316 | action="my_account", conditions=dict(method=["GET"])) | |
317 | m.connect("admin_settings_my_account_update", "/my_account_update", |
|
317 | m.connect("admin_settings_my_account_update", "/my_account_update", | |
318 | action="my_account_update", conditions=dict(method=["PUT"])) |
|
318 | action="my_account_update", conditions=dict(method=["PUT"])) | |
319 | m.connect("admin_settings_create_repository", "/create_repository", |
|
319 | m.connect("admin_settings_create_repository", "/create_repository", | |
320 | action="create_repository", conditions=dict(method=["GET"])) |
|
320 | action="create_repository", conditions=dict(method=["GET"])) | |
321 | m.connect("admin_settings_my_repos", "/my_account/repos", |
|
321 | m.connect("admin_settings_my_repos", "/my_account/repos", | |
322 | action="my_account_my_repos", conditions=dict(method=["GET"])) |
|
322 | action="my_account_my_repos", conditions=dict(method=["GET"])) | |
323 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", |
|
323 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", | |
324 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) |
|
324 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) | |
325 |
|
325 | |||
326 | #NOTIFICATION REST ROUTES |
|
326 | #NOTIFICATION REST ROUTES | |
327 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
327 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
328 | controller='admin/notifications') as m: |
|
328 | controller='admin/notifications') as m: | |
329 | m.connect("notifications", "/notifications", |
|
329 | m.connect("notifications", "/notifications", | |
330 | action="create", conditions=dict(method=["POST"])) |
|
330 | action="create", conditions=dict(method=["POST"])) | |
331 | m.connect("notifications", "/notifications", |
|
331 | m.connect("notifications", "/notifications", | |
332 | action="index", conditions=dict(method=["GET"])) |
|
332 | action="index", conditions=dict(method=["GET"])) | |
333 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", |
|
333 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", | |
334 | action="mark_all_read", conditions=dict(method=["GET"])) |
|
334 | action="mark_all_read", conditions=dict(method=["GET"])) | |
335 | m.connect("formatted_notifications", "/notifications.{format}", |
|
335 | m.connect("formatted_notifications", "/notifications.{format}", | |
336 | action="index", conditions=dict(method=["GET"])) |
|
336 | action="index", conditions=dict(method=["GET"])) | |
337 | m.connect("new_notification", "/notifications/new", |
|
337 | m.connect("new_notification", "/notifications/new", | |
338 | action="new", conditions=dict(method=["GET"])) |
|
338 | action="new", conditions=dict(method=["GET"])) | |
339 | m.connect("formatted_new_notification", "/notifications/new.{format}", |
|
339 | m.connect("formatted_new_notification", "/notifications/new.{format}", | |
340 | action="new", conditions=dict(method=["GET"])) |
|
340 | action="new", conditions=dict(method=["GET"])) | |
341 | m.connect("/notification/{notification_id}", |
|
341 | m.connect("/notification/{notification_id}", | |
342 | action="update", conditions=dict(method=["PUT"])) |
|
342 | action="update", conditions=dict(method=["PUT"])) | |
343 | m.connect("/notification/{notification_id}", |
|
343 | m.connect("/notification/{notification_id}", | |
344 | action="delete", conditions=dict(method=["DELETE"])) |
|
344 | action="delete", conditions=dict(method=["DELETE"])) | |
345 | m.connect("edit_notification", "/notification/{notification_id}/edit", |
|
345 | m.connect("edit_notification", "/notification/{notification_id}/edit", | |
346 | action="edit", conditions=dict(method=["GET"])) |
|
346 | action="edit", conditions=dict(method=["GET"])) | |
347 | m.connect("formatted_edit_notification", |
|
347 | m.connect("formatted_edit_notification", | |
348 | "/notification/{notification_id}.{format}/edit", |
|
348 | "/notification/{notification_id}.{format}/edit", | |
349 | action="edit", conditions=dict(method=["GET"])) |
|
349 | action="edit", conditions=dict(method=["GET"])) | |
350 | m.connect("notification", "/notification/{notification_id}", |
|
350 | m.connect("notification", "/notification/{notification_id}", | |
351 | action="show", conditions=dict(method=["GET"])) |
|
351 | action="show", conditions=dict(method=["GET"])) | |
352 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", |
|
352 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", | |
353 | action="show", conditions=dict(method=["GET"])) |
|
353 | action="show", conditions=dict(method=["GET"])) | |
354 |
|
354 | |||
355 | #ADMIN MAIN PAGES |
|
355 | #ADMIN MAIN PAGES | |
356 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
356 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
357 | controller='admin/admin') as m: |
|
357 | controller='admin/admin') as m: | |
358 | m.connect('admin_home', '', action='index') |
|
358 | m.connect('admin_home', '', action='index') | |
359 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
359 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
360 | action='add_repo') |
|
360 | action='add_repo') | |
361 |
|
361 | |||
362 | #========================================================================== |
|
362 | #========================================================================== | |
363 | # API V2 |
|
363 | # API V2 | |
364 | #========================================================================== |
|
364 | #========================================================================== | |
365 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
365 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
366 | controller='api/api') as m: |
|
366 | controller='api/api') as m: | |
367 | m.connect('api', '/api') |
|
367 | m.connect('api', '/api') | |
368 |
|
368 | |||
369 | #USER JOURNAL |
|
369 | #USER JOURNAL | |
370 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, |
|
370 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, | |
371 | controller='journal', action='index') |
|
371 | controller='journal', action='index') | |
372 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, |
|
372 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, | |
373 | controller='journal', action='journal_rss') |
|
373 | controller='journal', action='journal_rss') | |
374 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, |
|
374 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, | |
375 | controller='journal', action='journal_atom') |
|
375 | controller='journal', action='journal_atom') | |
376 |
|
376 | |||
377 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, |
|
377 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, | |
378 | controller='journal', action="public_journal") |
|
378 | controller='journal', action="public_journal") | |
379 |
|
379 | |||
380 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, |
|
380 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, | |
381 | controller='journal', action="public_journal_rss") |
|
381 | controller='journal', action="public_journal_rss") | |
382 |
|
382 | |||
383 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, |
|
383 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, | |
384 | controller='journal', action="public_journal_rss") |
|
384 | controller='journal', action="public_journal_rss") | |
385 |
|
385 | |||
386 | rmap.connect('public_journal_atom', |
|
386 | rmap.connect('public_journal_atom', | |
387 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', |
|
387 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', | |
388 | action="public_journal_atom") |
|
388 | action="public_journal_atom") | |
389 |
|
389 | |||
390 | rmap.connect('public_journal_atom_old', |
|
390 | rmap.connect('public_journal_atom_old', | |
391 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', |
|
391 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', | |
392 | action="public_journal_atom") |
|
392 | action="public_journal_atom") | |
393 |
|
393 | |||
394 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, |
|
394 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, | |
395 | controller='journal', action='toggle_following', |
|
395 | controller='journal', action='toggle_following', | |
396 | conditions=dict(method=["POST"])) |
|
396 | conditions=dict(method=["POST"])) | |
397 |
|
397 | |||
398 | #SEARCH |
|
398 | #SEARCH | |
399 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) |
|
399 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) | |
400 | rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX, |
|
400 | rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX, | |
401 | controller='search', |
|
401 | controller='search', | |
402 | conditions=dict(function=check_repo)) |
|
402 | conditions=dict(function=check_repo)) | |
403 | rmap.connect('search_repo', '/{repo_name:.*?}/search', |
|
403 | rmap.connect('search_repo', '/{repo_name:.*?}/search', | |
404 | controller='search', |
|
404 | controller='search', | |
405 | conditions=dict(function=check_repo), |
|
405 | conditions=dict(function=check_repo), | |
406 | ) |
|
406 | ) | |
407 |
|
407 | |||
408 | #LOGIN/LOGOUT/REGISTER/SIGN IN |
|
408 | #LOGIN/LOGOUT/REGISTER/SIGN IN | |
409 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') |
|
409 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') | |
410 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', |
|
410 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', | |
411 | action='logout') |
|
411 | action='logout') | |
412 |
|
412 | |||
413 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', |
|
413 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', | |
414 | action='register') |
|
414 | action='register') | |
415 |
|
415 | |||
416 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, |
|
416 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, | |
417 | controller='login', action='password_reset') |
|
417 | controller='login', action='password_reset') | |
418 |
|
418 | |||
419 | rmap.connect('reset_password_confirmation', |
|
419 | rmap.connect('reset_password_confirmation', | |
420 | '%s/password_reset_confirmation' % ADMIN_PREFIX, |
|
420 | '%s/password_reset_confirmation' % ADMIN_PREFIX, | |
421 | controller='login', action='password_reset_confirmation') |
|
421 | controller='login', action='password_reset_confirmation') | |
422 |
|
422 | |||
423 | #FEEDS |
|
423 | #FEEDS | |
424 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', |
|
424 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', | |
425 | controller='feed', action='rss', |
|
425 | controller='feed', action='rss', | |
426 | conditions=dict(function=check_repo)) |
|
426 | conditions=dict(function=check_repo)) | |
427 |
|
427 | |||
428 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', |
|
428 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', | |
429 | controller='feed', action='atom', |
|
429 | controller='feed', action='atom', | |
430 | conditions=dict(function=check_repo)) |
|
430 | conditions=dict(function=check_repo)) | |
431 |
|
431 | |||
432 | #========================================================================== |
|
432 | #========================================================================== | |
433 | # REPOSITORY ROUTES |
|
433 | # REPOSITORY ROUTES | |
434 | #========================================================================== |
|
434 | #========================================================================== | |
435 | rmap.connect('summary_home', '/{repo_name:.*?}', |
|
435 | rmap.connect('summary_home', '/{repo_name:.*?}', | |
436 | controller='summary', |
|
436 | controller='summary', | |
437 | conditions=dict(function=check_repo)) |
|
437 | conditions=dict(function=check_repo)) | |
438 |
|
438 | |||
439 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', |
|
439 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', | |
440 | controller='summary', action='repo_size', |
|
440 | controller='summary', action='repo_size', | |
441 | conditions=dict(function=check_repo)) |
|
441 | conditions=dict(function=check_repo)) | |
442 |
|
442 | |||
443 | rmap.connect('repos_group_home', '/{group_name:.*}', |
|
443 | rmap.connect('repos_group_home', '/{group_name:.*}', | |
444 | controller='admin/repos_groups', action="show_by_name", |
|
444 | controller='admin/repos_groups', action="show_by_name", | |
445 | conditions=dict(function=check_group)) |
|
445 | conditions=dict(function=check_group)) | |
446 |
|
446 | |||
447 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', |
|
447 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', | |
448 | controller='changeset', revision='tip', |
|
448 | controller='changeset', revision='tip', | |
449 | conditions=dict(function=check_repo)) |
|
449 | conditions=dict(function=check_repo)) | |
450 |
|
450 | |||
451 | rmap.connect("edit_repo", "/{repo_name:.*?}/edit", |
|
451 | rmap.connect("edit_repo", "/{repo_name:.*?}/edit", | |
452 | controller='admin/repos', action="edit", |
|
452 | controller='admin/repos', action="edit", | |
453 | conditions=dict(method=["GET"], function=check_repo) |
|
453 | conditions=dict(method=["GET"], function=check_repo) | |
454 | ) |
|
454 | ) | |
455 |
|
455 | |||
456 | #still working url for backward compat. |
|
456 | #still working url for backward compat. | |
457 | rmap.connect('raw_changeset_home_depraced', |
|
457 | rmap.connect('raw_changeset_home_depraced', | |
458 | '/{repo_name:.*?}/raw-changeset/{revision}', |
|
458 | '/{repo_name:.*?}/raw-changeset/{revision}', | |
459 | controller='changeset', action='changeset_raw', |
|
459 | controller='changeset', action='changeset_raw', | |
460 | revision='tip', conditions=dict(function=check_repo)) |
|
460 | revision='tip', conditions=dict(function=check_repo)) | |
461 |
|
461 | |||
462 | ## new URLs |
|
462 | ## new URLs | |
463 | rmap.connect('changeset_raw_home', |
|
463 | rmap.connect('changeset_raw_home', | |
464 | '/{repo_name:.*?}/changeset-diff/{revision}', |
|
464 | '/{repo_name:.*?}/changeset-diff/{revision}', | |
465 | controller='changeset', action='changeset_raw', |
|
465 | controller='changeset', action='changeset_raw', | |
466 | revision='tip', conditions=dict(function=check_repo)) |
|
466 | revision='tip', conditions=dict(function=check_repo)) | |
467 |
|
467 | |||
468 | rmap.connect('changeset_patch_home', |
|
468 | rmap.connect('changeset_patch_home', | |
469 | '/{repo_name:.*?}/changeset-patch/{revision}', |
|
469 | '/{repo_name:.*?}/changeset-patch/{revision}', | |
470 | controller='changeset', action='changeset_patch', |
|
470 | controller='changeset', action='changeset_patch', | |
471 | revision='tip', conditions=dict(function=check_repo)) |
|
471 | revision='tip', conditions=dict(function=check_repo)) | |
472 |
|
472 | |||
473 | rmap.connect('changeset_download_home', |
|
473 | rmap.connect('changeset_download_home', | |
474 | '/{repo_name:.*?}/changeset-download/{revision}', |
|
474 | '/{repo_name:.*?}/changeset-download/{revision}', | |
475 | controller='changeset', action='changeset_download', |
|
475 | controller='changeset', action='changeset_download', | |
476 | revision='tip', conditions=dict(function=check_repo)) |
|
476 | revision='tip', conditions=dict(function=check_repo)) | |
477 |
|
477 | |||
478 | rmap.connect('changeset_comment', |
|
478 | rmap.connect('changeset_comment', | |
479 | '/{repo_name:.*?}/changeset/{revision}/comment', |
|
479 | '/{repo_name:.*?}/changeset/{revision}/comment', | |
480 | controller='changeset', revision='tip', action='comment', |
|
480 | controller='changeset', revision='tip', action='comment', | |
481 | conditions=dict(function=check_repo)) |
|
481 | conditions=dict(function=check_repo)) | |
482 |
|
482 | |||
483 | rmap.connect('changeset_comment_delete', |
|
483 | rmap.connect('changeset_comment_delete', | |
484 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', |
|
484 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', | |
485 | controller='changeset', action='delete_comment', |
|
485 | controller='changeset', action='delete_comment', | |
486 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
486 | conditions=dict(function=check_repo, method=["DELETE"])) | |
487 |
|
487 | |||
488 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', |
|
488 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', | |
489 | controller='changeset', action='changeset_info') |
|
489 | controller='changeset', action='changeset_info') | |
490 |
|
490 | |||
491 | rmap.connect('compare_url', |
|
491 | rmap.connect('compare_url', | |
492 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', |
|
492 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', | |
493 | controller='compare', action='index', |
|
493 | controller='compare', action='index', | |
494 | conditions=dict(function=check_repo), |
|
494 | conditions=dict(function=check_repo), | |
495 | requirements=dict( |
|
495 | requirements=dict( | |
496 | org_ref_type='(branch|book|tag|rev|org_ref_type)', |
|
496 | org_ref_type='(branch|book|tag|rev|__org_ref_type__)', | |
497 | other_ref_type='(branch|book|tag|rev|other_ref_type)') |
|
497 | other_ref_type='(branch|book|tag|rev|__other_ref_type__)') | |
498 | ) |
|
498 | ) | |
499 |
|
499 | |||
500 | rmap.connect('pullrequest_home', |
|
500 | rmap.connect('pullrequest_home', | |
501 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
501 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
502 | action='index', conditions=dict(function=check_repo, |
|
502 | action='index', conditions=dict(function=check_repo, | |
503 | method=["GET"])) |
|
503 | method=["GET"])) | |
504 |
|
504 | |||
505 | rmap.connect('pullrequest', |
|
505 | rmap.connect('pullrequest', | |
506 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
506 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
507 | action='create', conditions=dict(function=check_repo, |
|
507 | action='create', conditions=dict(function=check_repo, | |
508 | method=["POST"])) |
|
508 | method=["POST"])) | |
509 |
|
509 | |||
510 | rmap.connect('pullrequest_show', |
|
510 | rmap.connect('pullrequest_show', | |
511 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
511 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
512 | controller='pullrequests', |
|
512 | controller='pullrequests', | |
513 | action='show', conditions=dict(function=check_repo, |
|
513 | action='show', conditions=dict(function=check_repo, | |
514 | method=["GET"])) |
|
514 | method=["GET"])) | |
515 | rmap.connect('pullrequest_update', |
|
515 | rmap.connect('pullrequest_update', | |
516 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
516 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
517 | controller='pullrequests', |
|
517 | controller='pullrequests', | |
518 | action='update', conditions=dict(function=check_repo, |
|
518 | action='update', conditions=dict(function=check_repo, | |
519 | method=["PUT"])) |
|
519 | method=["PUT"])) | |
520 | rmap.connect('pullrequest_delete', |
|
520 | rmap.connect('pullrequest_delete', | |
521 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
521 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
522 | controller='pullrequests', |
|
522 | controller='pullrequests', | |
523 | action='delete', conditions=dict(function=check_repo, |
|
523 | action='delete', conditions=dict(function=check_repo, | |
524 | method=["DELETE"])) |
|
524 | method=["DELETE"])) | |
525 |
|
525 | |||
526 | rmap.connect('pullrequest_show_all', |
|
526 | rmap.connect('pullrequest_show_all', | |
527 | '/{repo_name:.*?}/pull-request', |
|
527 | '/{repo_name:.*?}/pull-request', | |
528 | controller='pullrequests', |
|
528 | controller='pullrequests', | |
529 | action='show_all', conditions=dict(function=check_repo, |
|
529 | action='show_all', conditions=dict(function=check_repo, | |
530 | method=["GET"])) |
|
530 | method=["GET"])) | |
531 |
|
531 | |||
532 | rmap.connect('pullrequest_comment', |
|
532 | rmap.connect('pullrequest_comment', | |
533 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', |
|
533 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', | |
534 | controller='pullrequests', |
|
534 | controller='pullrequests', | |
535 | action='comment', conditions=dict(function=check_repo, |
|
535 | action='comment', conditions=dict(function=check_repo, | |
536 | method=["POST"])) |
|
536 | method=["POST"])) | |
537 |
|
537 | |||
538 | rmap.connect('pullrequest_comment_delete', |
|
538 | rmap.connect('pullrequest_comment_delete', | |
539 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', |
|
539 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', | |
540 | controller='pullrequests', action='delete_comment', |
|
540 | controller='pullrequests', action='delete_comment', | |
541 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
541 | conditions=dict(function=check_repo, method=["DELETE"])) | |
542 |
|
542 | |||
543 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', |
|
543 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', | |
544 | controller='summary', conditions=dict(function=check_repo)) |
|
544 | controller='summary', conditions=dict(function=check_repo)) | |
545 |
|
545 | |||
546 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', |
|
546 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', | |
547 | controller='shortlog', conditions=dict(function=check_repo)) |
|
547 | controller='shortlog', conditions=dict(function=check_repo)) | |
548 |
|
548 | |||
549 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', |
|
549 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', | |
550 | controller='shortlog', f_path=None, |
|
550 | controller='shortlog', f_path=None, | |
551 | conditions=dict(function=check_repo)) |
|
551 | conditions=dict(function=check_repo)) | |
552 |
|
552 | |||
553 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', |
|
553 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', | |
554 | controller='branches', conditions=dict(function=check_repo)) |
|
554 | controller='branches', conditions=dict(function=check_repo)) | |
555 |
|
555 | |||
556 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', |
|
556 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', | |
557 | controller='tags', conditions=dict(function=check_repo)) |
|
557 | controller='tags', conditions=dict(function=check_repo)) | |
558 |
|
558 | |||
559 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', |
|
559 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', | |
560 | controller='bookmarks', conditions=dict(function=check_repo)) |
|
560 | controller='bookmarks', conditions=dict(function=check_repo)) | |
561 |
|
561 | |||
562 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', |
|
562 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', | |
563 | controller='changelog', conditions=dict(function=check_repo)) |
|
563 | controller='changelog', conditions=dict(function=check_repo)) | |
564 |
|
564 | |||
565 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', |
|
565 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', | |
566 | controller='changelog', action='changelog_details', |
|
566 | controller='changelog', action='changelog_details', | |
567 | conditions=dict(function=check_repo)) |
|
567 | conditions=dict(function=check_repo)) | |
568 |
|
568 | |||
569 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', |
|
569 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', | |
570 | controller='files', revision='tip', f_path='', |
|
570 | controller='files', revision='tip', f_path='', | |
571 | conditions=dict(function=check_repo)) |
|
571 | conditions=dict(function=check_repo)) | |
572 |
|
572 | |||
573 | rmap.connect('files_history_home', |
|
573 | rmap.connect('files_history_home', | |
574 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', |
|
574 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', | |
575 | controller='files', action='history', revision='tip', f_path='', |
|
575 | controller='files', action='history', revision='tip', f_path='', | |
576 | conditions=dict(function=check_repo)) |
|
576 | conditions=dict(function=check_repo)) | |
577 |
|
577 | |||
578 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', |
|
578 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', | |
579 | controller='files', action='diff', revision='tip', f_path='', |
|
579 | controller='files', action='diff', revision='tip', f_path='', | |
580 | conditions=dict(function=check_repo)) |
|
580 | conditions=dict(function=check_repo)) | |
581 |
|
581 | |||
582 | rmap.connect('files_rawfile_home', |
|
582 | rmap.connect('files_rawfile_home', | |
583 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', |
|
583 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', | |
584 | controller='files', action='rawfile', revision='tip', |
|
584 | controller='files', action='rawfile', revision='tip', | |
585 | f_path='', conditions=dict(function=check_repo)) |
|
585 | f_path='', conditions=dict(function=check_repo)) | |
586 |
|
586 | |||
587 | rmap.connect('files_raw_home', |
|
587 | rmap.connect('files_raw_home', | |
588 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', |
|
588 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', | |
589 | controller='files', action='raw', revision='tip', f_path='', |
|
589 | controller='files', action='raw', revision='tip', f_path='', | |
590 | conditions=dict(function=check_repo)) |
|
590 | conditions=dict(function=check_repo)) | |
591 |
|
591 | |||
592 | rmap.connect('files_annotate_home', |
|
592 | rmap.connect('files_annotate_home', | |
593 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', |
|
593 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', | |
594 | controller='files', action='index', revision='tip', |
|
594 | controller='files', action='index', revision='tip', | |
595 | f_path='', annotate=True, conditions=dict(function=check_repo)) |
|
595 | f_path='', annotate=True, conditions=dict(function=check_repo)) | |
596 |
|
596 | |||
597 | rmap.connect('files_edit_home', |
|
597 | rmap.connect('files_edit_home', | |
598 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', |
|
598 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', | |
599 | controller='files', action='edit', revision='tip', |
|
599 | controller='files', action='edit', revision='tip', | |
600 | f_path='', conditions=dict(function=check_repo)) |
|
600 | f_path='', conditions=dict(function=check_repo)) | |
601 |
|
601 | |||
602 | rmap.connect('files_add_home', |
|
602 | rmap.connect('files_add_home', | |
603 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', |
|
603 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', | |
604 | controller='files', action='add', revision='tip', |
|
604 | controller='files', action='add', revision='tip', | |
605 | f_path='', conditions=dict(function=check_repo)) |
|
605 | f_path='', conditions=dict(function=check_repo)) | |
606 |
|
606 | |||
607 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', |
|
607 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', | |
608 | controller='files', action='archivefile', |
|
608 | controller='files', action='archivefile', | |
609 | conditions=dict(function=check_repo)) |
|
609 | conditions=dict(function=check_repo)) | |
610 |
|
610 | |||
611 | rmap.connect('files_nodelist_home', |
|
611 | rmap.connect('files_nodelist_home', | |
612 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', |
|
612 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', | |
613 | controller='files', action='nodelist', |
|
613 | controller='files', action='nodelist', | |
614 | conditions=dict(function=check_repo)) |
|
614 | conditions=dict(function=check_repo)) | |
615 |
|
615 | |||
616 | rmap.connect('repo_settings_delete', '/{repo_name:.*?}/settings', |
|
616 | rmap.connect('repo_settings_delete', '/{repo_name:.*?}/settings', | |
617 | controller='settings', action="delete", |
|
617 | controller='settings', action="delete", | |
618 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
618 | conditions=dict(method=["DELETE"], function=check_repo)) | |
619 |
|
619 | |||
620 | rmap.connect('repo_settings_update', '/{repo_name:.*?}/settings', |
|
620 | rmap.connect('repo_settings_update', '/{repo_name:.*?}/settings', | |
621 | controller='settings', action="update", |
|
621 | controller='settings', action="update", | |
622 | conditions=dict(method=["PUT"], function=check_repo)) |
|
622 | conditions=dict(method=["PUT"], function=check_repo)) | |
623 |
|
623 | |||
624 | rmap.connect('repo_settings_home', '/{repo_name:.*?}/settings', |
|
624 | rmap.connect('repo_settings_home', '/{repo_name:.*?}/settings', | |
625 | controller='settings', action='index', |
|
625 | controller='settings', action='index', | |
626 | conditions=dict(function=check_repo)) |
|
626 | conditions=dict(function=check_repo)) | |
627 |
|
627 | |||
628 | rmap.connect('toggle_locking', "/{repo_name:.*?}/locking_toggle", |
|
628 | rmap.connect('toggle_locking', "/{repo_name:.*?}/locking_toggle", | |
629 | controller='settings', action="toggle_locking", |
|
629 | controller='settings', action="toggle_locking", | |
630 | conditions=dict(method=["GET"], function=check_repo)) |
|
630 | conditions=dict(method=["GET"], function=check_repo)) | |
631 |
|
631 | |||
632 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', |
|
632 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', | |
633 | controller='forks', action='fork_create', |
|
633 | controller='forks', action='fork_create', | |
634 | conditions=dict(function=check_repo, method=["POST"])) |
|
634 | conditions=dict(function=check_repo, method=["POST"])) | |
635 |
|
635 | |||
636 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', |
|
636 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', | |
637 | controller='forks', action='fork', |
|
637 | controller='forks', action='fork', | |
638 | conditions=dict(function=check_repo)) |
|
638 | conditions=dict(function=check_repo)) | |
639 |
|
639 | |||
640 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', |
|
640 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', | |
641 | controller='forks', action='forks', |
|
641 | controller='forks', action='forks', | |
642 | conditions=dict(function=check_repo)) |
|
642 | conditions=dict(function=check_repo)) | |
643 |
|
643 | |||
644 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', |
|
644 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', | |
645 | controller='followers', action='followers', |
|
645 | controller='followers', action='followers', | |
646 | conditions=dict(function=check_repo)) |
|
646 | conditions=dict(function=check_repo)) | |
647 |
|
647 | |||
648 | return rmap |
|
648 | return rmap |
@@ -1,204 +1,199 b'' | |||||
1 | <%inherit file="/base/base.html"/> |
|
1 | <%inherit file="/base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${c.repo_name} ${_('New pull request')} |
|
4 | ${c.repo_name} ${_('New pull request')} | |
5 | </%def> |
|
5 | </%def> | |
6 |
|
6 | |||
7 | <%def name="breadcrumbs_links()"> |
|
7 | <%def name="breadcrumbs_links()"> | |
8 | ${h.link_to(_(u'Home'),h.url('/'))} |
|
8 | ${h.link_to(_(u'Home'),h.url('/'))} | |
9 | » |
|
9 | » | |
10 | ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))} |
|
10 | ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))} | |
11 | » |
|
11 | » | |
12 | ${_('New pull request')} |
|
12 | ${_('New pull request')} | |
13 | </%def> |
|
13 | </%def> | |
14 |
|
14 | |||
15 | <%def name="main()"> |
|
15 | <%def name="main()"> | |
16 |
|
16 | |||
17 | <div class="box"> |
|
17 | <div class="box"> | |
18 | <!-- box / title --> |
|
18 | <!-- box / title --> | |
19 | <div class="title"> |
|
19 | <div class="title"> | |
20 | ${self.breadcrumbs()} |
|
20 | ${self.breadcrumbs()} | |
21 | </div> |
|
21 | </div> | |
22 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} |
|
22 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} | |
23 | <div style="float:left;padding:0px 30px 30px 30px"> |
|
23 | <div style="float:left;padding:0px 30px 30px 30px"> | |
24 | <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" /> |
|
24 | <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" /> | |
25 | <input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" /> |
|
25 | <input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" /> | |
26 |
|
26 | |||
27 | ##ORG |
|
27 | ##ORG | |
28 | <div style="float:left"> |
|
28 | <div style="float:left"> | |
29 | <div class="fork_user"> |
|
29 | <div class="fork_user"> | |
30 | <div class="gravatar"> |
|
30 | <div class="gravatar"> | |
31 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> |
|
31 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> | |
32 | </div> |
|
32 | </div> | |
33 | <span style="font-size: 20px"> |
|
33 | <span style="font-size: 20px"> | |
34 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')} |
|
34 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')} | |
35 | </span> |
|
35 | </span> | |
36 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> |
|
36 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> | |
37 | </div> |
|
37 | </div> | |
38 | <div style="clear:both;padding-top: 10px"></div> |
|
38 | <div style="clear:both;padding-top: 10px"></div> | |
39 | </div> |
|
39 | </div> | |
40 | <div style="float:left;font-size:24px;padding:0px 20px"> |
|
40 | <div style="float:left;font-size:24px;padding:0px 20px"> | |
41 | <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/> |
|
41 | <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/> | |
42 | </div> |
|
42 | </div> | |
43 |
|
43 | |||
44 | ##OTHER, most Probably the PARENT OF THIS FORK |
|
44 | ##OTHER, most Probably the PARENT OF THIS FORK | |
45 | <div style="float:left"> |
|
45 | <div style="float:left"> | |
46 | <div class="fork_user"> |
|
46 | <div class="fork_user"> | |
47 | <div class="gravatar"> |
|
47 | <div class="gravatar"> | |
48 | <img id="other_repo_gravatar" alt="gravatar" src=""/> |
|
48 | <img id="other_repo_gravatar" alt="gravatar" src=""/> | |
49 | </div> |
|
49 | </div> | |
50 | <span style="font-size: 20px"> |
|
50 | <span style="font-size: 20px"> | |
51 | ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_pull_request_rev,c.default_revs,class_='refs')} |
|
51 | ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_pull_request_rev,c.default_revs,class_='refs')} | |
52 | </span> |
|
52 | </span> | |
53 | <span style="padding:3px"> |
|
53 | <span style="padding:3px"> | |
54 | <a id="refresh" href="#" class="tooltip" title="${h.tooltip(_('refresh overview'))}"> |
|
54 | <a id="refresh" href="#" class="tooltip" title="${h.tooltip(_('refresh overview'))}"> | |
55 | <img style="margin:3px" class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/> |
|
55 | <img style="margin:3px" class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/> | |
56 | </a> |
|
56 | </a> | |
57 | </span> |
|
57 | </span> | |
58 | <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div> |
|
58 | <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div> | |
59 | </div> |
|
59 | </div> | |
60 | <div style="clear:both;padding-top: 10px"></div> |
|
60 | <div style="clear:both;padding-top: 10px"></div> | |
61 | </div> |
|
61 | </div> | |
62 | <div style="clear:both;padding-top: 10px"></div> |
|
62 | <div style="clear:both;padding-top: 10px"></div> | |
63 | ## overview pulled by ajax |
|
63 | ## overview pulled by ajax | |
64 | <div style="float:left" id="pull_request_overview"></div> |
|
64 | <div style="float:left" id="pull_request_overview"></div> | |
65 | <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> |
|
65 | <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> | |
66 | <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> |
|
66 | <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> | |
67 | </div> |
|
67 | </div> | |
68 | </div> |
|
68 | </div> | |
69 | <div style="float:left; border-left:1px dashed #eee"> |
|
69 | <div style="float:left; border-left:1px dashed #eee"> | |
70 | <h4>${_('Pull request reviewers')}</h4> |
|
70 | <h4>${_('Pull request reviewers')}</h4> | |
71 | <div id="reviewers" style="padding:0px 0px 0px 15px"> |
|
71 | <div id="reviewers" style="padding:0px 0px 0px 15px"> | |
72 | ## members goes here ! |
|
72 | ## members goes here ! | |
73 | <div class="group_members_wrap"> |
|
73 | <div class="group_members_wrap"> | |
74 | <ul id="review_members" class="group_members"> |
|
74 | <ul id="review_members" class="group_members"> | |
75 | %for member in c.review_members: |
|
75 | %for member in c.review_members: | |
76 | <li id="reviewer_${member.user_id}"> |
|
76 | <li id="reviewer_${member.user_id}"> | |
77 | <div class="reviewers_member"> |
|
77 | <div class="reviewers_member"> | |
78 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div> |
|
78 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div> | |
79 | <div style="float:left">${member.full_name} (${_('owner')})</div> |
|
79 | <div style="float:left">${member.full_name} (${_('owner')})</div> | |
80 | <input type="hidden" value="${member.user_id}" name="review_members" /> |
|
80 | <input type="hidden" value="${member.user_id}" name="review_members" /> | |
81 | <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span> |
|
81 | <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span> | |
82 | </div> |
|
82 | </div> | |
83 | </li> |
|
83 | </li> | |
84 | %endfor |
|
84 | %endfor | |
85 | </ul> |
|
85 | </ul> | |
86 | </div> |
|
86 | </div> | |
87 |
|
87 | |||
88 | <div class='ac'> |
|
88 | <div class='ac'> | |
89 | <div class="reviewer_ac"> |
|
89 | <div class="reviewer_ac"> | |
90 | ${h.text('user', class_='yui-ac-input')} |
|
90 | ${h.text('user', class_='yui-ac-input')} | |
91 | <span class="help-block">${_('Add reviewer to this pull request.')}</span> |
|
91 | <span class="help-block">${_('Add reviewer to this pull request.')}</span> | |
92 | <div id="reviewers_container"></div> |
|
92 | <div id="reviewers_container"></div> | |
93 | </div> |
|
93 | </div> | |
94 | </div> |
|
94 | </div> | |
95 | </div> |
|
95 | </div> | |
96 | </div> |
|
96 | </div> | |
97 | <h3>${_('Create new pull request')}</h3> |
|
97 | <h3>${_('Create new pull request')}</h3> | |
98 |
|
98 | |||
99 | <div class="form"> |
|
99 | <div class="form"> | |
100 | <!-- fields --> |
|
100 | <!-- fields --> | |
101 |
|
101 | |||
102 | <div class="fields"> |
|
102 | <div class="fields"> | |
103 |
|
103 | |||
104 | <div class="field"> |
|
104 | <div class="field"> | |
105 | <div class="label"> |
|
105 | <div class="label"> | |
106 | <label for="pullrequest_title">${_('Title')}:</label> |
|
106 | <label for="pullrequest_title">${_('Title')}:</label> | |
107 | </div> |
|
107 | </div> | |
108 | <div class="input"> |
|
108 | <div class="input"> | |
109 | ${h.text('pullrequest_title',size=30)} |
|
109 | ${h.text('pullrequest_title',size=30)} | |
110 | </div> |
|
110 | </div> | |
111 | </div> |
|
111 | </div> | |
112 |
|
112 | |||
113 | <div class="field"> |
|
113 | <div class="field"> | |
114 | <div class="label label-textarea"> |
|
114 | <div class="label label-textarea"> | |
115 | <label for="pullrequest_desc">${_('description')}:</label> |
|
115 | <label for="pullrequest_desc">${_('description')}:</label> | |
116 | </div> |
|
116 | </div> | |
117 | <div class="textarea text-area editor"> |
|
117 | <div class="textarea text-area editor"> | |
118 | ${h.textarea('pullrequest_desc',size=30)} |
|
118 | ${h.textarea('pullrequest_desc',size=30)} | |
119 | </div> |
|
119 | </div> | |
120 | </div> |
|
120 | </div> | |
121 |
|
121 | |||
122 | <div class="buttons"> |
|
122 | <div class="buttons"> | |
123 | ${h.submit('save',_('Send pull request'),class_="ui-btn large")} |
|
123 | ${h.submit('save',_('Send pull request'),class_="ui-btn large")} | |
124 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} |
|
124 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} | |
125 | </div> |
|
125 | </div> | |
126 | </div> |
|
126 | </div> | |
127 | </div> |
|
127 | </div> | |
128 | ${h.end_form()} |
|
128 | ${h.end_form()} | |
129 |
|
129 | |||
130 | </div> |
|
130 | </div> | |
131 |
|
131 | |||
132 | <script type="text/javascript"> |
|
132 | <script type="text/javascript"> | |
133 | var _USERS_AC_DATA = ${c.users_array|n}; |
|
133 | var _USERS_AC_DATA = ${c.users_array|n}; | |
134 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; |
|
134 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; | |
135 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); |
|
135 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); | |
136 |
|
136 | |||
137 | var other_repos_info = ${c.other_repos_info|n}; |
|
137 | var other_repos_info = ${c.other_repos_info|n}; | |
138 |
|
138 | |||
139 | var loadPreview = function(){ |
|
139 | var loadPreview = function(){ | |
140 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none'); |
|
140 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none'); | |
|
141 | //url template | |||
141 | var url = "${h.url('compare_url', |
|
142 | var url = "${h.url('compare_url', | |
142 | repo_name='org_repo', |
|
143 | repo_name='__org_repo__', | |
143 |
org_ref_type='org_ref_type |
|
144 | org_ref_type='__org_ref_type__', | |
144 |
o |
|
145 | org_ref='__org_ref__', | |
145 |
other_re |
|
146 | other_repo='__other_repo__', | |
|
147 | other_ref_type='__other_ref_type__', | |||
|
148 | other_ref='__other_ref__', | |||
146 | as_form=True, |
|
149 | as_form=True, | |
147 | rev_start=request.GET.get('rev_start',''), |
|
150 | rev_start=request.GET.get('rev_start',''), | |
148 | rev_end=request.GET.get('rev_end',''))}"; |
|
151 | rev_end=request.GET.get('rev_end',''))}"; | |
149 |
|
152 | var org_repo = YUQ('#pull_request_form #org_repo')[0].value; | ||
|
153 | var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':'); | |||
|
154 | ||||
|
155 | var other_repo = YUQ('#pull_request_form #other_repo')[0].value; | |||
|
156 | var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':'); | |||
|
157 | ||||
150 | var select_refs = YUQ('#pull_request_form select.refs') |
|
158 | var select_refs = YUQ('#pull_request_form select.refs') | |
151 | var rev_data = {}; // gather the org/other ref and repo here |
|
159 | var rev_data = { | |
152 | for(var i=0;i<select_refs.length;i++){ |
|
160 | 'org_repo': org_repo, | |
153 | var select_ref = select_refs[i]; |
|
161 | 'org_ref': org_ref[1], | |
154 | var select_ref_data = select_ref.value.split(':'); |
|
162 | 'org_ref_type': org_ref[0], | |
155 | var key = null; |
|
163 | 'other_repo': other_repo, | |
156 | var val = null; |
|
164 | 'other_ref': other_ref[1], | |
157 |
|
165 | 'other_ref_type': other_ref[0], | ||
158 | if(select_ref_data.length>1){ |
|
166 | }; // gather the org/other ref and repo here | |
159 | key = select_ref.name+"_type"; |
|
167 | ||
160 | val = select_ref_data[0]; |
|
168 | for (k in rev_data){ | |
161 |
|
|
169 | url = url.replace('__'+k+'__',rev_data[k]); | |
162 | rev_data[key] = val; |
|
|||
163 |
|
||||
164 | key = select_ref.name; |
|
|||
165 | val = select_ref_data[1]; |
|
|||
166 | url = url.replace(key,val); |
|
|||
167 | rev_data[key] = val; |
|
|||
168 |
|
||||
169 | }else{ |
|
|||
170 | key = select_ref.name; |
|
|||
171 | val = select_ref.value; |
|
|||
172 | url = url.replace(key,val); |
|
|||
173 | rev_data[key] = val; |
|
|||
174 | } |
|
|||
175 | } |
|
170 | } | |
176 |
|
171 | |||
177 | YUE.on('other_repo', 'change', function(e){ |
|
172 | YUE.on('other_repo', 'change', function(e){ | |
178 | var repo_name = e.currentTarget.value; |
|
173 | var repo_name = e.currentTarget.value; | |
179 | // replace the <select> of changed repo |
|
174 | // replace the <select> of changed repo | |
180 | YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; |
|
175 | YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; | |
181 | }); |
|
176 | }); | |
182 |
|
177 | |||
183 | ypjax(url,'pull_request_overview', function(data){ |
|
178 | ypjax(url,'pull_request_overview', function(data){ | |
184 | var sel_box = YUQ('#pull_request_form #other_repo')[0]; |
|
179 | var sel_box = YUQ('#pull_request_form #other_repo')[0]; | |
185 | var repo_name = sel_box.options[sel_box.selectedIndex].value; |
|
180 | var repo_name = sel_box.options[sel_box.selectedIndex].value; | |
186 | YUD.get('pull_request_overview_url').href = url; |
|
181 | YUD.get('pull_request_overview_url').href = url; | |
187 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); |
|
182 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); | |
188 | YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar']; |
|
183 | YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar']; | |
189 | YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description']; |
|
184 | YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description']; | |
190 | YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; |
|
185 | YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; | |
191 | // select back the revision that was just compared |
|
186 | // select back the revision that was just compared | |
192 | setSelectValue(YUD.get('other_ref'), rev_data['other_ref']); |
|
187 | setSelectValue(YUD.get('other_ref'), rev_data['other_ref']); | |
193 | }) |
|
188 | }) | |
194 | } |
|
189 | } | |
195 | YUE.on('refresh','click',function(e){ |
|
190 | YUE.on('refresh','click',function(e){ | |
196 | loadPreview() |
|
191 | loadPreview() | |
197 | }) |
|
192 | }) | |
198 |
|
193 | |||
199 | //lazy load overview after 0.5s |
|
194 | //lazy load overview after 0.5s | |
200 | setTimeout(loadPreview, 500) |
|
195 | setTimeout(loadPreview, 500) | |
201 |
|
196 | |||
202 | </script> |
|
197 | </script> | |
203 |
|
198 | |||
204 | </%def> |
|
199 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now