Show More
@@ -1,661 +1,656 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 Exception: |
|
44 | except Exception: | |
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 repository group for proper 404 handling |
|
51 | check for valid repository 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_group_skip_path(environ, match_dict): |
|
59 | def check_group_skip_path(environ, match_dict): | |
60 | """ |
|
60 | """ | |
61 | check for valid repository group for proper 404 handling, but skips |
|
61 | check for valid repository group for proper 404 handling, but skips | |
62 | verification of existing path |
|
62 | verification of existing path | |
63 |
|
63 | |||
64 | :param environ: |
|
64 | :param environ: | |
65 | :param match_dict: |
|
65 | :param match_dict: | |
66 | """ |
|
66 | """ | |
67 | repos_group_name = match_dict.get('group_name') |
|
67 | repos_group_name = match_dict.get('group_name') | |
68 | return is_valid_repos_group(repos_group_name, config['base_path'], |
|
68 | return is_valid_repos_group(repos_group_name, config['base_path'], | |
69 | skip_path_check=True) |
|
69 | skip_path_check=True) | |
70 |
|
70 | |||
71 | def check_int(environ, match_dict): |
|
71 | def check_int(environ, match_dict): | |
72 | return match_dict.get('id').isdigit() |
|
72 | return match_dict.get('id').isdigit() | |
73 |
|
73 | |||
74 | # The ErrorController route (handles 404/500 error pages); it should |
|
74 | # The ErrorController route (handles 404/500 error pages); it should | |
75 | # likely stay at the top, ensuring it can always be resolved |
|
75 | # likely stay at the top, ensuring it can always be resolved | |
76 | rmap.connect('/error/{action}', controller='error') |
|
76 | rmap.connect('/error/{action}', controller='error') | |
77 | rmap.connect('/error/{action}/{id}', controller='error') |
|
77 | rmap.connect('/error/{action}/{id}', controller='error') | |
78 |
|
78 | |||
79 | #========================================================================== |
|
79 | #========================================================================== | |
80 | # CUSTOM ROUTES HERE |
|
80 | # CUSTOM ROUTES HERE | |
81 | #========================================================================== |
|
81 | #========================================================================== | |
82 |
|
82 | |||
83 | #MAIN PAGE |
|
83 | #MAIN PAGE | |
84 | rmap.connect('home', '/', controller='home', action='index') |
|
84 | rmap.connect('home', '/', controller='home', action='index') | |
85 | rmap.connect('repo_switcher', '/repos', controller='home', |
|
85 | rmap.connect('repo_switcher', '/repos', controller='home', | |
86 | action='repo_switcher') |
|
86 | action='repo_switcher') | |
87 | rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}', |
|
87 | rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}', | |
88 | controller='home', action='branch_tag_switcher') |
|
88 | controller='home', action='branch_tag_switcher') | |
89 | rmap.connect('bugtracker', |
|
89 | rmap.connect('bugtracker', | |
90 | "http://bitbucket.org/marcinkuzminski/rhodecode/issues", |
|
90 | "http://bitbucket.org/marcinkuzminski/rhodecode/issues", | |
91 | _static=True) |
|
91 | _static=True) | |
92 | rmap.connect('rst_help', |
|
92 | rmap.connect('rst_help', | |
93 | "http://docutils.sourceforge.net/docs/user/rst/quickref.html", |
|
93 | "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |
94 | _static=True) |
|
94 | _static=True) | |
95 | rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True) |
|
95 | rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True) | |
96 |
|
96 | |||
97 | #ADMIN REPOSITORY REST ROUTES |
|
97 | #ADMIN REPOSITORY REST ROUTES | |
98 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
98 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
99 | controller='admin/repos') as m: |
|
99 | controller='admin/repos') as m: | |
100 | m.connect("repos", "/repos", |
|
100 | m.connect("repos", "/repos", | |
101 | action="create", conditions=dict(method=["POST"])) |
|
101 | action="create", conditions=dict(method=["POST"])) | |
102 | m.connect("repos", "/repos", |
|
102 | m.connect("repos", "/repos", | |
103 | action="index", conditions=dict(method=["GET"])) |
|
103 | action="index", conditions=dict(method=["GET"])) | |
104 | m.connect("formatted_repos", "/repos.{format}", |
|
104 | m.connect("formatted_repos", "/repos.{format}", | |
105 | action="index", |
|
105 | action="index", | |
106 | conditions=dict(method=["GET"])) |
|
106 | conditions=dict(method=["GET"])) | |
107 |
m.connect("new_repo", "/ |
|
107 | m.connect("new_repo", "/create_repository", | |
108 | action="new", conditions=dict(method=["GET"])) |
|
|||
109 | #TODO: refactor the name |
|
|||
110 | m.connect("admin_settings_create_repository", "/create_repository", |
|
|||
111 | action="create_repository", conditions=dict(method=["GET"])) |
|
108 | action="create_repository", conditions=dict(method=["GET"])) | |
112 | m.connect("formatted_new_repo", "/repos/new.{format}", |
|
|||
113 | action="new", conditions=dict(method=["GET"])) |
|
|||
114 | m.connect("/repos/{repo_name:.*?}", |
|
109 | m.connect("/repos/{repo_name:.*?}", | |
115 | action="update", conditions=dict(method=["PUT"], |
|
110 | action="update", conditions=dict(method=["PUT"], | |
116 | function=check_repo)) |
|
111 | function=check_repo)) | |
117 | m.connect("/repos/{repo_name:.*?}", |
|
112 | m.connect("/repos/{repo_name:.*?}", | |
118 | action="delete", conditions=dict(method=["DELETE"], |
|
113 | action="delete", conditions=dict(method=["DELETE"], | |
119 | function=check_repo)) |
|
114 | function=check_repo)) | |
120 | m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit", |
|
115 | m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit", | |
121 | action="edit", conditions=dict(method=["GET"], |
|
116 | action="edit", conditions=dict(method=["GET"], | |
122 | function=check_repo)) |
|
117 | function=check_repo)) | |
123 | m.connect("repo", "/repos/{repo_name:.*?}", |
|
118 | m.connect("repo", "/repos/{repo_name:.*?}", | |
124 | action="show", conditions=dict(method=["GET"], |
|
119 | action="show", conditions=dict(method=["GET"], | |
125 | function=check_repo)) |
|
120 | function=check_repo)) | |
126 | m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}", |
|
121 | m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}", | |
127 | action="show", conditions=dict(method=["GET"], |
|
122 | action="show", conditions=dict(method=["GET"], | |
128 | function=check_repo)) |
|
123 | function=check_repo)) | |
129 | #add repo perm member |
|
124 | #add repo perm member | |
130 | m.connect('set_repo_perm_member', "/set_repo_perm_member/{repo_name:.*?}", |
|
125 | m.connect('set_repo_perm_member', "/set_repo_perm_member/{repo_name:.*?}", | |
131 | action="set_repo_perm_member", |
|
126 | action="set_repo_perm_member", | |
132 | conditions=dict(method=["POST"], function=check_repo)) |
|
127 | conditions=dict(method=["POST"], function=check_repo)) | |
133 |
|
128 | |||
134 | #ajax delete repo perm user |
|
129 | #ajax delete repo perm user | |
135 | m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*?}", |
|
130 | m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*?}", | |
136 | action="delete_perm_user", |
|
131 | action="delete_perm_user", | |
137 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
132 | conditions=dict(method=["DELETE"], function=check_repo)) | |
138 |
|
133 | |||
139 | #ajax delete repo perm users_group |
|
134 | #ajax delete repo perm users_group | |
140 | m.connect('delete_repo_users_group', |
|
135 | m.connect('delete_repo_users_group', | |
141 | "/repos_delete_users_group/{repo_name:.*?}", |
|
136 | "/repos_delete_users_group/{repo_name:.*?}", | |
142 | action="delete_perm_users_group", |
|
137 | action="delete_perm_users_group", | |
143 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
138 | conditions=dict(method=["DELETE"], function=check_repo)) | |
144 |
|
139 | |||
145 | #settings actions |
|
140 | #settings actions | |
146 | m.connect('repo_stats', "/repos_stats/{repo_name:.*?}", |
|
141 | m.connect('repo_stats', "/repos_stats/{repo_name:.*?}", | |
147 | action="repo_stats", conditions=dict(method=["DELETE"], |
|
142 | action="repo_stats", conditions=dict(method=["DELETE"], | |
148 | function=check_repo)) |
|
143 | function=check_repo)) | |
149 | m.connect('repo_cache', "/repos_cache/{repo_name:.*?}", |
|
144 | m.connect('repo_cache', "/repos_cache/{repo_name:.*?}", | |
150 | action="repo_cache", conditions=dict(method=["DELETE"], |
|
145 | action="repo_cache", conditions=dict(method=["DELETE"], | |
151 | function=check_repo)) |
|
146 | function=check_repo)) | |
152 | m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}", |
|
147 | m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}", | |
153 | action="repo_public_journal", conditions=dict(method=["PUT"], |
|
148 | action="repo_public_journal", conditions=dict(method=["PUT"], | |
154 | function=check_repo)) |
|
149 | function=check_repo)) | |
155 | m.connect('repo_pull', "/repo_pull/{repo_name:.*?}", |
|
150 | m.connect('repo_pull', "/repo_pull/{repo_name:.*?}", | |
156 | action="repo_pull", conditions=dict(method=["PUT"], |
|
151 | action="repo_pull", conditions=dict(method=["PUT"], | |
157 | function=check_repo)) |
|
152 | function=check_repo)) | |
158 | m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}", |
|
153 | m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}", | |
159 | action="repo_as_fork", conditions=dict(method=["PUT"], |
|
154 | action="repo_as_fork", conditions=dict(method=["PUT"], | |
160 | function=check_repo)) |
|
155 | function=check_repo)) | |
161 | m.connect('repo_locking', "/repo_locking/{repo_name:.*?}", |
|
156 | m.connect('repo_locking', "/repo_locking/{repo_name:.*?}", | |
162 | action="repo_locking", conditions=dict(method=["PUT"], |
|
157 | action="repo_locking", conditions=dict(method=["PUT"], | |
163 | function=check_repo)) |
|
158 | function=check_repo)) | |
164 | m.connect('toggle_locking', "/locking_toggle/{repo_name:.*?}", |
|
159 | m.connect('toggle_locking', "/locking_toggle/{repo_name:.*?}", | |
165 | action="toggle_locking", conditions=dict(method=["GET"], |
|
160 | action="toggle_locking", conditions=dict(method=["GET"], | |
166 | function=check_repo)) |
|
161 | function=check_repo)) | |
167 |
|
162 | |||
168 | #repo fields |
|
163 | #repo fields | |
169 | m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new", |
|
164 | m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new", | |
170 | action="create_repo_field", conditions=dict(method=["PUT"], |
|
165 | action="create_repo_field", conditions=dict(method=["PUT"], | |
171 | function=check_repo)) |
|
166 | function=check_repo)) | |
172 |
|
167 | |||
173 | m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}", |
|
168 | m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}", | |
174 | action="delete_repo_field", conditions=dict(method=["DELETE"], |
|
169 | action="delete_repo_field", conditions=dict(method=["DELETE"], | |
175 | function=check_repo)) |
|
170 | function=check_repo)) | |
176 |
|
171 | |||
177 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
172 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
178 | controller='admin/repos_groups') as m: |
|
173 | controller='admin/repos_groups') as m: | |
179 | m.connect("repos_groups", "/repos_groups", |
|
174 | m.connect("repos_groups", "/repos_groups", | |
180 | action="create", conditions=dict(method=["POST"])) |
|
175 | action="create", conditions=dict(method=["POST"])) | |
181 | m.connect("repos_groups", "/repos_groups", |
|
176 | m.connect("repos_groups", "/repos_groups", | |
182 | action="index", conditions=dict(method=["GET"])) |
|
177 | action="index", conditions=dict(method=["GET"])) | |
183 | m.connect("formatted_repos_groups", "/repos_groups.{format}", |
|
178 | m.connect("formatted_repos_groups", "/repos_groups.{format}", | |
184 | action="index", conditions=dict(method=["GET"])) |
|
179 | action="index", conditions=dict(method=["GET"])) | |
185 | m.connect("new_repos_group", "/repos_groups/new", |
|
180 | m.connect("new_repos_group", "/repos_groups/new", | |
186 | action="new", conditions=dict(method=["GET"])) |
|
181 | action="new", conditions=dict(method=["GET"])) | |
187 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", |
|
182 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", | |
188 | action="new", conditions=dict(method=["GET"])) |
|
183 | action="new", conditions=dict(method=["GET"])) | |
189 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", |
|
184 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", | |
190 | action="update", conditions=dict(method=["PUT"], |
|
185 | action="update", conditions=dict(method=["PUT"], | |
191 | function=check_group)) |
|
186 | function=check_group)) | |
192 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", |
|
187 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", | |
193 | action="delete", conditions=dict(method=["DELETE"], |
|
188 | action="delete", conditions=dict(method=["DELETE"], | |
194 | function=check_group_skip_path)) |
|
189 | function=check_group_skip_path)) | |
195 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", |
|
190 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", | |
196 | action="edit", conditions=dict(method=["GET"], |
|
191 | action="edit", conditions=dict(method=["GET"], | |
197 | function=check_group)) |
|
192 | function=check_group)) | |
198 | m.connect("formatted_edit_repos_group", |
|
193 | m.connect("formatted_edit_repos_group", | |
199 | "/repos_groups/{group_name:.*?}.{format}/edit", |
|
194 | "/repos_groups/{group_name:.*?}.{format}/edit", | |
200 | action="edit", conditions=dict(method=["GET"], |
|
195 | action="edit", conditions=dict(method=["GET"], | |
201 | function=check_group)) |
|
196 | function=check_group)) | |
202 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", |
|
197 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", | |
203 | action="show", conditions=dict(method=["GET"], |
|
198 | action="show", conditions=dict(method=["GET"], | |
204 | function=check_group)) |
|
199 | function=check_group)) | |
205 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", |
|
200 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", | |
206 | action="show", conditions=dict(method=["GET"], |
|
201 | action="show", conditions=dict(method=["GET"], | |
207 | function=check_group)) |
|
202 | function=check_group)) | |
208 | # ajax delete repository group perm user |
|
203 | # ajax delete repository group perm user | |
209 | m.connect('delete_repos_group_user_perm', |
|
204 | m.connect('delete_repos_group_user_perm', | |
210 | "/delete_repos_group_user_perm/{group_name:.*?}", |
|
205 | "/delete_repos_group_user_perm/{group_name:.*?}", | |
211 | action="delete_repos_group_user_perm", |
|
206 | action="delete_repos_group_user_perm", | |
212 | conditions=dict(method=["DELETE"], function=check_group)) |
|
207 | conditions=dict(method=["DELETE"], function=check_group)) | |
213 |
|
208 | |||
214 | # ajax delete repository group perm users_group |
|
209 | # ajax delete repository group perm users_group | |
215 | m.connect('delete_repos_group_users_group_perm', |
|
210 | m.connect('delete_repos_group_users_group_perm', | |
216 | "/delete_repos_group_users_group_perm/{group_name:.*?}", |
|
211 | "/delete_repos_group_users_group_perm/{group_name:.*?}", | |
217 | action="delete_repos_group_users_group_perm", |
|
212 | action="delete_repos_group_users_group_perm", | |
218 | conditions=dict(method=["DELETE"], function=check_group)) |
|
213 | conditions=dict(method=["DELETE"], function=check_group)) | |
219 |
|
214 | |||
220 | #ADMIN USER REST ROUTES |
|
215 | #ADMIN USER REST ROUTES | |
221 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
216 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
222 | controller='admin/users') as m: |
|
217 | controller='admin/users') as m: | |
223 | m.connect("users", "/users", |
|
218 | m.connect("users", "/users", | |
224 | action="create", conditions=dict(method=["POST"])) |
|
219 | action="create", conditions=dict(method=["POST"])) | |
225 | m.connect("users", "/users", |
|
220 | m.connect("users", "/users", | |
226 | action="index", conditions=dict(method=["GET"])) |
|
221 | action="index", conditions=dict(method=["GET"])) | |
227 | m.connect("formatted_users", "/users.{format}", |
|
222 | m.connect("formatted_users", "/users.{format}", | |
228 | action="index", conditions=dict(method=["GET"])) |
|
223 | action="index", conditions=dict(method=["GET"])) | |
229 | m.connect("new_user", "/users/new", |
|
224 | m.connect("new_user", "/users/new", | |
230 | action="new", conditions=dict(method=["GET"])) |
|
225 | action="new", conditions=dict(method=["GET"])) | |
231 | m.connect("formatted_new_user", "/users/new.{format}", |
|
226 | m.connect("formatted_new_user", "/users/new.{format}", | |
232 | action="new", conditions=dict(method=["GET"])) |
|
227 | action="new", conditions=dict(method=["GET"])) | |
233 | m.connect("update_user", "/users/{id}", |
|
228 | m.connect("update_user", "/users/{id}", | |
234 | action="update", conditions=dict(method=["PUT"])) |
|
229 | action="update", conditions=dict(method=["PUT"])) | |
235 | m.connect("delete_user", "/users/{id}", |
|
230 | m.connect("delete_user", "/users/{id}", | |
236 | action="delete", conditions=dict(method=["DELETE"])) |
|
231 | action="delete", conditions=dict(method=["DELETE"])) | |
237 | m.connect("edit_user", "/users/{id}/edit", |
|
232 | m.connect("edit_user", "/users/{id}/edit", | |
238 | action="edit", conditions=dict(method=["GET"])) |
|
233 | action="edit", conditions=dict(method=["GET"])) | |
239 | m.connect("formatted_edit_user", |
|
234 | m.connect("formatted_edit_user", | |
240 | "/users/{id}.{format}/edit", |
|
235 | "/users/{id}.{format}/edit", | |
241 | action="edit", conditions=dict(method=["GET"])) |
|
236 | action="edit", conditions=dict(method=["GET"])) | |
242 | m.connect("user", "/users/{id}", |
|
237 | m.connect("user", "/users/{id}", | |
243 | action="show", conditions=dict(method=["GET"])) |
|
238 | action="show", conditions=dict(method=["GET"])) | |
244 | m.connect("formatted_user", "/users/{id}.{format}", |
|
239 | m.connect("formatted_user", "/users/{id}.{format}", | |
245 | action="show", conditions=dict(method=["GET"])) |
|
240 | action="show", conditions=dict(method=["GET"])) | |
246 |
|
241 | |||
247 | #EXTRAS USER ROUTES |
|
242 | #EXTRAS USER ROUTES | |
248 | m.connect("user_perm", "/users_perm/{id}", |
|
243 | m.connect("user_perm", "/users_perm/{id}", | |
249 | action="update_perm", conditions=dict(method=["PUT"])) |
|
244 | action="update_perm", conditions=dict(method=["PUT"])) | |
250 | m.connect("user_emails", "/users_emails/{id}", |
|
245 | m.connect("user_emails", "/users_emails/{id}", | |
251 | action="add_email", conditions=dict(method=["PUT"])) |
|
246 | action="add_email", conditions=dict(method=["PUT"])) | |
252 | m.connect("user_emails_delete", "/users_emails/{id}", |
|
247 | m.connect("user_emails_delete", "/users_emails/{id}", | |
253 | action="delete_email", conditions=dict(method=["DELETE"])) |
|
248 | action="delete_email", conditions=dict(method=["DELETE"])) | |
254 | m.connect("user_ips", "/users_ips/{id}", |
|
249 | m.connect("user_ips", "/users_ips/{id}", | |
255 | action="add_ip", conditions=dict(method=["PUT"])) |
|
250 | action="add_ip", conditions=dict(method=["PUT"])) | |
256 | m.connect("user_ips_delete", "/users_ips/{id}", |
|
251 | m.connect("user_ips_delete", "/users_ips/{id}", | |
257 | action="delete_ip", conditions=dict(method=["DELETE"])) |
|
252 | action="delete_ip", conditions=dict(method=["DELETE"])) | |
258 |
|
253 | |||
259 | #ADMIN USER GROUPS REST ROUTES |
|
254 | #ADMIN USER GROUPS REST ROUTES | |
260 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
255 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
261 | controller='admin/users_groups') as m: |
|
256 | controller='admin/users_groups') as m: | |
262 | m.connect("users_groups", "/users_groups", |
|
257 | m.connect("users_groups", "/users_groups", | |
263 | action="create", conditions=dict(method=["POST"])) |
|
258 | action="create", conditions=dict(method=["POST"])) | |
264 | m.connect("users_groups", "/users_groups", |
|
259 | m.connect("users_groups", "/users_groups", | |
265 | action="index", conditions=dict(method=["GET"])) |
|
260 | action="index", conditions=dict(method=["GET"])) | |
266 | m.connect("formatted_users_groups", "/users_groups.{format}", |
|
261 | m.connect("formatted_users_groups", "/users_groups.{format}", | |
267 | action="index", conditions=dict(method=["GET"])) |
|
262 | action="index", conditions=dict(method=["GET"])) | |
268 | m.connect("new_users_group", "/users_groups/new", |
|
263 | m.connect("new_users_group", "/users_groups/new", | |
269 | action="new", conditions=dict(method=["GET"])) |
|
264 | action="new", conditions=dict(method=["GET"])) | |
270 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", |
|
265 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", | |
271 | action="new", conditions=dict(method=["GET"])) |
|
266 | action="new", conditions=dict(method=["GET"])) | |
272 | m.connect("update_users_group", "/users_groups/{id}", |
|
267 | m.connect("update_users_group", "/users_groups/{id}", | |
273 | action="update", conditions=dict(method=["PUT"])) |
|
268 | action="update", conditions=dict(method=["PUT"])) | |
274 | m.connect("delete_users_group", "/users_groups/{id}", |
|
269 | m.connect("delete_users_group", "/users_groups/{id}", | |
275 | action="delete", conditions=dict(method=["DELETE"])) |
|
270 | action="delete", conditions=dict(method=["DELETE"])) | |
276 | m.connect("edit_users_group", "/users_groups/{id}/edit", |
|
271 | m.connect("edit_users_group", "/users_groups/{id}/edit", | |
277 | action="edit", conditions=dict(method=["GET"])) |
|
272 | action="edit", conditions=dict(method=["GET"])) | |
278 | m.connect("formatted_edit_users_group", |
|
273 | m.connect("formatted_edit_users_group", | |
279 | "/users_groups/{id}.{format}/edit", |
|
274 | "/users_groups/{id}.{format}/edit", | |
280 | action="edit", conditions=dict(method=["GET"])) |
|
275 | action="edit", conditions=dict(method=["GET"])) | |
281 | m.connect("users_group", "/users_groups/{id}", |
|
276 | m.connect("users_group", "/users_groups/{id}", | |
282 | action="show", conditions=dict(method=["GET"])) |
|
277 | action="show", conditions=dict(method=["GET"])) | |
283 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", |
|
278 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", | |
284 | action="show", conditions=dict(method=["GET"])) |
|
279 | action="show", conditions=dict(method=["GET"])) | |
285 |
|
280 | |||
286 | #EXTRAS USER ROUTES |
|
281 | #EXTRAS USER ROUTES | |
287 | m.connect("users_group_perm", "/users_groups_perm/{id}", |
|
282 | m.connect("users_group_perm", "/users_groups_perm/{id}", | |
288 | action="update_perm", conditions=dict(method=["PUT"])) |
|
283 | action="update_perm", conditions=dict(method=["PUT"])) | |
289 |
|
284 | |||
290 | #ADMIN GROUP REST ROUTES |
|
285 | #ADMIN GROUP REST ROUTES | |
291 | rmap.resource('group', 'groups', |
|
286 | rmap.resource('group', 'groups', | |
292 | controller='admin/groups', path_prefix=ADMIN_PREFIX) |
|
287 | controller='admin/groups', path_prefix=ADMIN_PREFIX) | |
293 |
|
288 | |||
294 | #ADMIN PERMISSIONS REST ROUTES |
|
289 | #ADMIN PERMISSIONS REST ROUTES | |
295 | rmap.resource('permission', 'permissions', |
|
290 | rmap.resource('permission', 'permissions', | |
296 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) |
|
291 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) | |
297 |
|
292 | |||
298 | #ADMIN DEFAULTS REST ROUTES |
|
293 | #ADMIN DEFAULTS REST ROUTES | |
299 | rmap.resource('default', 'defaults', |
|
294 | rmap.resource('default', 'defaults', | |
300 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) |
|
295 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) | |
301 |
|
296 | |||
302 | ##ADMIN LDAP SETTINGS |
|
297 | ##ADMIN LDAP SETTINGS | |
303 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, |
|
298 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, | |
304 | controller='admin/ldap_settings', action='ldap_settings', |
|
299 | controller='admin/ldap_settings', action='ldap_settings', | |
305 | conditions=dict(method=["POST"])) |
|
300 | conditions=dict(method=["POST"])) | |
306 |
|
301 | |||
307 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, |
|
302 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, | |
308 | controller='admin/ldap_settings') |
|
303 | controller='admin/ldap_settings') | |
309 |
|
304 | |||
310 | #ADMIN SETTINGS REST ROUTES |
|
305 | #ADMIN SETTINGS REST ROUTES | |
311 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
306 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
312 | controller='admin/settings') as m: |
|
307 | controller='admin/settings') as m: | |
313 | m.connect("admin_settings", "/settings", |
|
308 | m.connect("admin_settings", "/settings", | |
314 | action="create", conditions=dict(method=["POST"])) |
|
309 | action="create", conditions=dict(method=["POST"])) | |
315 | m.connect("admin_settings", "/settings", |
|
310 | m.connect("admin_settings", "/settings", | |
316 | action="index", conditions=dict(method=["GET"])) |
|
311 | action="index", conditions=dict(method=["GET"])) | |
317 | m.connect("formatted_admin_settings", "/settings.{format}", |
|
312 | m.connect("formatted_admin_settings", "/settings.{format}", | |
318 | action="index", conditions=dict(method=["GET"])) |
|
313 | action="index", conditions=dict(method=["GET"])) | |
319 | m.connect("admin_new_setting", "/settings/new", |
|
314 | m.connect("admin_new_setting", "/settings/new", | |
320 | action="new", conditions=dict(method=["GET"])) |
|
315 | action="new", conditions=dict(method=["GET"])) | |
321 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", |
|
316 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", | |
322 | action="new", conditions=dict(method=["GET"])) |
|
317 | action="new", conditions=dict(method=["GET"])) | |
323 | m.connect("/settings/{setting_id}", |
|
318 | m.connect("/settings/{setting_id}", | |
324 | action="update", conditions=dict(method=["PUT"])) |
|
319 | action="update", conditions=dict(method=["PUT"])) | |
325 | m.connect("/settings/{setting_id}", |
|
320 | m.connect("/settings/{setting_id}", | |
326 | action="delete", conditions=dict(method=["DELETE"])) |
|
321 | action="delete", conditions=dict(method=["DELETE"])) | |
327 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", |
|
322 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", | |
328 | action="edit", conditions=dict(method=["GET"])) |
|
323 | action="edit", conditions=dict(method=["GET"])) | |
329 | m.connect("formatted_admin_edit_setting", |
|
324 | m.connect("formatted_admin_edit_setting", | |
330 | "/settings/{setting_id}.{format}/edit", |
|
325 | "/settings/{setting_id}.{format}/edit", | |
331 | action="edit", conditions=dict(method=["GET"])) |
|
326 | action="edit", conditions=dict(method=["GET"])) | |
332 | m.connect("admin_setting", "/settings/{setting_id}", |
|
327 | m.connect("admin_setting", "/settings/{setting_id}", | |
333 | action="show", conditions=dict(method=["GET"])) |
|
328 | action="show", conditions=dict(method=["GET"])) | |
334 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", |
|
329 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", | |
335 | action="show", conditions=dict(method=["GET"])) |
|
330 | action="show", conditions=dict(method=["GET"])) | |
336 | m.connect("admin_settings_my_account", "/my_account", |
|
331 | m.connect("admin_settings_my_account", "/my_account", | |
337 | action="my_account", conditions=dict(method=["GET"])) |
|
332 | action="my_account", conditions=dict(method=["GET"])) | |
338 | m.connect("admin_settings_my_account_update", "/my_account_update", |
|
333 | m.connect("admin_settings_my_account_update", "/my_account_update", | |
339 | action="my_account_update", conditions=dict(method=["PUT"])) |
|
334 | action="my_account_update", conditions=dict(method=["PUT"])) | |
340 | m.connect("admin_settings_my_repos", "/my_account/repos", |
|
335 | m.connect("admin_settings_my_repos", "/my_account/repos", | |
341 | action="my_account_my_repos", conditions=dict(method=["GET"])) |
|
336 | action="my_account_my_repos", conditions=dict(method=["GET"])) | |
342 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", |
|
337 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", | |
343 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) |
|
338 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) | |
344 |
|
339 | |||
345 | #NOTIFICATION REST ROUTES |
|
340 | #NOTIFICATION REST ROUTES | |
346 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
341 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
347 | controller='admin/notifications') as m: |
|
342 | controller='admin/notifications') as m: | |
348 | m.connect("notifications", "/notifications", |
|
343 | m.connect("notifications", "/notifications", | |
349 | action="create", conditions=dict(method=["POST"])) |
|
344 | action="create", conditions=dict(method=["POST"])) | |
350 | m.connect("notifications", "/notifications", |
|
345 | m.connect("notifications", "/notifications", | |
351 | action="index", conditions=dict(method=["GET"])) |
|
346 | action="index", conditions=dict(method=["GET"])) | |
352 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", |
|
347 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", | |
353 | action="mark_all_read", conditions=dict(method=["GET"])) |
|
348 | action="mark_all_read", conditions=dict(method=["GET"])) | |
354 | m.connect("formatted_notifications", "/notifications.{format}", |
|
349 | m.connect("formatted_notifications", "/notifications.{format}", | |
355 | action="index", conditions=dict(method=["GET"])) |
|
350 | action="index", conditions=dict(method=["GET"])) | |
356 | m.connect("new_notification", "/notifications/new", |
|
351 | m.connect("new_notification", "/notifications/new", | |
357 | action="new", conditions=dict(method=["GET"])) |
|
352 | action="new", conditions=dict(method=["GET"])) | |
358 | m.connect("formatted_new_notification", "/notifications/new.{format}", |
|
353 | m.connect("formatted_new_notification", "/notifications/new.{format}", | |
359 | action="new", conditions=dict(method=["GET"])) |
|
354 | action="new", conditions=dict(method=["GET"])) | |
360 | m.connect("/notification/{notification_id}", |
|
355 | m.connect("/notification/{notification_id}", | |
361 | action="update", conditions=dict(method=["PUT"])) |
|
356 | action="update", conditions=dict(method=["PUT"])) | |
362 | m.connect("/notification/{notification_id}", |
|
357 | m.connect("/notification/{notification_id}", | |
363 | action="delete", conditions=dict(method=["DELETE"])) |
|
358 | action="delete", conditions=dict(method=["DELETE"])) | |
364 | m.connect("edit_notification", "/notification/{notification_id}/edit", |
|
359 | m.connect("edit_notification", "/notification/{notification_id}/edit", | |
365 | action="edit", conditions=dict(method=["GET"])) |
|
360 | action="edit", conditions=dict(method=["GET"])) | |
366 | m.connect("formatted_edit_notification", |
|
361 | m.connect("formatted_edit_notification", | |
367 | "/notification/{notification_id}.{format}/edit", |
|
362 | "/notification/{notification_id}.{format}/edit", | |
368 | action="edit", conditions=dict(method=["GET"])) |
|
363 | action="edit", conditions=dict(method=["GET"])) | |
369 | m.connect("notification", "/notification/{notification_id}", |
|
364 | m.connect("notification", "/notification/{notification_id}", | |
370 | action="show", conditions=dict(method=["GET"])) |
|
365 | action="show", conditions=dict(method=["GET"])) | |
371 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", |
|
366 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", | |
372 | action="show", conditions=dict(method=["GET"])) |
|
367 | action="show", conditions=dict(method=["GET"])) | |
373 |
|
368 | |||
374 | #ADMIN MAIN PAGES |
|
369 | #ADMIN MAIN PAGES | |
375 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
370 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
376 | controller='admin/admin') as m: |
|
371 | controller='admin/admin') as m: | |
377 | m.connect('admin_home', '', action='index') |
|
372 | m.connect('admin_home', '', action='index') | |
378 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
373 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
379 | action='add_repo') |
|
374 | action='add_repo') | |
380 |
|
375 | |||
381 | #========================================================================== |
|
376 | #========================================================================== | |
382 | # API V2 |
|
377 | # API V2 | |
383 | #========================================================================== |
|
378 | #========================================================================== | |
384 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
379 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
385 | controller='api/api') as m: |
|
380 | controller='api/api') as m: | |
386 | m.connect('api', '/api') |
|
381 | m.connect('api', '/api') | |
387 |
|
382 | |||
388 | #USER JOURNAL |
|
383 | #USER JOURNAL | |
389 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, |
|
384 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, | |
390 | controller='journal', action='index') |
|
385 | controller='journal', action='index') | |
391 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, |
|
386 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, | |
392 | controller='journal', action='journal_rss') |
|
387 | controller='journal', action='journal_rss') | |
393 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, |
|
388 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, | |
394 | controller='journal', action='journal_atom') |
|
389 | controller='journal', action='journal_atom') | |
395 |
|
390 | |||
396 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, |
|
391 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, | |
397 | controller='journal', action="public_journal") |
|
392 | controller='journal', action="public_journal") | |
398 |
|
393 | |||
399 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, |
|
394 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, | |
400 | controller='journal', action="public_journal_rss") |
|
395 | controller='journal', action="public_journal_rss") | |
401 |
|
396 | |||
402 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, |
|
397 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, | |
403 | controller='journal', action="public_journal_rss") |
|
398 | controller='journal', action="public_journal_rss") | |
404 |
|
399 | |||
405 | rmap.connect('public_journal_atom', |
|
400 | rmap.connect('public_journal_atom', | |
406 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', |
|
401 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', | |
407 | action="public_journal_atom") |
|
402 | action="public_journal_atom") | |
408 |
|
403 | |||
409 | rmap.connect('public_journal_atom_old', |
|
404 | rmap.connect('public_journal_atom_old', | |
410 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', |
|
405 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', | |
411 | action="public_journal_atom") |
|
406 | action="public_journal_atom") | |
412 |
|
407 | |||
413 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, |
|
408 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, | |
414 | controller='journal', action='toggle_following', |
|
409 | controller='journal', action='toggle_following', | |
415 | conditions=dict(method=["POST"])) |
|
410 | conditions=dict(method=["POST"])) | |
416 |
|
411 | |||
417 | #SEARCH |
|
412 | #SEARCH | |
418 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) |
|
413 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) | |
419 | rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX, |
|
414 | rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX, | |
420 | controller='search', |
|
415 | controller='search', | |
421 | conditions=dict(function=check_repo)) |
|
416 | conditions=dict(function=check_repo)) | |
422 | rmap.connect('search_repo', '/{repo_name:.*?}/search', |
|
417 | rmap.connect('search_repo', '/{repo_name:.*?}/search', | |
423 | controller='search', |
|
418 | controller='search', | |
424 | conditions=dict(function=check_repo), |
|
419 | conditions=dict(function=check_repo), | |
425 | ) |
|
420 | ) | |
426 |
|
421 | |||
427 | #LOGIN/LOGOUT/REGISTER/SIGN IN |
|
422 | #LOGIN/LOGOUT/REGISTER/SIGN IN | |
428 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') |
|
423 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') | |
429 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', |
|
424 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', | |
430 | action='logout') |
|
425 | action='logout') | |
431 |
|
426 | |||
432 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', |
|
427 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', | |
433 | action='register') |
|
428 | action='register') | |
434 |
|
429 | |||
435 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, |
|
430 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, | |
436 | controller='login', action='password_reset') |
|
431 | controller='login', action='password_reset') | |
437 |
|
432 | |||
438 | rmap.connect('reset_password_confirmation', |
|
433 | rmap.connect('reset_password_confirmation', | |
439 | '%s/password_reset_confirmation' % ADMIN_PREFIX, |
|
434 | '%s/password_reset_confirmation' % ADMIN_PREFIX, | |
440 | controller='login', action='password_reset_confirmation') |
|
435 | controller='login', action='password_reset_confirmation') | |
441 |
|
436 | |||
442 | #FEEDS |
|
437 | #FEEDS | |
443 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', |
|
438 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', | |
444 | controller='feed', action='rss', |
|
439 | controller='feed', action='rss', | |
445 | conditions=dict(function=check_repo)) |
|
440 | conditions=dict(function=check_repo)) | |
446 |
|
441 | |||
447 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', |
|
442 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', | |
448 | controller='feed', action='atom', |
|
443 | controller='feed', action='atom', | |
449 | conditions=dict(function=check_repo)) |
|
444 | conditions=dict(function=check_repo)) | |
450 |
|
445 | |||
451 | #========================================================================== |
|
446 | #========================================================================== | |
452 | # REPOSITORY ROUTES |
|
447 | # REPOSITORY ROUTES | |
453 | #========================================================================== |
|
448 | #========================================================================== | |
454 | rmap.connect('summary_home', '/{repo_name:.*?}', |
|
449 | rmap.connect('summary_home', '/{repo_name:.*?}', | |
455 | controller='summary', |
|
450 | controller='summary', | |
456 | conditions=dict(function=check_repo)) |
|
451 | conditions=dict(function=check_repo)) | |
457 |
|
452 | |||
458 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', |
|
453 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', | |
459 | controller='summary', action='repo_size', |
|
454 | controller='summary', action='repo_size', | |
460 | conditions=dict(function=check_repo)) |
|
455 | conditions=dict(function=check_repo)) | |
461 |
|
456 | |||
462 | rmap.connect('repos_group_home', '/{group_name:.*}', |
|
457 | rmap.connect('repos_group_home', '/{group_name:.*}', | |
463 | controller='admin/repos_groups', action="show_by_name", |
|
458 | controller='admin/repos_groups', action="show_by_name", | |
464 | conditions=dict(function=check_group)) |
|
459 | conditions=dict(function=check_group)) | |
465 |
|
460 | |||
466 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', |
|
461 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', | |
467 | controller='changeset', revision='tip', |
|
462 | controller='changeset', revision='tip', | |
468 | conditions=dict(function=check_repo)) |
|
463 | conditions=dict(function=check_repo)) | |
469 |
|
464 | |||
470 | # no longer user, but kept for routes to work |
|
465 | # no longer user, but kept for routes to work | |
471 | rmap.connect("_edit_repo", "/{repo_name:.*?}/edit", |
|
466 | rmap.connect("_edit_repo", "/{repo_name:.*?}/edit", | |
472 | controller='admin/repos', action="edit", |
|
467 | controller='admin/repos', action="edit", | |
473 | conditions=dict(method=["GET"], function=check_repo) |
|
468 | conditions=dict(method=["GET"], function=check_repo) | |
474 | ) |
|
469 | ) | |
475 |
|
470 | |||
476 | rmap.connect("edit_repo", "/{repo_name:.*?}/settings", |
|
471 | rmap.connect("edit_repo", "/{repo_name:.*?}/settings", | |
477 | controller='admin/repos', action="edit", |
|
472 | controller='admin/repos', action="edit", | |
478 | conditions=dict(method=["GET"], function=check_repo) |
|
473 | conditions=dict(method=["GET"], function=check_repo) | |
479 | ) |
|
474 | ) | |
480 |
|
475 | |||
481 | #still working url for backward compat. |
|
476 | #still working url for backward compat. | |
482 | rmap.connect('raw_changeset_home_depraced', |
|
477 | rmap.connect('raw_changeset_home_depraced', | |
483 | '/{repo_name:.*?}/raw-changeset/{revision}', |
|
478 | '/{repo_name:.*?}/raw-changeset/{revision}', | |
484 | controller='changeset', action='changeset_raw', |
|
479 | controller='changeset', action='changeset_raw', | |
485 | revision='tip', conditions=dict(function=check_repo)) |
|
480 | revision='tip', conditions=dict(function=check_repo)) | |
486 |
|
481 | |||
487 | ## new URLs |
|
482 | ## new URLs | |
488 | rmap.connect('changeset_raw_home', |
|
483 | rmap.connect('changeset_raw_home', | |
489 | '/{repo_name:.*?}/changeset-diff/{revision}', |
|
484 | '/{repo_name:.*?}/changeset-diff/{revision}', | |
490 | controller='changeset', action='changeset_raw', |
|
485 | controller='changeset', action='changeset_raw', | |
491 | revision='tip', conditions=dict(function=check_repo)) |
|
486 | revision='tip', conditions=dict(function=check_repo)) | |
492 |
|
487 | |||
493 | rmap.connect('changeset_patch_home', |
|
488 | rmap.connect('changeset_patch_home', | |
494 | '/{repo_name:.*?}/changeset-patch/{revision}', |
|
489 | '/{repo_name:.*?}/changeset-patch/{revision}', | |
495 | controller='changeset', action='changeset_patch', |
|
490 | controller='changeset', action='changeset_patch', | |
496 | revision='tip', conditions=dict(function=check_repo)) |
|
491 | revision='tip', conditions=dict(function=check_repo)) | |
497 |
|
492 | |||
498 | rmap.connect('changeset_download_home', |
|
493 | rmap.connect('changeset_download_home', | |
499 | '/{repo_name:.*?}/changeset-download/{revision}', |
|
494 | '/{repo_name:.*?}/changeset-download/{revision}', | |
500 | controller='changeset', action='changeset_download', |
|
495 | controller='changeset', action='changeset_download', | |
501 | revision='tip', conditions=dict(function=check_repo)) |
|
496 | revision='tip', conditions=dict(function=check_repo)) | |
502 |
|
497 | |||
503 | rmap.connect('changeset_comment', |
|
498 | rmap.connect('changeset_comment', | |
504 | '/{repo_name:.*?}/changeset/{revision}/comment', |
|
499 | '/{repo_name:.*?}/changeset/{revision}/comment', | |
505 | controller='changeset', revision='tip', action='comment', |
|
500 | controller='changeset', revision='tip', action='comment', | |
506 | conditions=dict(function=check_repo)) |
|
501 | conditions=dict(function=check_repo)) | |
507 |
|
502 | |||
508 | rmap.connect('changeset_comment_delete', |
|
503 | rmap.connect('changeset_comment_delete', | |
509 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', |
|
504 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', | |
510 | controller='changeset', action='delete_comment', |
|
505 | controller='changeset', action='delete_comment', | |
511 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
506 | conditions=dict(function=check_repo, method=["DELETE"])) | |
512 |
|
507 | |||
513 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', |
|
508 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', | |
514 | controller='changeset', action='changeset_info') |
|
509 | controller='changeset', action='changeset_info') | |
515 |
|
510 | |||
516 | rmap.connect('compare_url', |
|
511 | rmap.connect('compare_url', | |
517 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', |
|
512 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', | |
518 | controller='compare', action='index', |
|
513 | controller='compare', action='index', | |
519 | conditions=dict(function=check_repo), |
|
514 | conditions=dict(function=check_repo), | |
520 | requirements=dict( |
|
515 | requirements=dict( | |
521 | org_ref_type='(branch|book|tag|rev|__other_ref_type__)', |
|
516 | org_ref_type='(branch|book|tag|rev|__other_ref_type__)', | |
522 | other_ref_type='(branch|book|tag|rev|__org_ref_type__)') |
|
517 | other_ref_type='(branch|book|tag|rev|__org_ref_type__)') | |
523 | ) |
|
518 | ) | |
524 |
|
519 | |||
525 | rmap.connect('pullrequest_home', |
|
520 | rmap.connect('pullrequest_home', | |
526 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
521 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
527 | action='index', conditions=dict(function=check_repo, |
|
522 | action='index', conditions=dict(function=check_repo, | |
528 | method=["GET"])) |
|
523 | method=["GET"])) | |
529 |
|
524 | |||
530 | rmap.connect('pullrequest', |
|
525 | rmap.connect('pullrequest', | |
531 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
526 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
532 | action='create', conditions=dict(function=check_repo, |
|
527 | action='create', conditions=dict(function=check_repo, | |
533 | method=["POST"])) |
|
528 | method=["POST"])) | |
534 |
|
529 | |||
535 | rmap.connect('pullrequest_show', |
|
530 | rmap.connect('pullrequest_show', | |
536 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
531 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
537 | controller='pullrequests', |
|
532 | controller='pullrequests', | |
538 | action='show', conditions=dict(function=check_repo, |
|
533 | action='show', conditions=dict(function=check_repo, | |
539 | method=["GET"])) |
|
534 | method=["GET"])) | |
540 | rmap.connect('pullrequest_update', |
|
535 | rmap.connect('pullrequest_update', | |
541 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
536 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
542 | controller='pullrequests', |
|
537 | controller='pullrequests', | |
543 | action='update', conditions=dict(function=check_repo, |
|
538 | action='update', conditions=dict(function=check_repo, | |
544 | method=["PUT"])) |
|
539 | method=["PUT"])) | |
545 | rmap.connect('pullrequest_delete', |
|
540 | rmap.connect('pullrequest_delete', | |
546 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
541 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
547 | controller='pullrequests', |
|
542 | controller='pullrequests', | |
548 | action='delete', conditions=dict(function=check_repo, |
|
543 | action='delete', conditions=dict(function=check_repo, | |
549 | method=["DELETE"])) |
|
544 | method=["DELETE"])) | |
550 |
|
545 | |||
551 | rmap.connect('pullrequest_show_all', |
|
546 | rmap.connect('pullrequest_show_all', | |
552 | '/{repo_name:.*?}/pull-request', |
|
547 | '/{repo_name:.*?}/pull-request', | |
553 | controller='pullrequests', |
|
548 | controller='pullrequests', | |
554 | action='show_all', conditions=dict(function=check_repo, |
|
549 | action='show_all', conditions=dict(function=check_repo, | |
555 | method=["GET"])) |
|
550 | method=["GET"])) | |
556 |
|
551 | |||
557 | rmap.connect('pullrequest_comment', |
|
552 | rmap.connect('pullrequest_comment', | |
558 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', |
|
553 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', | |
559 | controller='pullrequests', |
|
554 | controller='pullrequests', | |
560 | action='comment', conditions=dict(function=check_repo, |
|
555 | action='comment', conditions=dict(function=check_repo, | |
561 | method=["POST"])) |
|
556 | method=["POST"])) | |
562 |
|
557 | |||
563 | rmap.connect('pullrequest_comment_delete', |
|
558 | rmap.connect('pullrequest_comment_delete', | |
564 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', |
|
559 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', | |
565 | controller='pullrequests', action='delete_comment', |
|
560 | controller='pullrequests', action='delete_comment', | |
566 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
561 | conditions=dict(function=check_repo, method=["DELETE"])) | |
567 |
|
562 | |||
568 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', |
|
563 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', | |
569 | controller='summary', conditions=dict(function=check_repo)) |
|
564 | controller='summary', conditions=dict(function=check_repo)) | |
570 |
|
565 | |||
571 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', |
|
566 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', | |
572 | controller='shortlog', conditions=dict(function=check_repo)) |
|
567 | controller='shortlog', conditions=dict(function=check_repo)) | |
573 |
|
568 | |||
574 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', |
|
569 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', | |
575 | controller='shortlog', f_path=None, |
|
570 | controller='shortlog', f_path=None, | |
576 | conditions=dict(function=check_repo)) |
|
571 | conditions=dict(function=check_repo)) | |
577 |
|
572 | |||
578 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', |
|
573 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', | |
579 | controller='branches', conditions=dict(function=check_repo)) |
|
574 | controller='branches', conditions=dict(function=check_repo)) | |
580 |
|
575 | |||
581 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', |
|
576 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', | |
582 | controller='tags', conditions=dict(function=check_repo)) |
|
577 | controller='tags', conditions=dict(function=check_repo)) | |
583 |
|
578 | |||
584 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', |
|
579 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', | |
585 | controller='bookmarks', conditions=dict(function=check_repo)) |
|
580 | controller='bookmarks', conditions=dict(function=check_repo)) | |
586 |
|
581 | |||
587 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', |
|
582 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', | |
588 | controller='changelog', conditions=dict(function=check_repo)) |
|
583 | controller='changelog', conditions=dict(function=check_repo)) | |
589 |
|
584 | |||
590 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', |
|
585 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', | |
591 | controller='changelog', action='changelog_details', |
|
586 | controller='changelog', action='changelog_details', | |
592 | conditions=dict(function=check_repo)) |
|
587 | conditions=dict(function=check_repo)) | |
593 |
|
588 | |||
594 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', |
|
589 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', | |
595 | controller='files', revision='tip', f_path='', |
|
590 | controller='files', revision='tip', f_path='', | |
596 | conditions=dict(function=check_repo)) |
|
591 | conditions=dict(function=check_repo)) | |
597 |
|
592 | |||
598 | rmap.connect('files_home_nopath', '/{repo_name:.*?}/files/{revision}', |
|
593 | rmap.connect('files_home_nopath', '/{repo_name:.*?}/files/{revision}', | |
599 | controller='files', revision='tip', f_path='', |
|
594 | controller='files', revision='tip', f_path='', | |
600 | conditions=dict(function=check_repo)) |
|
595 | conditions=dict(function=check_repo)) | |
601 |
|
596 | |||
602 | rmap.connect('files_history_home', |
|
597 | rmap.connect('files_history_home', | |
603 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', |
|
598 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', | |
604 | controller='files', action='history', revision='tip', f_path='', |
|
599 | controller='files', action='history', revision='tip', f_path='', | |
605 | conditions=dict(function=check_repo)) |
|
600 | conditions=dict(function=check_repo)) | |
606 |
|
601 | |||
607 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', |
|
602 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', | |
608 | controller='files', action='diff', revision='tip', f_path='', |
|
603 | controller='files', action='diff', revision='tip', f_path='', | |
609 | conditions=dict(function=check_repo)) |
|
604 | conditions=dict(function=check_repo)) | |
610 |
|
605 | |||
611 | rmap.connect('files_rawfile_home', |
|
606 | rmap.connect('files_rawfile_home', | |
612 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', |
|
607 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', | |
613 | controller='files', action='rawfile', revision='tip', |
|
608 | controller='files', action='rawfile', revision='tip', | |
614 | f_path='', conditions=dict(function=check_repo)) |
|
609 | f_path='', conditions=dict(function=check_repo)) | |
615 |
|
610 | |||
616 | rmap.connect('files_raw_home', |
|
611 | rmap.connect('files_raw_home', | |
617 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', |
|
612 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', | |
618 | controller='files', action='raw', revision='tip', f_path='', |
|
613 | controller='files', action='raw', revision='tip', f_path='', | |
619 | conditions=dict(function=check_repo)) |
|
614 | conditions=dict(function=check_repo)) | |
620 |
|
615 | |||
621 | rmap.connect('files_annotate_home', |
|
616 | rmap.connect('files_annotate_home', | |
622 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', |
|
617 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', | |
623 | controller='files', action='index', revision='tip', |
|
618 | controller='files', action='index', revision='tip', | |
624 | f_path='', annotate=True, conditions=dict(function=check_repo)) |
|
619 | f_path='', annotate=True, conditions=dict(function=check_repo)) | |
625 |
|
620 | |||
626 | rmap.connect('files_edit_home', |
|
621 | rmap.connect('files_edit_home', | |
627 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', |
|
622 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', | |
628 | controller='files', action='edit', revision='tip', |
|
623 | controller='files', action='edit', revision='tip', | |
629 | f_path='', conditions=dict(function=check_repo)) |
|
624 | f_path='', conditions=dict(function=check_repo)) | |
630 |
|
625 | |||
631 | rmap.connect('files_add_home', |
|
626 | rmap.connect('files_add_home', | |
632 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', |
|
627 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', | |
633 | controller='files', action='add', revision='tip', |
|
628 | controller='files', action='add', revision='tip', | |
634 | f_path='', conditions=dict(function=check_repo)) |
|
629 | f_path='', conditions=dict(function=check_repo)) | |
635 |
|
630 | |||
636 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', |
|
631 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', | |
637 | controller='files', action='archivefile', |
|
632 | controller='files', action='archivefile', | |
638 | conditions=dict(function=check_repo)) |
|
633 | conditions=dict(function=check_repo)) | |
639 |
|
634 | |||
640 | rmap.connect('files_nodelist_home', |
|
635 | rmap.connect('files_nodelist_home', | |
641 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', |
|
636 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', | |
642 | controller='files', action='nodelist', |
|
637 | controller='files', action='nodelist', | |
643 | conditions=dict(function=check_repo)) |
|
638 | conditions=dict(function=check_repo)) | |
644 |
|
639 | |||
645 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', |
|
640 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', | |
646 | controller='forks', action='fork_create', |
|
641 | controller='forks', action='fork_create', | |
647 | conditions=dict(function=check_repo, method=["POST"])) |
|
642 | conditions=dict(function=check_repo, method=["POST"])) | |
648 |
|
643 | |||
649 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', |
|
644 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', | |
650 | controller='forks', action='fork', |
|
645 | controller='forks', action='fork', | |
651 | conditions=dict(function=check_repo)) |
|
646 | conditions=dict(function=check_repo)) | |
652 |
|
647 | |||
653 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', |
|
648 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', | |
654 | controller='forks', action='forks', |
|
649 | controller='forks', action='forks', | |
655 | conditions=dict(function=check_repo)) |
|
650 | conditions=dict(function=check_repo)) | |
656 |
|
651 | |||
657 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', |
|
652 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', | |
658 | controller='followers', action='followers', |
|
653 | controller='followers', action='followers', | |
659 | conditions=dict(function=check_repo)) |
|
654 | conditions=dict(function=check_repo)) | |
660 |
|
655 | |||
661 | return rmap |
|
656 | return rmap |
@@ -1,340 +1,340 b'' | |||||
1 | <%page args="parent" /> |
|
1 | <%page args="parent" /> | |
2 | <div class="box"> |
|
2 | <div class="box"> | |
3 | <!-- box / title --> |
|
3 | <!-- box / title --> | |
4 | <div class="title"> |
|
4 | <div class="title"> | |
5 | <h5> |
|
5 | <h5> | |
6 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> ${parent.breadcrumbs()} <span id="repo_count">0</span> ${_('repositories')} |
|
6 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> ${parent.breadcrumbs()} <span id="repo_count">0</span> ${_('repositories')} | |
7 | </h5> |
|
7 | </h5> | |
8 | %if c.rhodecode_user.username != 'default': |
|
8 | %if c.rhodecode_user.username != 'default': | |
9 | <ul class="links"> |
|
9 | <ul class="links"> | |
10 | %if h.HasPermissionAny('hg.admin','hg.create.repository')() or h.HasReposGroupPermissionAny('group.write', 'group.admin')(c.group.group_name if c.group else None): |
|
10 | %if h.HasPermissionAny('hg.admin','hg.create.repository')() or h.HasReposGroupPermissionAny('group.write', 'group.admin')(c.group.group_name if c.group else None): | |
11 | <li> |
|
11 | <li> | |
12 | %if c.group: |
|
12 | %if c.group: | |
13 |
<span>${h.link_to(_('Add repository'),h.url(' |
|
13 | <span>${h.link_to(_('Add repository'),h.url('new_repo',parent_group=c.group.group_id))}</span> | |
14 | %if h.HasPermissionAny('hg.admin')() or h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): |
|
14 | %if h.HasPermissionAny('hg.admin')() or h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): | |
15 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group', parent_group=c.group.group_id))}</span> |
|
15 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group', parent_group=c.group.group_id))}</span> | |
16 | %endif |
|
16 | %endif | |
17 | %else: |
|
17 | %else: | |
18 |
<span>${h.link_to(_('Add repository'),h.url(' |
|
18 | <span>${h.link_to(_('Add repository'),h.url('new_repo'))}</span> | |
19 | %if h.HasPermissionAny('hg.admin')(): |
|
19 | %if h.HasPermissionAny('hg.admin')(): | |
20 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group'))}</span> |
|
20 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group'))}</span> | |
21 | %endif |
|
21 | %endif | |
22 | %endif |
|
22 | %endif | |
23 | </li> |
|
23 | </li> | |
24 | %endif |
|
24 | %endif | |
25 | %if c.group and h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): |
|
25 | %if c.group and h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): | |
26 | <li> |
|
26 | <li> | |
27 | <span>${h.link_to(_('Edit group'),h.url('edit_repos_group',group_name=c.group.group_name), title=_('You have admin right to this group, and can edit it'))}</span> |
|
27 | <span>${h.link_to(_('Edit group'),h.url('edit_repos_group',group_name=c.group.group_name), title=_('You have admin right to this group, and can edit it'))}</span> | |
28 | </li> |
|
28 | </li> | |
29 | %endif |
|
29 | %endif | |
30 | </ul> |
|
30 | </ul> | |
31 | %endif |
|
31 | %endif | |
32 | </div> |
|
32 | </div> | |
33 | <!-- end box / title --> |
|
33 | <!-- end box / title --> | |
34 | <div class="table"> |
|
34 | <div class="table"> | |
35 | % if c.groups: |
|
35 | % if c.groups: | |
36 | <div id='groups_list_wrap' class="yui-skin-sam"> |
|
36 | <div id='groups_list_wrap' class="yui-skin-sam"> | |
37 | <table id="groups_list"> |
|
37 | <table id="groups_list"> | |
38 | <thead> |
|
38 | <thead> | |
39 | <tr> |
|
39 | <tr> | |
40 | <th class="left"><a href="#">${_('Group name')}</a></th> |
|
40 | <th class="left"><a href="#">${_('Group name')}</a></th> | |
41 | <th class="left"><a href="#">${_('Description')}</a></th> |
|
41 | <th class="left"><a href="#">${_('Description')}</a></th> | |
42 | ##<th class="left"><a href="#">${_('Number of repositories')}</a></th> |
|
42 | ##<th class="left"><a href="#">${_('Number of repositories')}</a></th> | |
43 | </tr> |
|
43 | </tr> | |
44 | </thead> |
|
44 | </thead> | |
45 |
|
45 | |||
46 | ## REPO GROUPS |
|
46 | ## REPO GROUPS | |
47 | % for gr in c.groups: |
|
47 | % for gr in c.groups: | |
48 | <tr> |
|
48 | <tr> | |
49 | <td> |
|
49 | <td> | |
50 | <div style="white-space: nowrap"> |
|
50 | <div style="white-space: nowrap"> | |
51 | <img class="icon" alt="${_('Repository group')}" src="${h.url('/images/icons/database_link.png')}"/> |
|
51 | <img class="icon" alt="${_('Repository group')}" src="${h.url('/images/icons/database_link.png')}"/> | |
52 | ${h.link_to(gr.name,url('repos_group_home',group_name=gr.group_name))} |
|
52 | ${h.link_to(gr.name,url('repos_group_home',group_name=gr.group_name))} | |
53 | </div> |
|
53 | </div> | |
54 | </td> |
|
54 | </td> | |
55 | %if c.visual.stylify_metatags: |
|
55 | %if c.visual.stylify_metatags: | |
56 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> |
|
56 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> | |
57 | %else: |
|
57 | %else: | |
58 | <td>${gr.group_description}</td> |
|
58 | <td>${gr.group_description}</td> | |
59 | %endif |
|
59 | %endif | |
60 | ## this is commented out since for multi nested repos can be HEAVY! |
|
60 | ## this is commented out since for multi nested repos can be HEAVY! | |
61 | ## in number of executed queries during traversing uncomment at will |
|
61 | ## in number of executed queries during traversing uncomment at will | |
62 | ##<td><b>${gr.repositories_recursive_count}</b></td> |
|
62 | ##<td><b>${gr.repositories_recursive_count}</b></td> | |
63 | </tr> |
|
63 | </tr> | |
64 | % endfor |
|
64 | % endfor | |
65 | </table> |
|
65 | </table> | |
66 | </div> |
|
66 | </div> | |
67 | <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
67 | <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div> | |
68 | <div style="height: 20px"></div> |
|
68 | <div style="height: 20px"></div> | |
69 | % endif |
|
69 | % endif | |
70 | <div id="welcome" style="display:none;text-align:center"> |
|
70 | <div id="welcome" style="display:none;text-align:center"> | |
71 | <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1> |
|
71 | <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1> | |
72 | </div> |
|
72 | </div> | |
73 | <%cnt=0%> |
|
73 | <%cnt=0%> | |
74 | <%namespace name="dt" file="/data_table/_dt_elements.html"/> |
|
74 | <%namespace name="dt" file="/data_table/_dt_elements.html"/> | |
75 | % if not c.visual.lightweight_dashboard: |
|
75 | % if not c.visual.lightweight_dashboard: | |
76 | ## old full detailed version |
|
76 | ## old full detailed version | |
77 | <div id='repos_list_wrap' class="yui-skin-sam"> |
|
77 | <div id='repos_list_wrap' class="yui-skin-sam"> | |
78 | <table id="repos_list"> |
|
78 | <table id="repos_list"> | |
79 | <thead> |
|
79 | <thead> | |
80 | <tr> |
|
80 | <tr> | |
81 | <th class="left"></th> |
|
81 | <th class="left"></th> | |
82 | <th class="left">${_('Name')}</th> |
|
82 | <th class="left">${_('Name')}</th> | |
83 | <th class="left">${_('Description')}</th> |
|
83 | <th class="left">${_('Description')}</th> | |
84 | <th class="left">${_('Last change')}</th> |
|
84 | <th class="left">${_('Last change')}</th> | |
85 | <th class="left">${_('Tip')}</th> |
|
85 | <th class="left">${_('Tip')}</th> | |
86 | <th class="left">${_('Owner')}</th> |
|
86 | <th class="left">${_('Owner')}</th> | |
87 | <th class="left">${_('Atom')}</th> |
|
87 | <th class="left">${_('Atom')}</th> | |
88 | </tr> |
|
88 | </tr> | |
89 | </thead> |
|
89 | </thead> | |
90 | <tbody> |
|
90 | <tbody> | |
91 | %for cnt,repo in enumerate(c.repos_list): |
|
91 | %for cnt,repo in enumerate(c.repos_list): | |
92 | <tr class="parity${(cnt+1)%2}"> |
|
92 | <tr class="parity${(cnt+1)%2}"> | |
93 | ##QUICK MENU |
|
93 | ##QUICK MENU | |
94 | <td class="quick_repo_menu"> |
|
94 | <td class="quick_repo_menu"> | |
95 | ${dt.quick_menu(repo['name'])} |
|
95 | ${dt.quick_menu(repo['name'])} | |
96 | </td> |
|
96 | </td> | |
97 | ##REPO NAME AND ICONS |
|
97 | ##REPO NAME AND ICONS | |
98 | <td class="reponame"> |
|
98 | <td class="reponame"> | |
99 | ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']),pageargs.get('short_repo_names'))} |
|
99 | ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']),pageargs.get('short_repo_names'))} | |
100 | </td> |
|
100 | </td> | |
101 | ##DESCRIPTION |
|
101 | ##DESCRIPTION | |
102 | <td><span class="tooltip" title="${h.tooltip(repo['description'])}"> |
|
102 | <td><span class="tooltip" title="${h.tooltip(repo['description'])}"> | |
103 | %if c.visual.stylify_metatags: |
|
103 | %if c.visual.stylify_metatags: | |
104 | ${h.urlify_text(h.desc_stylize(h.truncate(repo['description'],60)))}</span> |
|
104 | ${h.urlify_text(h.desc_stylize(h.truncate(repo['description'],60)))}</span> | |
105 | %else: |
|
105 | %else: | |
106 | ${h.truncate(repo['description'],60)}</span> |
|
106 | ${h.truncate(repo['description'],60)}</span> | |
107 | %endif |
|
107 | %endif | |
108 | </td> |
|
108 | </td> | |
109 | ##LAST CHANGE DATE |
|
109 | ##LAST CHANGE DATE | |
110 | <td> |
|
110 | <td> | |
111 | ${dt.last_change(repo['last_change'])} |
|
111 | ${dt.last_change(repo['last_change'])} | |
112 | </td> |
|
112 | </td> | |
113 | ##LAST REVISION |
|
113 | ##LAST REVISION | |
114 | <td> |
|
114 | <td> | |
115 | ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])} |
|
115 | ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])} | |
116 | </td> |
|
116 | </td> | |
117 | ## |
|
117 | ## | |
118 | <td title="${repo['contact']}">${h.person(repo['contact'])}</td> |
|
118 | <td title="${repo['contact']}">${h.person(repo['contact'])}</td> | |
119 | <td> |
|
119 | <td> | |
120 | ${dt.atom(repo['name'])} |
|
120 | ${dt.atom(repo['name'])} | |
121 | </td> |
|
121 | </td> | |
122 | </tr> |
|
122 | </tr> | |
123 | %endfor |
|
123 | %endfor | |
124 | </tbody> |
|
124 | </tbody> | |
125 | </table> |
|
125 | </table> | |
126 | </div> |
|
126 | </div> | |
127 | % else: |
|
127 | % else: | |
128 | ## lightweight version |
|
128 | ## lightweight version | |
129 | <div class="yui-skin-sam" id="repos_list_wrap"></div> |
|
129 | <div class="yui-skin-sam" id="repos_list_wrap"></div> | |
130 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
130 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> | |
131 | % endif |
|
131 | % endif | |
132 | </div> |
|
132 | </div> | |
133 | </div> |
|
133 | </div> | |
134 | % if not c.visual.lightweight_dashboard: |
|
134 | % if not c.visual.lightweight_dashboard: | |
135 | <script> |
|
135 | <script> | |
136 | YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0}; |
|
136 | YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0}; | |
137 |
|
137 | |||
138 | // groups table sorting |
|
138 | // groups table sorting | |
139 | var myColumnDefs = [ |
|
139 | var myColumnDefs = [ | |
140 | {key:"name",label:"${_('Group name')}",sortable:true, |
|
140 | {key:"name",label:"${_('Group name')}",sortable:true, | |
141 | sortOptions: { sortFunction: groupNameSort }}, |
|
141 | sortOptions: { sortFunction: groupNameSort }}, | |
142 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
142 | {key:"desc",label:"${_('Description')}",sortable:true}, | |
143 | ]; |
|
143 | ]; | |
144 |
|
144 | |||
145 | var myDataSource = new YAHOO.util.DataSource(YUD.get("groups_list")); |
|
145 | var myDataSource = new YAHOO.util.DataSource(YUD.get("groups_list")); | |
146 |
|
146 | |||
147 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; |
|
147 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; | |
148 | myDataSource.responseSchema = { |
|
148 | myDataSource.responseSchema = { | |
149 | fields: [ |
|
149 | fields: [ | |
150 | {key:"name"}, |
|
150 | {key:"name"}, | |
151 | {key:"desc"}, |
|
151 | {key:"desc"}, | |
152 | ] |
|
152 | ] | |
153 | }; |
|
153 | }; | |
154 |
|
154 | |||
155 | var myDataTable = new YAHOO.widget.DataTable("groups_list_wrap", myColumnDefs, myDataSource,{ |
|
155 | var myDataTable = new YAHOO.widget.DataTable("groups_list_wrap", myColumnDefs, myDataSource,{ | |
156 | sortedBy:{key:"name",dir:"asc"}, |
|
156 | sortedBy:{key:"name",dir:"asc"}, | |
157 | paginator: new YAHOO.widget.Paginator({ |
|
157 | paginator: new YAHOO.widget.Paginator({ | |
158 | rowsPerPage: 50, |
|
158 | rowsPerPage: 50, | |
159 | alwaysVisible: false, |
|
159 | alwaysVisible: false, | |
160 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", |
|
160 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", | |
161 | pageLinks: 5, |
|
161 | pageLinks: 5, | |
162 | containerClass: 'pagination-wh', |
|
162 | containerClass: 'pagination-wh', | |
163 | currentPageClass: 'pager_curpage', |
|
163 | currentPageClass: 'pager_curpage', | |
164 | pageLinkClass: 'pager_link', |
|
164 | pageLinkClass: 'pager_link', | |
165 | nextPageLinkLabel: '>', |
|
165 | nextPageLinkLabel: '>', | |
166 | previousPageLinkLabel: '<', |
|
166 | previousPageLinkLabel: '<', | |
167 | firstPageLinkLabel: '<<', |
|
167 | firstPageLinkLabel: '<<', | |
168 | lastPageLinkLabel: '>>', |
|
168 | lastPageLinkLabel: '>>', | |
169 | containers:['group-user-paginator'] |
|
169 | containers:['group-user-paginator'] | |
170 | }), |
|
170 | }), | |
171 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
171 | MSG_SORTASC:"${_('Click to sort ascending')}", | |
172 | MSG_SORTDESC:"${_('Click to sort descending')}" |
|
172 | MSG_SORTDESC:"${_('Click to sort descending')}" | |
173 | }); |
|
173 | }); | |
174 |
|
174 | |||
175 | // main table sorting |
|
175 | // main table sorting | |
176 | var myColumnDefs = [ |
|
176 | var myColumnDefs = [ | |
177 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
177 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | |
178 | {key:"name",label:"${_('Name')}",sortable:true, |
|
178 | {key:"name",label:"${_('Name')}",sortable:true, | |
179 | sortOptions: { sortFunction: nameSort }}, |
|
179 | sortOptions: { sortFunction: nameSort }}, | |
180 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
180 | {key:"desc",label:"${_('Description')}",sortable:true}, | |
181 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
181 | {key:"last_change",label:"${_('Last Change')}",sortable:true, | |
182 | sortOptions: { sortFunction: ageSort }}, |
|
182 | sortOptions: { sortFunction: ageSort }}, | |
183 | {key:"tip",label:"${_('Tip')}",sortable:true, |
|
183 | {key:"tip",label:"${_('Tip')}",sortable:true, | |
184 | sortOptions: { sortFunction: revisionSort }}, |
|
184 | sortOptions: { sortFunction: revisionSort }}, | |
185 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
185 | {key:"owner",label:"${_('Owner')}",sortable:true}, | |
186 | {key:"atom",label:"",sortable:false}, |
|
186 | {key:"atom",label:"",sortable:false}, | |
187 | ]; |
|
187 | ]; | |
188 |
|
188 | |||
189 | var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list")); |
|
189 | var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list")); | |
190 |
|
190 | |||
191 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; |
|
191 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; | |
192 |
|
192 | |||
193 | myDataSource.responseSchema = { |
|
193 | myDataSource.responseSchema = { | |
194 | fields: [ |
|
194 | fields: [ | |
195 | {key:"menu"}, |
|
195 | {key:"menu"}, | |
196 | //{key:"raw_name"}, |
|
196 | //{key:"raw_name"}, | |
197 | {key:"name"}, |
|
197 | {key:"name"}, | |
198 | {key:"desc"}, |
|
198 | {key:"desc"}, | |
199 | {key:"last_change"}, |
|
199 | {key:"last_change"}, | |
200 | {key:"tip"}, |
|
200 | {key:"tip"}, | |
201 | {key:"owner"}, |
|
201 | {key:"owner"}, | |
202 | {key:"atom"}, |
|
202 | {key:"atom"}, | |
203 | ] |
|
203 | ] | |
204 | }; |
|
204 | }; | |
205 |
|
205 | |||
206 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource, |
|
206 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource, | |
207 | { |
|
207 | { | |
208 | sortedBy:{key:"name",dir:"asc"}, |
|
208 | sortedBy:{key:"name",dir:"asc"}, | |
209 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
209 | MSG_SORTASC:"${_('Click to sort ascending')}", | |
210 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
210 | MSG_SORTDESC:"${_('Click to sort descending')}", | |
211 | MSG_EMPTY:"${_('No records found.')}", |
|
211 | MSG_EMPTY:"${_('No records found.')}", | |
212 | MSG_ERROR:"${_('Data error.')}", |
|
212 | MSG_ERROR:"${_('Data error.')}", | |
213 | MSG_LOADING:"${_('Loading...')}", |
|
213 | MSG_LOADING:"${_('Loading...')}", | |
214 | } |
|
214 | } | |
215 | ); |
|
215 | ); | |
216 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
216 | myDataTable.subscribe('postRenderEvent',function(oArgs) { | |
217 | tooltip_activate(); |
|
217 | tooltip_activate(); | |
218 | quick_repo_menu(); |
|
218 | quick_repo_menu(); | |
219 | var func = function(node){ |
|
219 | var func = function(node){ | |
220 | return node.parentNode.parentNode.parentNode.parentNode; |
|
220 | return node.parentNode.parentNode.parentNode.parentNode; | |
221 | } |
|
221 | } | |
222 | q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func); |
|
222 | q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func); | |
223 | }); |
|
223 | }); | |
224 |
|
224 | |||
225 | </script> |
|
225 | </script> | |
226 | % else: |
|
226 | % else: | |
227 | <script> |
|
227 | <script> | |
228 | var data = ${c.data|n}; |
|
228 | var data = ${c.data|n}; | |
229 | var myDataSource = new YAHOO.util.DataSource(data); |
|
229 | var myDataSource = new YAHOO.util.DataSource(data); | |
230 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; |
|
230 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | |
231 |
|
231 | |||
232 | myDataSource.responseSchema = { |
|
232 | myDataSource.responseSchema = { | |
233 | resultsList: "records", |
|
233 | resultsList: "records", | |
234 | fields: [ |
|
234 | fields: [ | |
235 | {key:"menu"}, |
|
235 | {key:"menu"}, | |
236 | {key:"raw_name"}, |
|
236 | {key:"raw_name"}, | |
237 | {key:"name"}, |
|
237 | {key:"name"}, | |
238 | {key:"desc"}, |
|
238 | {key:"desc"}, | |
239 | {key:"last_change"}, |
|
239 | {key:"last_change"}, | |
240 | {key:"last_changeset"}, |
|
240 | {key:"last_changeset"}, | |
241 | {key:"owner"}, |
|
241 | {key:"owner"}, | |
242 | {key:"atom"}, |
|
242 | {key:"atom"}, | |
243 | ] |
|
243 | ] | |
244 | }; |
|
244 | }; | |
245 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { |
|
245 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { | |
246 | // This is the filter function |
|
246 | // This is the filter function | |
247 | var data = res.results || [], |
|
247 | var data = res.results || [], | |
248 | filtered = [], |
|
248 | filtered = [], | |
249 | i,l; |
|
249 | i,l; | |
250 |
|
250 | |||
251 | if (req) { |
|
251 | if (req) { | |
252 | req = req.toLowerCase(); |
|
252 | req = req.toLowerCase(); | |
253 | for (i = 0; i<data.length; i++) { |
|
253 | for (i = 0; i<data.length; i++) { | |
254 | var pos = data[i].raw_name.toLowerCase().indexOf(req) |
|
254 | var pos = data[i].raw_name.toLowerCase().indexOf(req) | |
255 | if (pos != -1) { |
|
255 | if (pos != -1) { | |
256 | filtered.push(data[i]); |
|
256 | filtered.push(data[i]); | |
257 | } |
|
257 | } | |
258 | } |
|
258 | } | |
259 | res.results = filtered; |
|
259 | res.results = filtered; | |
260 | } |
|
260 | } | |
261 | YUD.get('repo_count').innerHTML = res.results.length; |
|
261 | YUD.get('repo_count').innerHTML = res.results.length; | |
262 | return res; |
|
262 | return res; | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 | // main table sorting |
|
265 | // main table sorting | |
266 | var myColumnDefs = [ |
|
266 | var myColumnDefs = [ | |
267 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
267 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | |
268 | {key:"name",label:"${_('Name')}",sortable:true, |
|
268 | {key:"name",label:"${_('Name')}",sortable:true, | |
269 | sortOptions: { sortFunction: nameSort }}, |
|
269 | sortOptions: { sortFunction: nameSort }}, | |
270 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
270 | {key:"desc",label:"${_('Description')}",sortable:true}, | |
271 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
271 | {key:"last_change",label:"${_('Last Change')}",sortable:true, | |
272 | sortOptions: { sortFunction: ageSort }}, |
|
272 | sortOptions: { sortFunction: ageSort }}, | |
273 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, |
|
273 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, | |
274 | sortOptions: { sortFunction: revisionSort }}, |
|
274 | sortOptions: { sortFunction: revisionSort }}, | |
275 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
275 | {key:"owner",label:"${_('Owner')}",sortable:true}, | |
276 | {key:"atom",label:"",sortable:false}, |
|
276 | {key:"atom",label:"",sortable:false}, | |
277 | ]; |
|
277 | ]; | |
278 |
|
278 | |||
279 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ |
|
279 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ | |
280 | sortedBy:{key:"name",dir:"asc"}, |
|
280 | sortedBy:{key:"name",dir:"asc"}, | |
281 | paginator: new YAHOO.widget.Paginator({ |
|
281 | paginator: new YAHOO.widget.Paginator({ | |
282 | rowsPerPage: ${c.visual.lightweight_dashboard_items}, |
|
282 | rowsPerPage: ${c.visual.lightweight_dashboard_items}, | |
283 | alwaysVisible: false, |
|
283 | alwaysVisible: false, | |
284 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", |
|
284 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", | |
285 | pageLinks: 5, |
|
285 | pageLinks: 5, | |
286 | containerClass: 'pagination-wh', |
|
286 | containerClass: 'pagination-wh', | |
287 | currentPageClass: 'pager_curpage', |
|
287 | currentPageClass: 'pager_curpage', | |
288 | pageLinkClass: 'pager_link', |
|
288 | pageLinkClass: 'pager_link', | |
289 | nextPageLinkLabel: '>', |
|
289 | nextPageLinkLabel: '>', | |
290 | previousPageLinkLabel: '<', |
|
290 | previousPageLinkLabel: '<', | |
291 | firstPageLinkLabel: '<<', |
|
291 | firstPageLinkLabel: '<<', | |
292 | lastPageLinkLabel: '>>', |
|
292 | lastPageLinkLabel: '>>', | |
293 | containers:['user-paginator'] |
|
293 | containers:['user-paginator'] | |
294 | }), |
|
294 | }), | |
295 |
|
295 | |||
296 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
296 | MSG_SORTASC:"${_('Click to sort ascending')}", | |
297 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
297 | MSG_SORTDESC:"${_('Click to sort descending')}", | |
298 | MSG_EMPTY:"${_('No repositories found.')}", |
|
298 | MSG_EMPTY:"${_('No repositories found.')}", | |
299 | MSG_ERROR:"${_('Data error.')}", |
|
299 | MSG_ERROR:"${_('Data error.')}", | |
300 | MSG_LOADING:"${_('Loading...')}", |
|
300 | MSG_LOADING:"${_('Loading...')}", | |
301 | } |
|
301 | } | |
302 | ); |
|
302 | ); | |
303 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
303 | myDataTable.subscribe('postRenderEvent',function(oArgs) { | |
304 | tooltip_activate(); |
|
304 | tooltip_activate(); | |
305 | quick_repo_menu(); |
|
305 | quick_repo_menu(); | |
306 | }); |
|
306 | }); | |
307 |
|
307 | |||
308 | var filterTimeout = null; |
|
308 | var filterTimeout = null; | |
309 |
|
309 | |||
310 | updateFilter = function () { |
|
310 | updateFilter = function () { | |
311 | // Reset timeout |
|
311 | // Reset timeout | |
312 | filterTimeout = null; |
|
312 | filterTimeout = null; | |
313 |
|
313 | |||
314 | // Reset sort |
|
314 | // Reset sort | |
315 | var state = myDataTable.getState(); |
|
315 | var state = myDataTable.getState(); | |
316 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; |
|
316 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | |
317 |
|
317 | |||
318 | // Get filtered data |
|
318 | // Get filtered data | |
319 | myDataSource.sendRequest(YUD.get('q_filter').value,{ |
|
319 | myDataSource.sendRequest(YUD.get('q_filter').value,{ | |
320 | success : myDataTable.onDataReturnInitializeTable, |
|
320 | success : myDataTable.onDataReturnInitializeTable, | |
321 | failure : myDataTable.onDataReturnInitializeTable, |
|
321 | failure : myDataTable.onDataReturnInitializeTable, | |
322 | scope : myDataTable, |
|
322 | scope : myDataTable, | |
323 | argument: state |
|
323 | argument: state | |
324 | }); |
|
324 | }); | |
325 |
|
325 | |||
326 | }; |
|
326 | }; | |
327 | YUE.on('q_filter','click',function(){ |
|
327 | YUE.on('q_filter','click',function(){ | |
328 | if(!YUD.hasClass('q_filter', 'loaded')){ |
|
328 | if(!YUD.hasClass('q_filter', 'loaded')){ | |
329 | YUD.get('q_filter').value = ''; |
|
329 | YUD.get('q_filter').value = ''; | |
330 | //TODO: load here full list later to do search within groups |
|
330 | //TODO: load here full list later to do search within groups | |
331 | YUD.addClass('q_filter', 'loaded'); |
|
331 | YUD.addClass('q_filter', 'loaded'); | |
332 | } |
|
332 | } | |
333 | }); |
|
333 | }); | |
334 |
|
334 | |||
335 | YUE.on('q_filter','keyup',function (e) { |
|
335 | YUE.on('q_filter','keyup',function (e) { | |
336 | clearTimeout(filterTimeout); |
|
336 | clearTimeout(filterTimeout); | |
337 | filterTimeout = setTimeout(updateFilter,600); |
|
337 | filterTimeout = setTimeout(updateFilter,600); | |
338 | }); |
|
338 | }); | |
339 | </script> |
|
339 | </script> | |
340 | % endif |
|
340 | % endif |
General Comments 0
You need to be logged in to leave comments.
Login now