Show More
@@ -1,635 +1,639 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 |
|
148 | |||
149 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
149 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
150 | controller='admin/repos_groups') as m: |
|
150 | controller='admin/repos_groups') as m: | |
151 | m.connect("repos_groups", "/repos_groups", |
|
151 | m.connect("repos_groups", "/repos_groups", | |
152 | action="create", conditions=dict(method=["POST"])) |
|
152 | action="create", conditions=dict(method=["POST"])) | |
153 | m.connect("repos_groups", "/repos_groups", |
|
153 | m.connect("repos_groups", "/repos_groups", | |
154 | action="index", conditions=dict(method=["GET"])) |
|
154 | action="index", conditions=dict(method=["GET"])) | |
155 | m.connect("formatted_repos_groups", "/repos_groups.{format}", |
|
155 | m.connect("formatted_repos_groups", "/repos_groups.{format}", | |
156 | action="index", conditions=dict(method=["GET"])) |
|
156 | action="index", conditions=dict(method=["GET"])) | |
157 | m.connect("new_repos_group", "/repos_groups/new", |
|
157 | m.connect("new_repos_group", "/repos_groups/new", | |
158 | action="new", conditions=dict(method=["GET"])) |
|
158 | action="new", conditions=dict(method=["GET"])) | |
159 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", |
|
159 | m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", | |
160 | action="new", conditions=dict(method=["GET"])) |
|
160 | action="new", conditions=dict(method=["GET"])) | |
161 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", |
|
161 | m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", | |
162 | action="update", conditions=dict(method=["PUT"], |
|
162 | action="update", conditions=dict(method=["PUT"], | |
163 | function=check_group)) |
|
163 | function=check_group)) | |
164 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", |
|
164 | m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", | |
165 | action="delete", conditions=dict(method=["DELETE"], |
|
165 | action="delete", conditions=dict(method=["DELETE"], | |
166 | function=check_group)) |
|
166 | function=check_group)) | |
167 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", |
|
167 | m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", | |
168 | action="edit", conditions=dict(method=["GET"],)) |
|
168 | action="edit", conditions=dict(method=["GET"],)) | |
169 | m.connect("formatted_edit_repos_group", |
|
169 | m.connect("formatted_edit_repos_group", | |
170 | "/repos_groups/{group_name:.*?}.{format}/edit", |
|
170 | "/repos_groups/{group_name:.*?}.{format}/edit", | |
171 | action="edit", conditions=dict(method=["GET"], |
|
171 | action="edit", conditions=dict(method=["GET"], | |
172 | function=check_group)) |
|
172 | function=check_group)) | |
173 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", |
|
173 | m.connect("repos_group", "/repos_groups/{group_name:.*?}", | |
174 | action="show", conditions=dict(method=["GET"], |
|
174 | action="show", conditions=dict(method=["GET"], | |
175 | function=check_group)) |
|
175 | function=check_group)) | |
176 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", |
|
176 | m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}", | |
177 | action="show", conditions=dict(method=["GET"], |
|
177 | action="show", conditions=dict(method=["GET"], | |
178 | function=check_group)) |
|
178 | function=check_group)) | |
179 | # ajax delete repos group perm user |
|
179 | # ajax delete repos group perm user | |
180 | m.connect('delete_repos_group_user_perm', |
|
180 | m.connect('delete_repos_group_user_perm', | |
181 | "/delete_repos_group_user_perm/{group_name:.*?}", |
|
181 | "/delete_repos_group_user_perm/{group_name:.*?}", | |
182 | action="delete_repos_group_user_perm", |
|
182 | action="delete_repos_group_user_perm", | |
183 | conditions=dict(method=["DELETE"], function=check_group)) |
|
183 | conditions=dict(method=["DELETE"], function=check_group)) | |
184 |
|
184 | |||
185 | # ajax delete repos group perm users_group |
|
185 | # ajax delete repos group perm users_group | |
186 | m.connect('delete_repos_group_users_group_perm', |
|
186 | m.connect('delete_repos_group_users_group_perm', | |
187 | "/delete_repos_group_users_group_perm/{group_name:.*?}", |
|
187 | "/delete_repos_group_users_group_perm/{group_name:.*?}", | |
188 | action="delete_repos_group_users_group_perm", |
|
188 | action="delete_repos_group_users_group_perm", | |
189 | conditions=dict(method=["DELETE"], function=check_group)) |
|
189 | conditions=dict(method=["DELETE"], function=check_group)) | |
190 |
|
190 | |||
191 | #ADMIN USER REST ROUTES |
|
191 | #ADMIN USER REST ROUTES | |
192 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
192 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
193 | controller='admin/users') as m: |
|
193 | controller='admin/users') as m: | |
194 | m.connect("users", "/users", |
|
194 | m.connect("users", "/users", | |
195 | action="create", conditions=dict(method=["POST"])) |
|
195 | action="create", conditions=dict(method=["POST"])) | |
196 | m.connect("users", "/users", |
|
196 | m.connect("users", "/users", | |
197 | action="index", conditions=dict(method=["GET"])) |
|
197 | action="index", conditions=dict(method=["GET"])) | |
198 | m.connect("formatted_users", "/users.{format}", |
|
198 | m.connect("formatted_users", "/users.{format}", | |
199 | action="index", conditions=dict(method=["GET"])) |
|
199 | action="index", conditions=dict(method=["GET"])) | |
200 | m.connect("new_user", "/users/new", |
|
200 | m.connect("new_user", "/users/new", | |
201 | action="new", conditions=dict(method=["GET"])) |
|
201 | action="new", conditions=dict(method=["GET"])) | |
202 | m.connect("formatted_new_user", "/users/new.{format}", |
|
202 | m.connect("formatted_new_user", "/users/new.{format}", | |
203 | action="new", conditions=dict(method=["GET"])) |
|
203 | action="new", conditions=dict(method=["GET"])) | |
204 | m.connect("update_user", "/users/{id}", |
|
204 | m.connect("update_user", "/users/{id}", | |
205 | action="update", conditions=dict(method=["PUT"])) |
|
205 | action="update", conditions=dict(method=["PUT"])) | |
206 | m.connect("delete_user", "/users/{id}", |
|
206 | m.connect("delete_user", "/users/{id}", | |
207 | action="delete", conditions=dict(method=["DELETE"])) |
|
207 | action="delete", conditions=dict(method=["DELETE"])) | |
208 | m.connect("edit_user", "/users/{id}/edit", |
|
208 | m.connect("edit_user", "/users/{id}/edit", | |
209 | action="edit", conditions=dict(method=["GET"])) |
|
209 | action="edit", conditions=dict(method=["GET"])) | |
210 | m.connect("formatted_edit_user", |
|
210 | m.connect("formatted_edit_user", | |
211 | "/users/{id}.{format}/edit", |
|
211 | "/users/{id}.{format}/edit", | |
212 | action="edit", conditions=dict(method=["GET"])) |
|
212 | action="edit", conditions=dict(method=["GET"])) | |
213 | m.connect("user", "/users/{id}", |
|
213 | m.connect("user", "/users/{id}", | |
214 | action="show", conditions=dict(method=["GET"])) |
|
214 | action="show", conditions=dict(method=["GET"])) | |
215 | m.connect("formatted_user", "/users/{id}.{format}", |
|
215 | m.connect("formatted_user", "/users/{id}.{format}", | |
216 | action="show", conditions=dict(method=["GET"])) |
|
216 | action="show", conditions=dict(method=["GET"])) | |
217 |
|
217 | |||
218 | #EXTRAS USER ROUTES |
|
218 | #EXTRAS USER ROUTES | |
219 | m.connect("user_perm", "/users_perm/{id}", |
|
219 | m.connect("user_perm", "/users_perm/{id}", | |
220 | action="update_perm", conditions=dict(method=["PUT"])) |
|
220 | action="update_perm", conditions=dict(method=["PUT"])) | |
221 | m.connect("user_emails", "/users_emails/{id}", |
|
221 | m.connect("user_emails", "/users_emails/{id}", | |
222 | action="add_email", conditions=dict(method=["PUT"])) |
|
222 | action="add_email", conditions=dict(method=["PUT"])) | |
223 | m.connect("user_emails_delete", "/users_emails/{id}", |
|
223 | m.connect("user_emails_delete", "/users_emails/{id}", | |
224 | action="delete_email", conditions=dict(method=["DELETE"])) |
|
224 | action="delete_email", conditions=dict(method=["DELETE"])) | |
225 | m.connect("user_ips", "/users_ips/{id}", |
|
225 | m.connect("user_ips", "/users_ips/{id}", | |
226 | action="add_ip", conditions=dict(method=["PUT"])) |
|
226 | action="add_ip", conditions=dict(method=["PUT"])) | |
227 | m.connect("user_ips_delete", "/users_ips/{id}", |
|
227 | m.connect("user_ips_delete", "/users_ips/{id}", | |
228 | action="delete_ip", conditions=dict(method=["DELETE"])) |
|
228 | action="delete_ip", conditions=dict(method=["DELETE"])) | |
229 |
|
229 | |||
230 | #ADMIN USERS GROUPS REST ROUTES |
|
230 | #ADMIN USERS GROUPS REST ROUTES | |
231 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
231 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
232 | controller='admin/users_groups') as m: |
|
232 | controller='admin/users_groups') as m: | |
233 | m.connect("users_groups", "/users_groups", |
|
233 | m.connect("users_groups", "/users_groups", | |
234 | action="create", conditions=dict(method=["POST"])) |
|
234 | action="create", conditions=dict(method=["POST"])) | |
235 | m.connect("users_groups", "/users_groups", |
|
235 | m.connect("users_groups", "/users_groups", | |
236 | action="index", conditions=dict(method=["GET"])) |
|
236 | action="index", conditions=dict(method=["GET"])) | |
237 | m.connect("formatted_users_groups", "/users_groups.{format}", |
|
237 | m.connect("formatted_users_groups", "/users_groups.{format}", | |
238 | action="index", conditions=dict(method=["GET"])) |
|
238 | action="index", conditions=dict(method=["GET"])) | |
239 | m.connect("new_users_group", "/users_groups/new", |
|
239 | m.connect("new_users_group", "/users_groups/new", | |
240 | action="new", conditions=dict(method=["GET"])) |
|
240 | action="new", conditions=dict(method=["GET"])) | |
241 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", |
|
241 | m.connect("formatted_new_users_group", "/users_groups/new.{format}", | |
242 | action="new", conditions=dict(method=["GET"])) |
|
242 | action="new", conditions=dict(method=["GET"])) | |
243 | m.connect("update_users_group", "/users_groups/{id}", |
|
243 | m.connect("update_users_group", "/users_groups/{id}", | |
244 | action="update", conditions=dict(method=["PUT"])) |
|
244 | action="update", conditions=dict(method=["PUT"])) | |
245 | m.connect("delete_users_group", "/users_groups/{id}", |
|
245 | m.connect("delete_users_group", "/users_groups/{id}", | |
246 | action="delete", conditions=dict(method=["DELETE"])) |
|
246 | action="delete", conditions=dict(method=["DELETE"])) | |
247 | m.connect("edit_users_group", "/users_groups/{id}/edit", |
|
247 | m.connect("edit_users_group", "/users_groups/{id}/edit", | |
248 | action="edit", conditions=dict(method=["GET"])) |
|
248 | action="edit", conditions=dict(method=["GET"])) | |
249 | m.connect("formatted_edit_users_group", |
|
249 | m.connect("formatted_edit_users_group", | |
250 | "/users_groups/{id}.{format}/edit", |
|
250 | "/users_groups/{id}.{format}/edit", | |
251 | action="edit", conditions=dict(method=["GET"])) |
|
251 | action="edit", conditions=dict(method=["GET"])) | |
252 | m.connect("users_group", "/users_groups/{id}", |
|
252 | m.connect("users_group", "/users_groups/{id}", | |
253 | action="show", conditions=dict(method=["GET"])) |
|
253 | action="show", conditions=dict(method=["GET"])) | |
254 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", |
|
254 | m.connect("formatted_users_group", "/users_groups/{id}.{format}", | |
255 | action="show", conditions=dict(method=["GET"])) |
|
255 | action="show", conditions=dict(method=["GET"])) | |
256 |
|
256 | |||
257 | #EXTRAS USER ROUTES |
|
257 | #EXTRAS USER ROUTES | |
258 | m.connect("users_group_perm", "/users_groups_perm/{id}", |
|
258 | m.connect("users_group_perm", "/users_groups_perm/{id}", | |
259 | action="update_perm", conditions=dict(method=["PUT"])) |
|
259 | action="update_perm", conditions=dict(method=["PUT"])) | |
260 |
|
260 | |||
261 | #ADMIN GROUP REST ROUTES |
|
261 | #ADMIN GROUP REST ROUTES | |
262 | rmap.resource('group', 'groups', |
|
262 | rmap.resource('group', 'groups', | |
263 | controller='admin/groups', path_prefix=ADMIN_PREFIX) |
|
263 | controller='admin/groups', path_prefix=ADMIN_PREFIX) | |
264 |
|
264 | |||
265 | #ADMIN PERMISSIONS REST ROUTES |
|
265 | #ADMIN PERMISSIONS REST ROUTES | |
266 | rmap.resource('permission', 'permissions', |
|
266 | rmap.resource('permission', 'permissions', | |
267 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) |
|
267 | controller='admin/permissions', path_prefix=ADMIN_PREFIX) | |
268 |
|
268 | |||
269 | #ADMIN DEFAULTS REST ROUTES |
|
269 | #ADMIN DEFAULTS REST ROUTES | |
270 | rmap.resource('default', 'defaults', |
|
270 | rmap.resource('default', 'defaults', | |
271 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) |
|
271 | controller='admin/defaults', path_prefix=ADMIN_PREFIX) | |
272 |
|
272 | |||
273 | ##ADMIN LDAP SETTINGS |
|
273 | ##ADMIN LDAP SETTINGS | |
274 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, |
|
274 | rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, | |
275 | controller='admin/ldap_settings', action='ldap_settings', |
|
275 | controller='admin/ldap_settings', action='ldap_settings', | |
276 | conditions=dict(method=["POST"])) |
|
276 | conditions=dict(method=["POST"])) | |
277 |
|
277 | |||
278 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, |
|
278 | rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX, | |
279 | controller='admin/ldap_settings') |
|
279 | controller='admin/ldap_settings') | |
280 |
|
280 | |||
281 | #ADMIN SETTINGS REST ROUTES |
|
281 | #ADMIN SETTINGS REST ROUTES | |
282 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
282 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
283 | controller='admin/settings') as m: |
|
283 | controller='admin/settings') as m: | |
284 | m.connect("admin_settings", "/settings", |
|
284 | m.connect("admin_settings", "/settings", | |
285 | action="create", conditions=dict(method=["POST"])) |
|
285 | action="create", conditions=dict(method=["POST"])) | |
286 | m.connect("admin_settings", "/settings", |
|
286 | m.connect("admin_settings", "/settings", | |
287 | action="index", conditions=dict(method=["GET"])) |
|
287 | action="index", conditions=dict(method=["GET"])) | |
288 | m.connect("formatted_admin_settings", "/settings.{format}", |
|
288 | m.connect("formatted_admin_settings", "/settings.{format}", | |
289 | action="index", conditions=dict(method=["GET"])) |
|
289 | action="index", conditions=dict(method=["GET"])) | |
290 | m.connect("admin_new_setting", "/settings/new", |
|
290 | m.connect("admin_new_setting", "/settings/new", | |
291 | action="new", conditions=dict(method=["GET"])) |
|
291 | action="new", conditions=dict(method=["GET"])) | |
292 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", |
|
292 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", | |
293 | action="new", conditions=dict(method=["GET"])) |
|
293 | action="new", conditions=dict(method=["GET"])) | |
294 | m.connect("/settings/{setting_id}", |
|
294 | m.connect("/settings/{setting_id}", | |
295 | action="update", conditions=dict(method=["PUT"])) |
|
295 | action="update", conditions=dict(method=["PUT"])) | |
296 | m.connect("/settings/{setting_id}", |
|
296 | m.connect("/settings/{setting_id}", | |
297 | action="delete", conditions=dict(method=["DELETE"])) |
|
297 | action="delete", conditions=dict(method=["DELETE"])) | |
298 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", |
|
298 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", | |
299 | action="edit", conditions=dict(method=["GET"])) |
|
299 | action="edit", conditions=dict(method=["GET"])) | |
300 | m.connect("formatted_admin_edit_setting", |
|
300 | m.connect("formatted_admin_edit_setting", | |
301 | "/settings/{setting_id}.{format}/edit", |
|
301 | "/settings/{setting_id}.{format}/edit", | |
302 | action="edit", conditions=dict(method=["GET"])) |
|
302 | action="edit", conditions=dict(method=["GET"])) | |
303 | m.connect("admin_setting", "/settings/{setting_id}", |
|
303 | m.connect("admin_setting", "/settings/{setting_id}", | |
304 | action="show", conditions=dict(method=["GET"])) |
|
304 | action="show", conditions=dict(method=["GET"])) | |
305 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", |
|
305 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", | |
306 | action="show", conditions=dict(method=["GET"])) |
|
306 | action="show", conditions=dict(method=["GET"])) | |
307 | m.connect("admin_settings_my_account", "/my_account", |
|
307 | m.connect("admin_settings_my_account", "/my_account", | |
308 | action="my_account", conditions=dict(method=["GET"])) |
|
308 | action="my_account", conditions=dict(method=["GET"])) | |
309 | m.connect("admin_settings_my_account_update", "/my_account_update", |
|
309 | m.connect("admin_settings_my_account_update", "/my_account_update", | |
310 | action="my_account_update", conditions=dict(method=["PUT"])) |
|
310 | action="my_account_update", conditions=dict(method=["PUT"])) | |
311 | m.connect("admin_settings_create_repository", "/create_repository", |
|
311 | m.connect("admin_settings_create_repository", "/create_repository", | |
312 | action="create_repository", conditions=dict(method=["GET"])) |
|
312 | action="create_repository", conditions=dict(method=["GET"])) | |
313 | m.connect("admin_settings_my_repos", "/my_account/repos", |
|
313 | m.connect("admin_settings_my_repos", "/my_account/repos", | |
314 | action="my_account_my_repos", conditions=dict(method=["GET"])) |
|
314 | action="my_account_my_repos", conditions=dict(method=["GET"])) | |
315 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", |
|
315 | m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests", | |
316 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) |
|
316 | action="my_account_my_pullrequests", conditions=dict(method=["GET"])) | |
317 |
|
317 | |||
318 | #NOTIFICATION REST ROUTES |
|
318 | #NOTIFICATION REST ROUTES | |
319 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
319 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
320 | controller='admin/notifications') as m: |
|
320 | controller='admin/notifications') as m: | |
321 | m.connect("notifications", "/notifications", |
|
321 | m.connect("notifications", "/notifications", | |
322 | action="create", conditions=dict(method=["POST"])) |
|
322 | action="create", conditions=dict(method=["POST"])) | |
323 | m.connect("notifications", "/notifications", |
|
323 | m.connect("notifications", "/notifications", | |
324 | action="index", conditions=dict(method=["GET"])) |
|
324 | action="index", conditions=dict(method=["GET"])) | |
325 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", |
|
325 | m.connect("notifications_mark_all_read", "/notifications/mark_all_read", | |
326 | action="mark_all_read", conditions=dict(method=["GET"])) |
|
326 | action="mark_all_read", conditions=dict(method=["GET"])) | |
327 | m.connect("formatted_notifications", "/notifications.{format}", |
|
327 | m.connect("formatted_notifications", "/notifications.{format}", | |
328 | action="index", conditions=dict(method=["GET"])) |
|
328 | action="index", conditions=dict(method=["GET"])) | |
329 | m.connect("new_notification", "/notifications/new", |
|
329 | m.connect("new_notification", "/notifications/new", | |
330 | action="new", conditions=dict(method=["GET"])) |
|
330 | action="new", conditions=dict(method=["GET"])) | |
331 | m.connect("formatted_new_notification", "/notifications/new.{format}", |
|
331 | m.connect("formatted_new_notification", "/notifications/new.{format}", | |
332 | action="new", conditions=dict(method=["GET"])) |
|
332 | action="new", conditions=dict(method=["GET"])) | |
333 | m.connect("/notification/{notification_id}", |
|
333 | m.connect("/notification/{notification_id}", | |
334 | action="update", conditions=dict(method=["PUT"])) |
|
334 | action="update", conditions=dict(method=["PUT"])) | |
335 | m.connect("/notification/{notification_id}", |
|
335 | m.connect("/notification/{notification_id}", | |
336 | action="delete", conditions=dict(method=["DELETE"])) |
|
336 | action="delete", conditions=dict(method=["DELETE"])) | |
337 | m.connect("edit_notification", "/notification/{notification_id}/edit", |
|
337 | m.connect("edit_notification", "/notification/{notification_id}/edit", | |
338 | action="edit", conditions=dict(method=["GET"])) |
|
338 | action="edit", conditions=dict(method=["GET"])) | |
339 | m.connect("formatted_edit_notification", |
|
339 | m.connect("formatted_edit_notification", | |
340 | "/notification/{notification_id}.{format}/edit", |
|
340 | "/notification/{notification_id}.{format}/edit", | |
341 | action="edit", conditions=dict(method=["GET"])) |
|
341 | action="edit", conditions=dict(method=["GET"])) | |
342 | m.connect("notification", "/notification/{notification_id}", |
|
342 | m.connect("notification", "/notification/{notification_id}", | |
343 | action="show", conditions=dict(method=["GET"])) |
|
343 | action="show", conditions=dict(method=["GET"])) | |
344 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", |
|
344 | m.connect("formatted_notification", "/notifications/{notification_id}.{format}", | |
345 | action="show", conditions=dict(method=["GET"])) |
|
345 | action="show", conditions=dict(method=["GET"])) | |
346 |
|
346 | |||
347 | #ADMIN MAIN PAGES |
|
347 | #ADMIN MAIN PAGES | |
348 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
348 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
349 | controller='admin/admin') as m: |
|
349 | controller='admin/admin') as m: | |
350 | m.connect('admin_home', '', action='index') |
|
350 | m.connect('admin_home', '', action='index') | |
351 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
351 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
352 | action='add_repo') |
|
352 | action='add_repo') | |
353 |
|
353 | |||
354 | #========================================================================== |
|
354 | #========================================================================== | |
355 | # API V2 |
|
355 | # API V2 | |
356 | #========================================================================== |
|
356 | #========================================================================== | |
357 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
357 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
358 | controller='api/api') as m: |
|
358 | controller='api/api') as m: | |
359 | m.connect('api', '/api') |
|
359 | m.connect('api', '/api') | |
360 |
|
360 | |||
361 | #USER JOURNAL |
|
361 | #USER JOURNAL | |
362 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, |
|
362 | rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, | |
363 | controller='journal', action='index') |
|
363 | controller='journal', action='index') | |
364 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, |
|
364 | rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, | |
365 | controller='journal', action='journal_rss') |
|
365 | controller='journal', action='journal_rss') | |
366 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, |
|
366 | rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, | |
367 | controller='journal', action='journal_atom') |
|
367 | controller='journal', action='journal_atom') | |
368 |
|
368 | |||
369 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, |
|
369 | rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, | |
370 | controller='journal', action="public_journal") |
|
370 | controller='journal', action="public_journal") | |
371 |
|
371 | |||
372 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, |
|
372 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, | |
373 | controller='journal', action="public_journal_rss") |
|
373 | controller='journal', action="public_journal_rss") | |
374 |
|
374 | |||
375 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, |
|
375 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, | |
376 | controller='journal', action="public_journal_rss") |
|
376 | controller='journal', action="public_journal_rss") | |
377 |
|
377 | |||
378 | rmap.connect('public_journal_atom', |
|
378 | rmap.connect('public_journal_atom', | |
379 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', |
|
379 | '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', | |
380 | action="public_journal_atom") |
|
380 | action="public_journal_atom") | |
381 |
|
381 | |||
382 | rmap.connect('public_journal_atom_old', |
|
382 | rmap.connect('public_journal_atom_old', | |
383 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', |
|
383 | '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', | |
384 | action="public_journal_atom") |
|
384 | action="public_journal_atom") | |
385 |
|
385 | |||
386 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, |
|
386 | rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX, | |
387 | controller='journal', action='toggle_following', |
|
387 | controller='journal', action='toggle_following', | |
388 | conditions=dict(method=["POST"])) |
|
388 | conditions=dict(method=["POST"])) | |
389 |
|
389 | |||
390 | #SEARCH |
|
390 | #SEARCH | |
391 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) |
|
391 | rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',) | |
392 |
rmap.connect('search_repo', '%s/search/{ |
|
392 | rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX, | |
393 |
|
|
393 | controller='search') | |
|
394 | rmap.connect('search_repo', '/{repo_name:.*?}/search', | |||
|
395 | controller='search', | |||
|
396 | conditions=dict(function=check_repo), | |||
|
397 | ) | |||
394 |
|
398 | |||
395 | #LOGIN/LOGOUT/REGISTER/SIGN IN |
|
399 | #LOGIN/LOGOUT/REGISTER/SIGN IN | |
396 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') |
|
400 | rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login') | |
397 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', |
|
401 | rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login', | |
398 | action='logout') |
|
402 | action='logout') | |
399 |
|
403 | |||
400 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', |
|
404 | rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login', | |
401 | action='register') |
|
405 | action='register') | |
402 |
|
406 | |||
403 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, |
|
407 | rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX, | |
404 | controller='login', action='password_reset') |
|
408 | controller='login', action='password_reset') | |
405 |
|
409 | |||
406 | rmap.connect('reset_password_confirmation', |
|
410 | rmap.connect('reset_password_confirmation', | |
407 | '%s/password_reset_confirmation' % ADMIN_PREFIX, |
|
411 | '%s/password_reset_confirmation' % ADMIN_PREFIX, | |
408 | controller='login', action='password_reset_confirmation') |
|
412 | controller='login', action='password_reset_confirmation') | |
409 |
|
413 | |||
410 | #FEEDS |
|
414 | #FEEDS | |
411 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', |
|
415 | rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss', | |
412 | controller='feed', action='rss', |
|
416 | controller='feed', action='rss', | |
413 | conditions=dict(function=check_repo)) |
|
417 | conditions=dict(function=check_repo)) | |
414 |
|
418 | |||
415 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', |
|
419 | rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom', | |
416 | controller='feed', action='atom', |
|
420 | controller='feed', action='atom', | |
417 | conditions=dict(function=check_repo)) |
|
421 | conditions=dict(function=check_repo)) | |
418 |
|
422 | |||
419 | #========================================================================== |
|
423 | #========================================================================== | |
420 | # REPOSITORY ROUTES |
|
424 | # REPOSITORY ROUTES | |
421 | #========================================================================== |
|
425 | #========================================================================== | |
422 | rmap.connect('summary_home', '/{repo_name:.*?}', |
|
426 | rmap.connect('summary_home', '/{repo_name:.*?}', | |
423 | controller='summary', |
|
427 | controller='summary', | |
424 | conditions=dict(function=check_repo)) |
|
428 | conditions=dict(function=check_repo)) | |
425 |
|
429 | |||
426 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', |
|
430 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', | |
427 | controller='summary', action='repo_size', |
|
431 | controller='summary', action='repo_size', | |
428 | conditions=dict(function=check_repo)) |
|
432 | conditions=dict(function=check_repo)) | |
429 |
|
433 | |||
430 | rmap.connect('repos_group_home', '/{group_name:.*}', |
|
434 | rmap.connect('repos_group_home', '/{group_name:.*}', | |
431 | controller='admin/repos_groups', action="show_by_name", |
|
435 | controller='admin/repos_groups', action="show_by_name", | |
432 | conditions=dict(function=check_group)) |
|
436 | conditions=dict(function=check_group)) | |
433 |
|
437 | |||
434 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', |
|
438 | rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', | |
435 | controller='changeset', revision='tip', |
|
439 | controller='changeset', revision='tip', | |
436 | conditions=dict(function=check_repo)) |
|
440 | conditions=dict(function=check_repo)) | |
437 |
|
441 | |||
438 | rmap.connect("edit_repo", "/{repo_name:.*?}/edit", |
|
442 | rmap.connect("edit_repo", "/{repo_name:.*?}/edit", | |
439 | controller='admin/repos', action="edit", |
|
443 | controller='admin/repos', action="edit", | |
440 | conditions=dict(method=["GET"], function=check_repo) |
|
444 | conditions=dict(method=["GET"], function=check_repo) | |
441 | ) |
|
445 | ) | |
442 |
|
446 | |||
443 | #still working url for backward compat. |
|
447 | #still working url for backward compat. | |
444 | rmap.connect('raw_changeset_home_depraced', |
|
448 | rmap.connect('raw_changeset_home_depraced', | |
445 | '/{repo_name:.*?}/raw-changeset/{revision}', |
|
449 | '/{repo_name:.*?}/raw-changeset/{revision}', | |
446 | controller='changeset', action='changeset_raw', |
|
450 | controller='changeset', action='changeset_raw', | |
447 | revision='tip', conditions=dict(function=check_repo)) |
|
451 | revision='tip', conditions=dict(function=check_repo)) | |
448 |
|
452 | |||
449 | ## new URLs |
|
453 | ## new URLs | |
450 | rmap.connect('changeset_raw_home', |
|
454 | rmap.connect('changeset_raw_home', | |
451 | '/{repo_name:.*?}/changeset-diff/{revision}', |
|
455 | '/{repo_name:.*?}/changeset-diff/{revision}', | |
452 | controller='changeset', action='changeset_raw', |
|
456 | controller='changeset', action='changeset_raw', | |
453 | revision='tip', conditions=dict(function=check_repo)) |
|
457 | revision='tip', conditions=dict(function=check_repo)) | |
454 |
|
458 | |||
455 | rmap.connect('changeset_patch_home', |
|
459 | rmap.connect('changeset_patch_home', | |
456 | '/{repo_name:.*?}/changeset-patch/{revision}', |
|
460 | '/{repo_name:.*?}/changeset-patch/{revision}', | |
457 | controller='changeset', action='changeset_patch', |
|
461 | controller='changeset', action='changeset_patch', | |
458 | revision='tip', conditions=dict(function=check_repo)) |
|
462 | revision='tip', conditions=dict(function=check_repo)) | |
459 |
|
463 | |||
460 | rmap.connect('changeset_download_home', |
|
464 | rmap.connect('changeset_download_home', | |
461 | '/{repo_name:.*?}/changeset-download/{revision}', |
|
465 | '/{repo_name:.*?}/changeset-download/{revision}', | |
462 | controller='changeset', action='changeset_download', |
|
466 | controller='changeset', action='changeset_download', | |
463 | revision='tip', conditions=dict(function=check_repo)) |
|
467 | revision='tip', conditions=dict(function=check_repo)) | |
464 |
|
468 | |||
465 | rmap.connect('changeset_comment', |
|
469 | rmap.connect('changeset_comment', | |
466 | '/{repo_name:.*?}/changeset/{revision}/comment', |
|
470 | '/{repo_name:.*?}/changeset/{revision}/comment', | |
467 | controller='changeset', revision='tip', action='comment', |
|
471 | controller='changeset', revision='tip', action='comment', | |
468 | conditions=dict(function=check_repo)) |
|
472 | conditions=dict(function=check_repo)) | |
469 |
|
473 | |||
470 | rmap.connect('changeset_comment_delete', |
|
474 | rmap.connect('changeset_comment_delete', | |
471 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', |
|
475 | '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', | |
472 | controller='changeset', action='delete_comment', |
|
476 | controller='changeset', action='delete_comment', | |
473 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
477 | conditions=dict(function=check_repo, method=["DELETE"])) | |
474 |
|
478 | |||
475 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', |
|
479 | rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', | |
476 | controller='changeset', action='changeset_info') |
|
480 | controller='changeset', action='changeset_info') | |
477 |
|
481 | |||
478 | rmap.connect('compare_url', |
|
482 | rmap.connect('compare_url', | |
479 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', |
|
483 | '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}', | |
480 | controller='compare', action='index', |
|
484 | controller='compare', action='index', | |
481 | conditions=dict(function=check_repo), |
|
485 | conditions=dict(function=check_repo), | |
482 | requirements=dict( |
|
486 | requirements=dict( | |
483 | org_ref_type='(branch|book|tag|rev|org_ref_type)', |
|
487 | org_ref_type='(branch|book|tag|rev|org_ref_type)', | |
484 | other_ref_type='(branch|book|tag|rev|other_ref_type)') |
|
488 | other_ref_type='(branch|book|tag|rev|other_ref_type)') | |
485 | ) |
|
489 | ) | |
486 |
|
490 | |||
487 | rmap.connect('pullrequest_home', |
|
491 | rmap.connect('pullrequest_home', | |
488 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
492 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
489 | action='index', conditions=dict(function=check_repo, |
|
493 | action='index', conditions=dict(function=check_repo, | |
490 | method=["GET"])) |
|
494 | method=["GET"])) | |
491 |
|
495 | |||
492 | rmap.connect('pullrequest', |
|
496 | rmap.connect('pullrequest', | |
493 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', |
|
497 | '/{repo_name:.*?}/pull-request/new', controller='pullrequests', | |
494 | action='create', conditions=dict(function=check_repo, |
|
498 | action='create', conditions=dict(function=check_repo, | |
495 | method=["POST"])) |
|
499 | method=["POST"])) | |
496 |
|
500 | |||
497 | rmap.connect('pullrequest_show', |
|
501 | rmap.connect('pullrequest_show', | |
498 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
502 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
499 | controller='pullrequests', |
|
503 | controller='pullrequests', | |
500 | action='show', conditions=dict(function=check_repo, |
|
504 | action='show', conditions=dict(function=check_repo, | |
501 | method=["GET"])) |
|
505 | method=["GET"])) | |
502 | rmap.connect('pullrequest_update', |
|
506 | rmap.connect('pullrequest_update', | |
503 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
507 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
504 | controller='pullrequests', |
|
508 | controller='pullrequests', | |
505 | action='update', conditions=dict(function=check_repo, |
|
509 | action='update', conditions=dict(function=check_repo, | |
506 | method=["PUT"])) |
|
510 | method=["PUT"])) | |
507 | rmap.connect('pullrequest_delete', |
|
511 | rmap.connect('pullrequest_delete', | |
508 | '/{repo_name:.*?}/pull-request/{pull_request_id}', |
|
512 | '/{repo_name:.*?}/pull-request/{pull_request_id}', | |
509 | controller='pullrequests', |
|
513 | controller='pullrequests', | |
510 | action='delete', conditions=dict(function=check_repo, |
|
514 | action='delete', conditions=dict(function=check_repo, | |
511 | method=["DELETE"])) |
|
515 | method=["DELETE"])) | |
512 |
|
516 | |||
513 | rmap.connect('pullrequest_show_all', |
|
517 | rmap.connect('pullrequest_show_all', | |
514 | '/{repo_name:.*?}/pull-request', |
|
518 | '/{repo_name:.*?}/pull-request', | |
515 | controller='pullrequests', |
|
519 | controller='pullrequests', | |
516 | action='show_all', conditions=dict(function=check_repo, |
|
520 | action='show_all', conditions=dict(function=check_repo, | |
517 | method=["GET"])) |
|
521 | method=["GET"])) | |
518 |
|
522 | |||
519 | rmap.connect('pullrequest_comment', |
|
523 | rmap.connect('pullrequest_comment', | |
520 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', |
|
524 | '/{repo_name:.*?}/pull-request-comment/{pull_request_id}', | |
521 | controller='pullrequests', |
|
525 | controller='pullrequests', | |
522 | action='comment', conditions=dict(function=check_repo, |
|
526 | action='comment', conditions=dict(function=check_repo, | |
523 | method=["POST"])) |
|
527 | method=["POST"])) | |
524 |
|
528 | |||
525 | rmap.connect('pullrequest_comment_delete', |
|
529 | rmap.connect('pullrequest_comment_delete', | |
526 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', |
|
530 | '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', | |
527 | controller='pullrequests', action='delete_comment', |
|
531 | controller='pullrequests', action='delete_comment', | |
528 | conditions=dict(function=check_repo, method=["DELETE"])) |
|
532 | conditions=dict(function=check_repo, method=["DELETE"])) | |
529 |
|
533 | |||
530 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', |
|
534 | rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', | |
531 | controller='summary', conditions=dict(function=check_repo)) |
|
535 | controller='summary', conditions=dict(function=check_repo)) | |
532 |
|
536 | |||
533 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', |
|
537 | rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', | |
534 | controller='shortlog', conditions=dict(function=check_repo)) |
|
538 | controller='shortlog', conditions=dict(function=check_repo)) | |
535 |
|
539 | |||
536 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', |
|
540 | rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}', | |
537 | controller='shortlog', f_path=None, |
|
541 | controller='shortlog', f_path=None, | |
538 | conditions=dict(function=check_repo)) |
|
542 | conditions=dict(function=check_repo)) | |
539 |
|
543 | |||
540 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', |
|
544 | rmap.connect('branches_home', '/{repo_name:.*?}/branches', | |
541 | controller='branches', conditions=dict(function=check_repo)) |
|
545 | controller='branches', conditions=dict(function=check_repo)) | |
542 |
|
546 | |||
543 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', |
|
547 | rmap.connect('tags_home', '/{repo_name:.*?}/tags', | |
544 | controller='tags', conditions=dict(function=check_repo)) |
|
548 | controller='tags', conditions=dict(function=check_repo)) | |
545 |
|
549 | |||
546 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', |
|
550 | rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks', | |
547 | controller='bookmarks', conditions=dict(function=check_repo)) |
|
551 | controller='bookmarks', conditions=dict(function=check_repo)) | |
548 |
|
552 | |||
549 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', |
|
553 | rmap.connect('changelog_home', '/{repo_name:.*?}/changelog', | |
550 | controller='changelog', conditions=dict(function=check_repo)) |
|
554 | controller='changelog', conditions=dict(function=check_repo)) | |
551 |
|
555 | |||
552 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', |
|
556 | rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}', | |
553 | controller='changelog', action='changelog_details', |
|
557 | controller='changelog', action='changelog_details', | |
554 | conditions=dict(function=check_repo)) |
|
558 | conditions=dict(function=check_repo)) | |
555 |
|
559 | |||
556 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', |
|
560 | rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', | |
557 | controller='files', revision='tip', f_path='', |
|
561 | controller='files', revision='tip', f_path='', | |
558 | conditions=dict(function=check_repo)) |
|
562 | conditions=dict(function=check_repo)) | |
559 |
|
563 | |||
560 | rmap.connect('files_history_home', |
|
564 | rmap.connect('files_history_home', | |
561 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', |
|
565 | '/{repo_name:.*?}/history/{revision}/{f_path:.*}', | |
562 | controller='files', action='history', revision='tip', f_path='', |
|
566 | controller='files', action='history', revision='tip', f_path='', | |
563 | conditions=dict(function=check_repo)) |
|
567 | conditions=dict(function=check_repo)) | |
564 |
|
568 | |||
565 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', |
|
569 | rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', | |
566 | controller='files', action='diff', revision='tip', f_path='', |
|
570 | controller='files', action='diff', revision='tip', f_path='', | |
567 | conditions=dict(function=check_repo)) |
|
571 | conditions=dict(function=check_repo)) | |
568 |
|
572 | |||
569 | rmap.connect('files_rawfile_home', |
|
573 | rmap.connect('files_rawfile_home', | |
570 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', |
|
574 | '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}', | |
571 | controller='files', action='rawfile', revision='tip', |
|
575 | controller='files', action='rawfile', revision='tip', | |
572 | f_path='', conditions=dict(function=check_repo)) |
|
576 | f_path='', conditions=dict(function=check_repo)) | |
573 |
|
577 | |||
574 | rmap.connect('files_raw_home', |
|
578 | rmap.connect('files_raw_home', | |
575 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', |
|
579 | '/{repo_name:.*?}/raw/{revision}/{f_path:.*}', | |
576 | controller='files', action='raw', revision='tip', f_path='', |
|
580 | controller='files', action='raw', revision='tip', f_path='', | |
577 | conditions=dict(function=check_repo)) |
|
581 | conditions=dict(function=check_repo)) | |
578 |
|
582 | |||
579 | rmap.connect('files_annotate_home', |
|
583 | rmap.connect('files_annotate_home', | |
580 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', |
|
584 | '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', | |
581 | controller='files', action='index', revision='tip', |
|
585 | controller='files', action='index', revision='tip', | |
582 | f_path='', annotate=True, conditions=dict(function=check_repo)) |
|
586 | f_path='', annotate=True, conditions=dict(function=check_repo)) | |
583 |
|
587 | |||
584 | rmap.connect('files_edit_home', |
|
588 | rmap.connect('files_edit_home', | |
585 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', |
|
589 | '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', | |
586 | controller='files', action='edit', revision='tip', |
|
590 | controller='files', action='edit', revision='tip', | |
587 | f_path='', conditions=dict(function=check_repo)) |
|
591 | f_path='', conditions=dict(function=check_repo)) | |
588 |
|
592 | |||
589 | rmap.connect('files_add_home', |
|
593 | rmap.connect('files_add_home', | |
590 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', |
|
594 | '/{repo_name:.*?}/add/{revision}/{f_path:.*}', | |
591 | controller='files', action='add', revision='tip', |
|
595 | controller='files', action='add', revision='tip', | |
592 | f_path='', conditions=dict(function=check_repo)) |
|
596 | f_path='', conditions=dict(function=check_repo)) | |
593 |
|
597 | |||
594 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', |
|
598 | rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}', | |
595 | controller='files', action='archivefile', |
|
599 | controller='files', action='archivefile', | |
596 | conditions=dict(function=check_repo)) |
|
600 | conditions=dict(function=check_repo)) | |
597 |
|
601 | |||
598 | rmap.connect('files_nodelist_home', |
|
602 | rmap.connect('files_nodelist_home', | |
599 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', |
|
603 | '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}', | |
600 | controller='files', action='nodelist', |
|
604 | controller='files', action='nodelist', | |
601 | conditions=dict(function=check_repo)) |
|
605 | conditions=dict(function=check_repo)) | |
602 |
|
606 | |||
603 | rmap.connect('repo_settings_delete', '/{repo_name:.*?}/settings', |
|
607 | rmap.connect('repo_settings_delete', '/{repo_name:.*?}/settings', | |
604 | controller='settings', action="delete", |
|
608 | controller='settings', action="delete", | |
605 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
609 | conditions=dict(method=["DELETE"], function=check_repo)) | |
606 |
|
610 | |||
607 | rmap.connect('repo_settings_update', '/{repo_name:.*?}/settings', |
|
611 | rmap.connect('repo_settings_update', '/{repo_name:.*?}/settings', | |
608 | controller='settings', action="update", |
|
612 | controller='settings', action="update", | |
609 | conditions=dict(method=["PUT"], function=check_repo)) |
|
613 | conditions=dict(method=["PUT"], function=check_repo)) | |
610 |
|
614 | |||
611 | rmap.connect('repo_settings_home', '/{repo_name:.*?}/settings', |
|
615 | rmap.connect('repo_settings_home', '/{repo_name:.*?}/settings', | |
612 | controller='settings', action='index', |
|
616 | controller='settings', action='index', | |
613 | conditions=dict(function=check_repo)) |
|
617 | conditions=dict(function=check_repo)) | |
614 |
|
618 | |||
615 | rmap.connect('toggle_locking', "/{repo_name:.*?}/locking_toggle", |
|
619 | rmap.connect('toggle_locking', "/{repo_name:.*?}/locking_toggle", | |
616 | controller='settings', action="toggle_locking", |
|
620 | controller='settings', action="toggle_locking", | |
617 | conditions=dict(method=["GET"], function=check_repo)) |
|
621 | conditions=dict(method=["GET"], function=check_repo)) | |
618 |
|
622 | |||
619 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', |
|
623 | rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork', | |
620 | controller='forks', action='fork_create', |
|
624 | controller='forks', action='fork_create', | |
621 | conditions=dict(function=check_repo, method=["POST"])) |
|
625 | conditions=dict(function=check_repo, method=["POST"])) | |
622 |
|
626 | |||
623 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', |
|
627 | rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork', | |
624 | controller='forks', action='fork', |
|
628 | controller='forks', action='fork', | |
625 | conditions=dict(function=check_repo)) |
|
629 | conditions=dict(function=check_repo)) | |
626 |
|
630 | |||
627 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', |
|
631 | rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks', | |
628 | controller='forks', action='forks', |
|
632 | controller='forks', action='forks', | |
629 | conditions=dict(function=check_repo)) |
|
633 | conditions=dict(function=check_repo)) | |
630 |
|
634 | |||
631 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', |
|
635 | rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers', | |
632 | controller='followers', action='followers', |
|
636 | controller='followers', action='followers', | |
633 | conditions=dict(function=check_repo)) |
|
637 | conditions=dict(function=check_repo)) | |
634 |
|
638 | |||
635 | return rmap |
|
639 | return rmap |
@@ -1,146 +1,146 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.search |
|
3 | rhodecode.controllers.search | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Search controller for RhodeCode |
|
6 | Search controller for RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Aug 7, 2010 |
|
8 | :created_on: Aug 7, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software: you can redistribute it and/or modify |
|
13 | # This program is free software: you can redistribute it and/or modify | |
14 | # it under the terms of the GNU General Public License as published by |
|
14 | # it under the terms of the GNU General Public License as published by | |
15 | # the Free Software Foundation, either version 3 of the License, or |
|
15 | # the Free Software Foundation, either version 3 of the License, or | |
16 | # (at your option) any later version. |
|
16 | # (at your option) any later version. | |
17 | # |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | import logging |
|
25 | import logging | |
26 | import traceback |
|
26 | import traceback | |
27 | import urllib |
|
27 | import urllib | |
28 | from pylons.i18n.translation import _ |
|
28 | from pylons.i18n.translation import _ | |
29 | from pylons import request, config, tmpl_context as c |
|
29 | from pylons import request, config, tmpl_context as c | |
30 |
|
30 | |||
31 | from rhodecode.lib.auth import LoginRequired |
|
31 | from rhodecode.lib.auth import LoginRequired | |
32 | from rhodecode.lib.base import BaseController, render |
|
32 | from rhodecode.lib.base import BaseRepoController, render | |
33 | from rhodecode.lib.indexers import CHGSETS_SCHEMA, SCHEMA, CHGSET_IDX_NAME, \ |
|
33 | from rhodecode.lib.indexers import CHGSETS_SCHEMA, SCHEMA, CHGSET_IDX_NAME, \ | |
34 | IDX_NAME, WhooshResultWrapper |
|
34 | IDX_NAME, WhooshResultWrapper | |
35 |
|
35 | |||
36 | from webhelpers.paginate import Page |
|
36 | from webhelpers.paginate import Page | |
37 | from webhelpers.util import update_params |
|
37 | from webhelpers.util import update_params | |
38 |
|
38 | |||
39 | from whoosh.index import open_dir, EmptyIndexError |
|
39 | from whoosh.index import open_dir, EmptyIndexError | |
40 | from whoosh.qparser import QueryParser, QueryParserError |
|
40 | from whoosh.qparser import QueryParser, QueryParserError | |
41 | from whoosh.query import Phrase, Wildcard, Term, Prefix |
|
41 | from whoosh.query import Phrase, Wildcard, Term, Prefix | |
42 | from rhodecode.model.repo import RepoModel |
|
42 | from rhodecode.model.repo import RepoModel | |
43 | from rhodecode.lib.utils2 import safe_str, safe_int |
|
43 | from rhodecode.lib.utils2 import safe_str, safe_int | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | log = logging.getLogger(__name__) |
|
46 | log = logging.getLogger(__name__) | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | class SearchController(BaseController): |
|
49 | class SearchController(BaseRepoController): | |
50 |
|
50 | |||
51 | @LoginRequired() |
|
51 | @LoginRequired() | |
52 | def __before__(self): |
|
52 | def __before__(self): | |
53 | super(SearchController, self).__before__() |
|
53 | super(SearchController, self).__before__() | |
54 |
|
54 | |||
55 |
def index(self, |
|
55 | def index(self, repo_name=None): | |
56 |
c.repo_name = |
|
56 | c.repo_name = repo_name | |
57 | c.formated_results = [] |
|
57 | c.formated_results = [] | |
58 | c.runtime = '' |
|
58 | c.runtime = '' | |
59 | c.cur_query = request.GET.get('q', None) |
|
59 | c.cur_query = request.GET.get('q', None) | |
60 | c.cur_type = request.GET.get('type', 'content') |
|
60 | c.cur_type = request.GET.get('type', 'content') | |
61 | c.cur_search = search_type = {'content': 'content', |
|
61 | c.cur_search = search_type = {'content': 'content', | |
62 | 'commit': 'message', |
|
62 | 'commit': 'message', | |
63 | 'path': 'path', |
|
63 | 'path': 'path', | |
64 | 'repository': 'repository' |
|
64 | 'repository': 'repository' | |
65 | }.get(c.cur_type, 'content') |
|
65 | }.get(c.cur_type, 'content') | |
66 |
|
66 | |||
67 | index_name = { |
|
67 | index_name = { | |
68 | 'content': IDX_NAME, |
|
68 | 'content': IDX_NAME, | |
69 | 'commit': CHGSET_IDX_NAME, |
|
69 | 'commit': CHGSET_IDX_NAME, | |
70 | 'path': IDX_NAME |
|
70 | 'path': IDX_NAME | |
71 | }.get(c.cur_type, IDX_NAME) |
|
71 | }.get(c.cur_type, IDX_NAME) | |
72 |
|
72 | |||
73 | schema_defn = { |
|
73 | schema_defn = { | |
74 | 'content': SCHEMA, |
|
74 | 'content': SCHEMA, | |
75 | 'commit': CHGSETS_SCHEMA, |
|
75 | 'commit': CHGSETS_SCHEMA, | |
76 | 'path': SCHEMA |
|
76 | 'path': SCHEMA | |
77 | }.get(c.cur_type, SCHEMA) |
|
77 | }.get(c.cur_type, SCHEMA) | |
78 |
|
78 | |||
79 | log.debug('IDX: %s' % index_name) |
|
79 | log.debug('IDX: %s' % index_name) | |
80 | log.debug('SCHEMA: %s' % schema_defn) |
|
80 | log.debug('SCHEMA: %s' % schema_defn) | |
81 |
|
81 | |||
82 | if c.cur_query: |
|
82 | if c.cur_query: | |
83 | cur_query = c.cur_query.lower() |
|
83 | cur_query = c.cur_query.lower() | |
84 | log.debug(cur_query) |
|
84 | log.debug(cur_query) | |
85 |
|
85 | |||
86 | if c.cur_query: |
|
86 | if c.cur_query: | |
87 | p = safe_int(request.params.get('page', 1), 1) |
|
87 | p = safe_int(request.params.get('page', 1), 1) | |
88 | highlight_items = set() |
|
88 | highlight_items = set() | |
89 | try: |
|
89 | try: | |
90 | idx = open_dir(config['app_conf']['index_dir'], |
|
90 | idx = open_dir(config['app_conf']['index_dir'], | |
91 | indexname=index_name) |
|
91 | indexname=index_name) | |
92 | searcher = idx.searcher() |
|
92 | searcher = idx.searcher() | |
93 |
|
93 | |||
94 | qp = QueryParser(search_type, schema=schema_defn) |
|
94 | qp = QueryParser(search_type, schema=schema_defn) | |
95 | if c.repo_name: |
|
95 | if c.repo_name: | |
96 | cur_query = u'repository:%s %s' % (c.repo_name, cur_query) |
|
96 | cur_query = u'repository:%s %s' % (c.repo_name, cur_query) | |
97 | try: |
|
97 | try: | |
98 | query = qp.parse(unicode(cur_query)) |
|
98 | query = qp.parse(unicode(cur_query)) | |
99 | # extract words for highlight |
|
99 | # extract words for highlight | |
100 | if isinstance(query, Phrase): |
|
100 | if isinstance(query, Phrase): | |
101 | highlight_items.update(query.words) |
|
101 | highlight_items.update(query.words) | |
102 | elif isinstance(query, Prefix): |
|
102 | elif isinstance(query, Prefix): | |
103 | highlight_items.add(query.text) |
|
103 | highlight_items.add(query.text) | |
104 | else: |
|
104 | else: | |
105 | for i in query.all_terms(): |
|
105 | for i in query.all_terms(): | |
106 | if i[0] in ['content', 'message']: |
|
106 | if i[0] in ['content', 'message']: | |
107 | highlight_items.add(i[1]) |
|
107 | highlight_items.add(i[1]) | |
108 |
|
108 | |||
109 | matcher = query.matcher(searcher) |
|
109 | matcher = query.matcher(searcher) | |
110 |
|
110 | |||
111 | log.debug('query: %s' % query) |
|
111 | log.debug('query: %s' % query) | |
112 | log.debug('hl terms: %s' % highlight_items) |
|
112 | log.debug('hl terms: %s' % highlight_items) | |
113 | results = searcher.search(query) |
|
113 | results = searcher.search(query) | |
114 | res_ln = len(results) |
|
114 | res_ln = len(results) | |
115 | c.runtime = '%s results (%.3f seconds)' % ( |
|
115 | c.runtime = '%s results (%.3f seconds)' % ( | |
116 | res_ln, results.runtime |
|
116 | res_ln, results.runtime | |
117 | ) |
|
117 | ) | |
118 |
|
118 | |||
119 | def url_generator(**kw): |
|
119 | def url_generator(**kw): | |
120 | q = urllib.quote(safe_str(c.cur_query)) |
|
120 | q = urllib.quote(safe_str(c.cur_query)) | |
121 | return update_params("?q=%s&type=%s" \ |
|
121 | return update_params("?q=%s&type=%s" \ | |
122 | % (q, safe_str(c.cur_type)), **kw) |
|
122 | % (q, safe_str(c.cur_type)), **kw) | |
123 | repo_location = RepoModel().repos_path |
|
123 | repo_location = RepoModel().repos_path | |
124 | c.formated_results = Page( |
|
124 | c.formated_results = Page( | |
125 | WhooshResultWrapper(search_type, searcher, matcher, |
|
125 | WhooshResultWrapper(search_type, searcher, matcher, | |
126 | highlight_items, repo_location), |
|
126 | highlight_items, repo_location), | |
127 | page=p, |
|
127 | page=p, | |
128 | item_count=res_ln, |
|
128 | item_count=res_ln, | |
129 | items_per_page=10, |
|
129 | items_per_page=10, | |
130 | url=url_generator |
|
130 | url=url_generator | |
131 | ) |
|
131 | ) | |
132 |
|
132 | |||
133 | except QueryParserError: |
|
133 | except QueryParserError: | |
134 | c.runtime = _('Invalid search query. Try quoting it.') |
|
134 | c.runtime = _('Invalid search query. Try quoting it.') | |
135 | searcher.close() |
|
135 | searcher.close() | |
136 | except (EmptyIndexError, IOError): |
|
136 | except (EmptyIndexError, IOError): | |
137 | log.error(traceback.format_exc()) |
|
137 | log.error(traceback.format_exc()) | |
138 | log.error('Empty Index data') |
|
138 | log.error('Empty Index data') | |
139 | c.runtime = _('There is no index to search in. ' |
|
139 | c.runtime = _('There is no index to search in. ' | |
140 | 'Please run whoosh indexer') |
|
140 | 'Please run whoosh indexer') | |
141 | except (Exception): |
|
141 | except (Exception): | |
142 | log.error(traceback.format_exc()) |
|
142 | log.error(traceback.format_exc()) | |
143 | c.runtime = _('An error occurred during this search operation') |
|
143 | c.runtime = _('An error occurred during this search operation') | |
144 |
|
144 | |||
145 | # Return a rendered template |
|
145 | # Return a rendered template | |
146 | return render('/search/search.html') |
|
146 | return render('/search/search.html') |
@@ -1,360 +1,360 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="root.html"/> |
|
2 | <%inherit file="root.html"/> | |
3 |
|
3 | |||
4 | <!-- HEADER --> |
|
4 | <!-- HEADER --> | |
5 | <div id="header"> |
|
5 | <div id="header"> | |
6 | <div id="header-inner" class="title hover"> |
|
6 | <div id="header-inner" class="title hover"> | |
7 | <div id="logo"> |
|
7 | <div id="logo"> | |
8 | <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1> |
|
8 | <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1> | |
9 | </div> |
|
9 | </div> | |
10 | <!-- MENU --> |
|
10 | <!-- MENU --> | |
11 | ${self.page_nav()} |
|
11 | ${self.page_nav()} | |
12 | <!-- END MENU --> |
|
12 | <!-- END MENU --> | |
13 | ${self.body()} |
|
13 | ${self.body()} | |
14 | </div> |
|
14 | </div> | |
15 | </div> |
|
15 | </div> | |
16 | <!-- END HEADER --> |
|
16 | <!-- END HEADER --> | |
17 |
|
17 | |||
18 | <!-- CONTENT --> |
|
18 | <!-- CONTENT --> | |
19 | <div id="content"> |
|
19 | <div id="content"> | |
20 | <div class="flash_msg"> |
|
20 | <div class="flash_msg"> | |
21 | <% messages = h.flash.pop_messages() %> |
|
21 | <% messages = h.flash.pop_messages() %> | |
22 | % if messages: |
|
22 | % if messages: | |
23 | <ul id="flash-messages"> |
|
23 | <ul id="flash-messages"> | |
24 | % for message in messages: |
|
24 | % for message in messages: | |
25 | <li class="${message.category}_msg">${message}</li> |
|
25 | <li class="${message.category}_msg">${message}</li> | |
26 | % endfor |
|
26 | % endfor | |
27 | </ul> |
|
27 | </ul> | |
28 | % endif |
|
28 | % endif | |
29 | </div> |
|
29 | </div> | |
30 | <div id="main"> |
|
30 | <div id="main"> | |
31 | ${next.main()} |
|
31 | ${next.main()} | |
32 | </div> |
|
32 | </div> | |
33 | </div> |
|
33 | </div> | |
34 | <!-- END CONTENT --> |
|
34 | <!-- END CONTENT --> | |
35 |
|
35 | |||
36 | <!-- FOOTER --> |
|
36 | <!-- FOOTER --> | |
37 | <div id="footer"> |
|
37 | <div id="footer"> | |
38 | <div id="footer-inner" class="title"> |
|
38 | <div id="footer-inner" class="title"> | |
39 | <div> |
|
39 | <div> | |
40 | <p class="footer-link"> |
|
40 | <p class="footer-link"> | |
41 | <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a> |
|
41 | <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a> | |
42 | </p> |
|
42 | </p> | |
43 | <p class="footer-link-right"> |
|
43 | <p class="footer-link-right"> | |
44 | <a href="${h.url('rhodecode_official')}">RhodeCode${'-%s' % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}</a> |
|
44 | <a href="${h.url('rhodecode_official')}">RhodeCode${'-%s' % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}</a> | |
45 | ${c.rhodecode_version} © 2010-${h.datetime.today().year} by Marcin Kuzminski |
|
45 | ${c.rhodecode_version} © 2010-${h.datetime.today().year} by Marcin Kuzminski | |
46 | </p> |
|
46 | </p> | |
47 | </div> |
|
47 | </div> | |
48 | </div> |
|
48 | </div> | |
49 | </div> |
|
49 | </div> | |
50 | <!-- END FOOTER --> |
|
50 | <!-- END FOOTER --> | |
51 |
|
51 | |||
52 | ### MAKO DEFS ### |
|
52 | ### MAKO DEFS ### | |
53 | <%def name="page_nav()"> |
|
53 | <%def name="page_nav()"> | |
54 | ${self.menu()} |
|
54 | ${self.menu()} | |
55 | </%def> |
|
55 | </%def> | |
56 |
|
56 | |||
57 | <%def name="breadcrumbs()"> |
|
57 | <%def name="breadcrumbs()"> | |
58 | <div class="breadcrumbs"> |
|
58 | <div class="breadcrumbs"> | |
59 | ${self.breadcrumbs_links()} |
|
59 | ${self.breadcrumbs_links()} | |
60 | </div> |
|
60 | </div> | |
61 | </%def> |
|
61 | </%def> | |
62 |
|
62 | |||
63 | <%def name="usermenu()"> |
|
63 | <%def name="usermenu()"> | |
64 | ## USER MENU |
|
64 | ## USER MENU | |
65 | <li> |
|
65 | <li> | |
66 | <a class="menu_link" id="quick_login_link"> |
|
66 | <a class="menu_link" id="quick_login_link"> | |
67 | <span class="icon" style="padding:5px 5px 0px 5px"> |
|
67 | <span class="icon" style="padding:5px 5px 0px 5px"> | |
68 | <img src="${h.gravatar_url(c.rhodecode_user.email,20)}" alt="avatar"> |
|
68 | <img src="${h.gravatar_url(c.rhodecode_user.email,20)}" alt="avatar"> | |
69 | </span> |
|
69 | </span> | |
70 | %if c.rhodecode_user.username != 'default': |
|
70 | %if c.rhodecode_user.username != 'default': | |
71 | <span class="menu_link_user">${c.rhodecode_user.username}</span> |
|
71 | <span class="menu_link_user">${c.rhodecode_user.username}</span> | |
72 | %if c.unread_notifications != 0: |
|
72 | %if c.unread_notifications != 0: | |
73 | <span class="menu_link_notifications">${c.unread_notifications}</span> |
|
73 | <span class="menu_link_notifications">${c.unread_notifications}</span> | |
74 | %endif |
|
74 | %endif | |
75 | %else: |
|
75 | %else: | |
76 | <span>${_('Not logged in')}</span> |
|
76 | <span>${_('Not logged in')}</span> | |
77 | %endif |
|
77 | %endif | |
78 | </a> |
|
78 | </a> | |
79 |
|
79 | |||
80 | <div class="user-menu"> |
|
80 | <div class="user-menu"> | |
81 | <div id="quick_login"> |
|
81 | <div id="quick_login"> | |
82 | %if c.rhodecode_user.username == 'default': |
|
82 | %if c.rhodecode_user.username == 'default': | |
83 | <h4>${_('Login to your account')}</h4> |
|
83 | <h4>${_('Login to your account')}</h4> | |
84 | ${h.form(h.url('login_home',came_from=h.url.current()))} |
|
84 | ${h.form(h.url('login_home',came_from=h.url.current()))} | |
85 | <div class="form"> |
|
85 | <div class="form"> | |
86 | <div class="fields"> |
|
86 | <div class="fields"> | |
87 | <div class="field"> |
|
87 | <div class="field"> | |
88 | <div class="label"> |
|
88 | <div class="label"> | |
89 | <label for="username">${_('Username')}:</label> |
|
89 | <label for="username">${_('Username')}:</label> | |
90 | </div> |
|
90 | </div> | |
91 | <div class="input"> |
|
91 | <div class="input"> | |
92 | ${h.text('username',class_='focus',size=40)} |
|
92 | ${h.text('username',class_='focus',size=40)} | |
93 | </div> |
|
93 | </div> | |
94 |
|
94 | |||
95 | </div> |
|
95 | </div> | |
96 | <div class="field"> |
|
96 | <div class="field"> | |
97 | <div class="label"> |
|
97 | <div class="label"> | |
98 | <label for="password">${_('Password')}:</label> |
|
98 | <label for="password">${_('Password')}:</label> | |
99 | </div> |
|
99 | </div> | |
100 | <div class="input"> |
|
100 | <div class="input"> | |
101 | ${h.password('password',class_='focus',size=40)} |
|
101 | ${h.password('password',class_='focus',size=40)} | |
102 | </div> |
|
102 | </div> | |
103 |
|
103 | |||
104 | </div> |
|
104 | </div> | |
105 | <div class="buttons"> |
|
105 | <div class="buttons"> | |
106 | <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div> |
|
106 | <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div> | |
107 | <div class="register"> |
|
107 | <div class="register"> | |
108 | %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): |
|
108 | %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): | |
109 | ${h.link_to(_("Don't have an account ?"),h.url('register'))} |
|
109 | ${h.link_to(_("Don't have an account ?"),h.url('register'))} | |
110 | %endif |
|
110 | %endif | |
111 | </div> |
|
111 | </div> | |
112 | <div class="submit"> |
|
112 | <div class="submit"> | |
113 | ${h.submit('sign_in',_('Log In'),class_="ui-btn xsmall")} |
|
113 | ${h.submit('sign_in',_('Log In'),class_="ui-btn xsmall")} | |
114 | </div> |
|
114 | </div> | |
115 | </div> |
|
115 | </div> | |
116 | </div> |
|
116 | </div> | |
117 | </div> |
|
117 | </div> | |
118 | ${h.end_form()} |
|
118 | ${h.end_form()} | |
119 | %else: |
|
119 | %else: | |
120 | <div class="links_left"> |
|
120 | <div class="links_left"> | |
121 | <div class="full_name">${c.rhodecode_user.full_name_or_username}</div> |
|
121 | <div class="full_name">${c.rhodecode_user.full_name_or_username}</div> | |
122 | <div class="email">${c.rhodecode_user.email}</div> |
|
122 | <div class="email">${c.rhodecode_user.email}</div> | |
123 | <div class="big_gravatar"><img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,48)}" /></div> |
|
123 | <div class="big_gravatar"><img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,48)}" /></div> | |
124 | <div class="notifications"><a href="${h.url('notifications')}">${_('Notifications')}</a></div> |
|
124 | <div class="notifications"><a href="${h.url('notifications')}">${_('Notifications')}</a></div> | |
125 | <div class="unread">${_('Unread')}: ${c.unread_notifications}</div> |
|
125 | <div class="unread">${_('Unread')}: ${c.unread_notifications}</div> | |
126 | </div> |
|
126 | </div> | |
127 | <div class="links_right"> |
|
127 | <div class="links_right"> | |
128 | <ol class="links"> |
|
128 | <ol class="links"> | |
129 | <li>${h.link_to(_(u'Home'),h.url('home'))}</li> |
|
129 | <li>${h.link_to(_(u'Home'),h.url('home'))}</li> | |
130 | <li>${h.link_to(_(u'Journal'),h.url('journal'))}</li> |
|
130 | <li>${h.link_to(_(u'Journal'),h.url('journal'))}</li> | |
131 | <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li> |
|
131 | <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li> | |
132 | <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li> |
|
132 | <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li> | |
133 | </ol> |
|
133 | </ol> | |
134 | </div> |
|
134 | </div> | |
135 | %endif |
|
135 | %endif | |
136 | </div> |
|
136 | </div> | |
137 | </div> |
|
137 | </div> | |
138 |
|
138 | |||
139 | </li> |
|
139 | </li> | |
140 | </%def> |
|
140 | </%def> | |
141 |
|
141 | |||
142 | <%def name="menu(current=None)"> |
|
142 | <%def name="menu(current=None)"> | |
143 | <% |
|
143 | <% | |
144 | def is_current(selected): |
|
144 | def is_current(selected): | |
145 | if selected == current: |
|
145 | if selected == current: | |
146 | return h.literal('class="current"') |
|
146 | return h.literal('class="current"') | |
147 | %> |
|
147 | %> | |
148 | <ul id="quick"> |
|
148 | <ul id="quick"> | |
149 | <!-- repo switcher --> |
|
149 | <!-- repo switcher --> | |
150 | <li ${is_current('home')}> |
|
150 | <li ${is_current('home')}> | |
151 | <a class="menu_link" id="repo_switcher" title="${_('Switch repository')}" href="${h.url('home')}"> |
|
151 | <a class="menu_link" id="repo_switcher" title="${_('Switch repository')}" href="${h.url('home')}"> | |
152 | <span class="icon"> |
|
152 | <span class="icon"> | |
153 | <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" /> |
|
153 | <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" /> | |
154 | </span> |
|
154 | </span> | |
155 | <span>${_('Repositories')}</span> |
|
155 | <span>${_('Repositories')}</span> | |
156 | </a> |
|
156 | </a> | |
157 | <ul id="repo_switcher_list" class="repo_switcher"> |
|
157 | <ul id="repo_switcher_list" class="repo_switcher"> | |
158 | <li> |
|
158 | <li> | |
159 | <a href="#">${_('loading...')}</a> |
|
159 | <a href="#">${_('loading...')}</a> | |
160 | </li> |
|
160 | </li> | |
161 | </ul> |
|
161 | </ul> | |
162 | </li> |
|
162 | </li> | |
163 | ## we render this menu only not for those pages |
|
163 | ## we render this menu only not for those pages | |
164 | %if current not in ['home','admin', 'search', 'journal']: |
|
164 | %if current not in ['home','admin', 'search', 'journal']: | |
165 | ##REGULAR MENU |
|
165 | ##REGULAR MENU | |
166 | <li ${is_current('summary')}> |
|
166 | <li ${is_current('summary')}> | |
167 | <a class="menu_link" title="${_('Summary page')}" href="${h.url('summary_home',repo_name=c.repo_name)}"> |
|
167 | <a class="menu_link" title="${_('Summary page')}" href="${h.url('summary_home',repo_name=c.repo_name)}"> | |
168 | <span class="icon"> |
|
168 | <span class="icon"> | |
169 | <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" /> |
|
169 | <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" /> | |
170 | </span> |
|
170 | </span> | |
171 | <span>${_('Summary')}</span> |
|
171 | <span>${_('Summary')}</span> | |
172 | </a> |
|
172 | </a> | |
173 | </li> |
|
173 | </li> | |
174 | <li ${is_current('changelog')}> |
|
174 | <li ${is_current('changelog')}> | |
175 | <a class="menu_link" title="${_('Changeset list')}" href="${h.url('changelog_home',repo_name=c.repo_name)}"> |
|
175 | <a class="menu_link" title="${_('Changeset list')}" href="${h.url('changelog_home',repo_name=c.repo_name)}"> | |
176 | <span class="icon"> |
|
176 | <span class="icon"> | |
177 | <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" /> |
|
177 | <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" /> | |
178 | </span> |
|
178 | </span> | |
179 | <span>${_('Changelog')}</span> |
|
179 | <span>${_('Changelog')}</span> | |
180 | </a> |
|
180 | </a> | |
181 | </li> |
|
181 | </li> | |
182 | <li ${is_current('switch_to')}> |
|
182 | <li ${is_current('switch_to')}> | |
183 | <a class="menu_link" id="branch_tag_switcher" title="${_('Switch to')}" href="#"> |
|
183 | <a class="menu_link" id="branch_tag_switcher" title="${_('Switch to')}" href="#"> | |
184 | <span class="icon"> |
|
184 | <span class="icon"> | |
185 | <img src="${h.url('/images/icons/arrow_switch.png')}" alt="${_('Switch to')}" /> |
|
185 | <img src="${h.url('/images/icons/arrow_switch.png')}" alt="${_('Switch to')}" /> | |
186 | </span> |
|
186 | </span> | |
187 | <span>${_('Switch to')}</span> |
|
187 | <span>${_('Switch to')}</span> | |
188 | </a> |
|
188 | </a> | |
189 | <ul id="switch_to_list" class="switch_to"> |
|
189 | <ul id="switch_to_list" class="switch_to"> | |
190 | <li><a href="#">${_('loading...')}</a></li> |
|
190 | <li><a href="#">${_('loading...')}</a></li> | |
191 | </ul> |
|
191 | </ul> | |
192 | </li> |
|
192 | </li> | |
193 | <li ${is_current('files')}> |
|
193 | <li ${is_current('files')}> | |
194 | <a class="menu_link" title="${_('Show repository content')}" href="${h.url('files_home',repo_name=c.repo_name)}"> |
|
194 | <a class="menu_link" title="${_('Show repository content')}" href="${h.url('files_home',repo_name=c.repo_name)}"> | |
195 | <span class="icon"> |
|
195 | <span class="icon"> | |
196 | <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" /> |
|
196 | <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" /> | |
197 | </span> |
|
197 | </span> | |
198 | <span>${_('Files')}</span> |
|
198 | <span>${_('Files')}</span> | |
199 | </a> |
|
199 | </a> | |
200 | </li> |
|
200 | </li> | |
201 | <li ${is_current('options')}> |
|
201 | <li ${is_current('options')}> | |
202 | <a class="menu_link" title="${_('Options')}" href="#"> |
|
202 | <a class="menu_link" title="${_('Options')}" href="#"> | |
203 | <span class="icon"> |
|
203 | <span class="icon"> | |
204 | <img src="${h.url('/images/icons/table_gear.png')}" alt="${_('Admin')}" /> |
|
204 | <img src="${h.url('/images/icons/table_gear.png')}" alt="${_('Admin')}" /> | |
205 | </span> |
|
205 | </span> | |
206 | <span>${_('Options')}</span> |
|
206 | <span>${_('Options')}</span> | |
207 | </a> |
|
207 | </a> | |
208 | <ul> |
|
208 | <ul> | |
209 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
209 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): | |
210 | %if h.HasPermissionAll('hg.admin')('access settings on repository'): |
|
210 | %if h.HasPermissionAll('hg.admin')('access settings on repository'): | |
211 | <li>${h.link_to(_('repository settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li> |
|
211 | <li>${h.link_to(_('repository settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li> | |
212 | %else: |
|
212 | %else: | |
213 | <li>${h.link_to(_('repository settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li> |
|
213 | <li>${h.link_to(_('repository settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li> | |
214 | %endif |
|
214 | %endif | |
215 | %endif |
|
215 | %endif | |
216 |
|
216 | |||
217 | <li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li> |
|
217 | <li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li> | |
218 | %if h.is_hg(c.rhodecode_repo): |
|
218 | %if h.is_hg(c.rhodecode_repo): | |
219 | <li>${h.link_to(_('open new pull request'),h.url('pullrequest_home',repo_name=c.repo_name),class_='pull_request')}</li> |
|
219 | <li>${h.link_to(_('open new pull request'),h.url('pullrequest_home',repo_name=c.repo_name),class_='pull_request')}</li> | |
220 | %endif |
|
220 | %endif | |
221 | %if c.rhodecode_db_repo.fork: |
|
221 | %if c.rhodecode_db_repo.fork: | |
222 | <li>${h.link_to(_('compare fork'),h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref=request.GET.get('branch') or 'default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name),class_='compare_request')}</li> |
|
222 | <li>${h.link_to(_('compare fork'),h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref=request.GET.get('branch') or 'default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name),class_='compare_request')}</li> | |
223 | %endif |
|
223 | %endif | |
224 |
<li>${h.link_to(_('search'),h.url('search_repo', |
|
224 | <li>${h.link_to(_('search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}</li> | |
225 |
|
225 | |||
226 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: |
|
226 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: | |
227 | %if c.rhodecode_db_repo.locked[0]: |
|
227 | %if c.rhodecode_db_repo.locked[0]: | |
228 | <li>${h.link_to(_('unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li> |
|
228 | <li>${h.link_to(_('unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li> | |
229 | %else: |
|
229 | %else: | |
230 | <li>${h.link_to(_('lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}</li> |
|
230 | <li>${h.link_to(_('lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}</li> | |
231 | %endif |
|
231 | %endif | |
232 | %endif |
|
232 | %endif | |
233 |
|
233 | |||
234 | % if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
234 | % if h.HasPermissionAll('hg.admin')('access admin main page'): | |
235 | <li> |
|
235 | <li> | |
236 | ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')} |
|
236 | ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')} | |
237 | <%def name="admin_menu()"> |
|
237 | <%def name="admin_menu()"> | |
238 | <ul> |
|
238 | <ul> | |
239 | <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li> |
|
239 | <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li> | |
240 | <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li> |
|
240 | <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li> | |
241 | <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li> |
|
241 | <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li> | |
242 | <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li> |
|
242 | <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li> | |
243 | <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li> |
|
243 | <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li> | |
244 | <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li> |
|
244 | <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li> | |
245 | <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li> |
|
245 | <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li> | |
246 | <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li> |
|
246 | <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li> | |
247 | <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li> |
|
247 | <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li> | |
248 | </ul> |
|
248 | </ul> | |
249 | </%def> |
|
249 | </%def> | |
250 | ## ADMIN MENU |
|
250 | ## ADMIN MENU | |
251 | ${admin_menu()} |
|
251 | ${admin_menu()} | |
252 | </li> |
|
252 | </li> | |
253 | % endif |
|
253 | % endif | |
254 | </ul> |
|
254 | </ul> | |
255 | </li> |
|
255 | </li> | |
256 | <li> |
|
256 | <li> | |
257 | <a class="menu_link" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> |
|
257 | <a class="menu_link" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> | |
258 | <span class="icon_short"> |
|
258 | <span class="icon_short"> | |
259 | <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" /> |
|
259 | <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" /> | |
260 | </span> |
|
260 | </span> | |
261 | <span id="current_followers_count" class="short">${c.repository_followers}</span> |
|
261 | <span id="current_followers_count" class="short">${c.repository_followers}</span> | |
262 | </a> |
|
262 | </a> | |
263 | </li> |
|
263 | </li> | |
264 | <li> |
|
264 | <li> | |
265 | <a class="menu_link" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> |
|
265 | <a class="menu_link" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> | |
266 | <span class="icon_short"> |
|
266 | <span class="icon_short"> | |
267 | <img src="${h.url('/images/icons/arrow_divide.png')}" alt="${_('Forks')}" /> |
|
267 | <img src="${h.url('/images/icons/arrow_divide.png')}" alt="${_('Forks')}" /> | |
268 | </span> |
|
268 | </span> | |
269 | <span class="short">${c.repository_forks}</span> |
|
269 | <span class="short">${c.repository_forks}</span> | |
270 | </a> |
|
270 | </a> | |
271 | </li> |
|
271 | </li> | |
272 | <li> |
|
272 | <li> | |
273 | <a class="menu_link" title="${_('Pull requests')}" href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}"> |
|
273 | <a class="menu_link" title="${_('Pull requests')}" href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}"> | |
274 | <span class="icon_short"> |
|
274 | <span class="icon_short"> | |
275 | <img src="${h.url('/images/icons/arrow_join.png')}" alt="${_('Pull requests')}" /> |
|
275 | <img src="${h.url('/images/icons/arrow_join.png')}" alt="${_('Pull requests')}" /> | |
276 | </span> |
|
276 | </span> | |
277 | <span class="short">${c.repository_pull_requests}</span> |
|
277 | <span class="short">${c.repository_pull_requests}</span> | |
278 | </a> |
|
278 | </a> | |
279 | </li> |
|
279 | </li> | |
280 | ${usermenu()} |
|
280 | ${usermenu()} | |
281 | <script type="text/javascript"> |
|
281 | <script type="text/javascript"> | |
282 | YUE.on('branch_tag_switcher','mouseover',function(){ |
|
282 | YUE.on('branch_tag_switcher','mouseover',function(){ | |
283 | var loaded = YUD.hasClass('branch_tag_switcher','loaded'); |
|
283 | var loaded = YUD.hasClass('branch_tag_switcher','loaded'); | |
284 | if(!loaded){ |
|
284 | if(!loaded){ | |
285 | YUD.addClass('branch_tag_switcher','loaded'); |
|
285 | YUD.addClass('branch_tag_switcher','loaded'); | |
286 | ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list', |
|
286 | ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list', | |
287 | function(o){}, |
|
287 | function(o){}, | |
288 | function(o){YUD.removeClass('branch_tag_switcher','loaded');} |
|
288 | function(o){YUD.removeClass('branch_tag_switcher','loaded');} | |
289 | ,null); |
|
289 | ,null); | |
290 | } |
|
290 | } | |
291 | return false; |
|
291 | return false; | |
292 | }); |
|
292 | }); | |
293 | </script> |
|
293 | </script> | |
294 | %else: |
|
294 | %else: | |
295 | ##ROOT MENU |
|
295 | ##ROOT MENU | |
296 | %if c.rhodecode_user.username != 'default': |
|
296 | %if c.rhodecode_user.username != 'default': | |
297 | <li ${is_current('journal')}> |
|
297 | <li ${is_current('journal')}> | |
298 | <a class="menu_link" title="${_('Show recent activity')}" href="${h.url('journal')}"> |
|
298 | <a class="menu_link" title="${_('Show recent activity')}" href="${h.url('journal')}"> | |
299 | <span class="icon"> |
|
299 | <span class="icon"> | |
300 | <img src="${h.url('/images/icons/book.png')}" alt="${_('Journal')}" /> |
|
300 | <img src="${h.url('/images/icons/book.png')}" alt="${_('Journal')}" /> | |
301 | </span> |
|
301 | </span> | |
302 | <span>${_('Journal')}</span> |
|
302 | <span>${_('Journal')}</span> | |
303 | </a> |
|
303 | </a> | |
304 | </li> |
|
304 | </li> | |
305 | %else: |
|
305 | %else: | |
306 | <li ${is_current('journal')}> |
|
306 | <li ${is_current('journal')}> | |
307 | <a class="menu_link" title="${_('Public journal')}" href="${h.url('public_journal')}"> |
|
307 | <a class="menu_link" title="${_('Public journal')}" href="${h.url('public_journal')}"> | |
308 | <span class="icon"> |
|
308 | <span class="icon"> | |
309 | <img src="${h.url('/images/icons/book.png')}" alt="${_('Public journal')}" /> |
|
309 | <img src="${h.url('/images/icons/book.png')}" alt="${_('Public journal')}" /> | |
310 | </span> |
|
310 | </span> | |
311 | <span>${_('Public journal')}</span> |
|
311 | <span>${_('Public journal')}</span> | |
312 | </a> |
|
312 | </a> | |
313 | </li> |
|
313 | </li> | |
314 | %endif |
|
314 | %endif | |
315 | <li ${is_current('search')}> |
|
315 | <li ${is_current('search')}> | |
316 | <a class="menu_link" title="${_('Search in repositories')}" href="${h.url('search')}"> |
|
316 | <a class="menu_link" title="${_('Search in repositories')}" href="${h.url('search')}"> | |
317 | <span class="icon"> |
|
317 | <span class="icon"> | |
318 | <img src="${h.url('/images/icons/search_16.png')}" alt="${_('Search')}" /> |
|
318 | <img src="${h.url('/images/icons/search_16.png')}" alt="${_('Search')}" /> | |
319 | </span> |
|
319 | </span> | |
320 | <span>${_('Search')}</span> |
|
320 | <span>${_('Search')}</span> | |
321 | </a> |
|
321 | </a> | |
322 | </li> |
|
322 | </li> | |
323 | %if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
323 | %if h.HasPermissionAll('hg.admin')('access admin main page'): | |
324 | <li ${is_current('admin')}> |
|
324 | <li ${is_current('admin')}> | |
325 | <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}"> |
|
325 | <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}"> | |
326 | <span class="icon"> |
|
326 | <span class="icon"> | |
327 | <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" /> |
|
327 | <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" /> | |
328 | </span> |
|
328 | </span> | |
329 | <span>${_('Admin')}</span> |
|
329 | <span>${_('Admin')}</span> | |
330 | </a> |
|
330 | </a> | |
331 | ${admin_menu()} |
|
331 | ${admin_menu()} | |
332 | </li> |
|
332 | </li> | |
333 | %endif |
|
333 | %endif | |
334 | ${usermenu()} |
|
334 | ${usermenu()} | |
335 | %endif |
|
335 | %endif | |
336 | <script type="text/javascript"> |
|
336 | <script type="text/javascript"> | |
337 | YUE.on('repo_switcher','mouseover',function(){ |
|
337 | YUE.on('repo_switcher','mouseover',function(){ | |
338 | var target = 'q_filter_rs'; |
|
338 | var target = 'q_filter_rs'; | |
339 | var qfilter_activate = function(){ |
|
339 | var qfilter_activate = function(){ | |
340 | var nodes = YUQ('ul#repo_switcher_list li a.repo_name'); |
|
340 | var nodes = YUQ('ul#repo_switcher_list li a.repo_name'); | |
341 | var func = function(node){ |
|
341 | var func = function(node){ | |
342 | return node.parentNode; |
|
342 | return node.parentNode; | |
343 | } |
|
343 | } | |
344 | q_filter(target,nodes,func); |
|
344 | q_filter(target,nodes,func); | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | var loaded = YUD.hasClass('repo_switcher','loaded'); |
|
347 | var loaded = YUD.hasClass('repo_switcher','loaded'); | |
348 | if(!loaded){ |
|
348 | if(!loaded){ | |
349 | YUD.addClass('repo_switcher','loaded'); |
|
349 | YUD.addClass('repo_switcher','loaded'); | |
350 | ypjax("${h.url('repo_switcher')}",'repo_switcher_list', |
|
350 | ypjax("${h.url('repo_switcher')}",'repo_switcher_list', | |
351 | function(o){qfilter_activate();YUD.get(target).focus()}, |
|
351 | function(o){qfilter_activate();YUD.get(target).focus()}, | |
352 | function(o){YUD.removeClass('repo_switcher','loaded');} |
|
352 | function(o){YUD.removeClass('repo_switcher','loaded');} | |
353 | ,null); |
|
353 | ,null); | |
354 | }else{ |
|
354 | }else{ | |
355 | YUD.get(target).focus(); |
|
355 | YUD.get(target).focus(); | |
356 | } |
|
356 | } | |
357 | return false; |
|
357 | return false; | |
358 | }); |
|
358 | }); | |
359 | </script> |
|
359 | </script> | |
360 | </%def> |
|
360 | </%def> |
@@ -1,87 +1,91 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="/base/base.html"/> |
|
2 | <%inherit file="/base/base.html"/> | |
|
3 | ||||
3 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
4 |
|
|
5 | %if c.repo_name: | |
|
6 | ${_('Search repository')} ${c.repo_name} - ${c.rhodecode_name} | |||
|
7 | %else: | |||
|
8 | ${_('Search in all repositories')} | |||
|
9 | %endif | |||
|
10 | </%def> | |||
|
11 | ||||
|
12 | <%def name="breadcrumbs_links()"> | |||
|
13 | %if c.repo_name: | |||
|
14 | ${h.link_to(_(u'Home'),h.url('/'))} | |||
|
15 | » | |||
|
16 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} | |||
|
17 | » | |||
|
18 | ${_('Search')} | |||
|
19 | %else: | |||
|
20 | ${_('Search in all repositories')} | |||
|
21 | %endif | |||
|
22 | %if c.cur_query: | |||
|
23 | » | |||
|
24 | ${c.cur_query} | |||
|
25 | %endif | |||
|
26 | </%def> | |||
|
27 | ||||
|
28 | <%def name="page_nav()"> | |||
5 | %if c.repo_name: |
|
29 | %if c.repo_name: | |
6 | ${_('Search "%s" in repository: %s') % (c.cur_query, c.repo_name)} |
|
30 | ${self.menu('options')} | |
7 | %else: |
|
|||
8 | ${_('Search "%s" in all repositories') % c.cur_query} |
|
|||
9 | %endif |
|
|||
10 | %else: |
|
|||
11 | %if c.repo_name: |
|
|||
12 | ${_('Search in repository: %s') % c.repo_name} |
|
|||
13 | %else: |
|
31 | %else: | |
14 | ${_('Search in all repositories')} |
|
32 | ${self.menu('search')} | |
15 | %endif |
|
33 | %endif | |
16 | %endif |
|
|||
17 | - ${c.rhodecode_name} |
|
|||
18 | </%def> |
|
|||
19 | <%def name="breadcrumbs()"> |
|
|||
20 | ${c.rhodecode_name} |
|
|||
21 | </%def> |
|
|||
22 | <%def name="page_nav()"> |
|
|||
23 | ${self.menu('search')} |
|
|||
24 | </%def> |
|
34 | </%def> | |
25 | <%def name="main()"> |
|
35 | <%def name="main()"> | |
26 |
|
36 | |||
27 | <div class="box"> |
|
37 | <div class="box"> | |
28 | <!-- box / title --> |
|
38 | <!-- box / title --> | |
29 | <div class="title"> |
|
39 | <div class="title"> | |
30 | <h5> |
|
40 | ${self.breadcrumbs()} | |
31 | %if c.repo_name: |
|
|||
32 | ${_('Search in repository: %s') % c.repo_name} |
|
|||
33 | %else: |
|
|||
34 | ${_('Search in all repositories')} |
|
|||
35 | %endif |
|
|||
36 | </h5> |
|
|||
37 | </div> |
|
41 | </div> | |
38 | <!-- end box / title --> |
|
42 | <!-- end box / title --> | |
39 | %if c.repo_name: |
|
43 | %if c.repo_name: | |
40 |
${h.form(h.url('search_repo', |
|
44 | ${h.form(h.url('search_repo',repo_name=c.repo_name),method='get')} | |
41 | %else: |
|
45 | %else: | |
42 | ${h.form(h.url('search'),method='get')} |
|
46 | ${h.form(h.url('search'),method='get')} | |
43 | %endif |
|
47 | %endif | |
44 | <div class="form"> |
|
48 | <div class="form"> | |
45 | <div class="fields"> |
|
49 | <div class="fields"> | |
46 | <div class="field field-first field-noborder"> |
|
50 | <div class="field field-first field-noborder"> | |
47 | <div class="label"> |
|
51 | <div class="label"> | |
48 | <label for="q">${_('Search term')}</label> |
|
52 | <label for="q">${_('Search term')}</label> | |
49 | </div> |
|
53 | </div> | |
50 | <div class="input">${h.text('q',c.cur_query,class_="small")} |
|
54 | <div class="input">${h.text('q',c.cur_query,class_="small")} | |
51 | <div class="button highlight"> |
|
55 | <div class="button highlight"> | |
52 | <input type="submit" value="${_('Search')}" class="ui-button"/> |
|
56 | <input type="submit" value="${_('Search')}" class="ui-button"/> | |
53 | </div> |
|
57 | </div> | |
54 | </div> |
|
58 | </div> | |
55 | <div style="font-weight: bold;clear:Both;margin-left:200px">${c.runtime}</div> |
|
59 | <div style="font-weight: bold;clear:Both;margin-left:200px">${c.runtime}</div> | |
56 | </div> |
|
60 | </div> | |
57 |
|
61 | |||
58 | <div class="field"> |
|
62 | <div class="field"> | |
59 | <div class="label"> |
|
63 | <div class="label"> | |
60 | <label for="type">${_('Search in')}</label> |
|
64 | <label for="type">${_('Search in')}</label> | |
61 | </div> |
|
65 | </div> | |
62 | <div class="select"> |
|
66 | <div class="select"> | |
63 | ${h.select('type',c.cur_type,[('content',_('File contents')), |
|
67 | ${h.select('type',c.cur_type,[('content',_('File contents')), | |
64 | ('commit',_('Commit messages')), |
|
68 | ('commit',_('Commit messages')), | |
65 | ('path',_('File names')), |
|
69 | ('path',_('File names')), | |
66 | ##('repository',_('Repository names')), |
|
70 | ##('repository',_('Repository names')), | |
67 | ])} |
|
71 | ])} | |
68 | </div> |
|
72 | </div> | |
69 | </div> |
|
73 | </div> | |
70 |
|
74 | |||
71 | </div> |
|
75 | </div> | |
72 | </div> |
|
76 | </div> | |
73 | ${h.end_form()} |
|
77 | ${h.end_form()} | |
74 | <div class="search"> |
|
78 | <div class="search"> | |
75 | %if c.cur_type == 'content': |
|
79 | %if c.cur_type == 'content': | |
76 | <%include file='search_content.html'/> |
|
80 | <%include file='search_content.html'/> | |
77 | %elif c.cur_type == 'path': |
|
81 | %elif c.cur_type == 'path': | |
78 | <%include file='search_path.html'/> |
|
82 | <%include file='search_path.html'/> | |
79 | %elif c.cur_type == 'commit': |
|
83 | %elif c.cur_type == 'commit': | |
80 | <%include file='search_commit.html'/> |
|
84 | <%include file='search_commit.html'/> | |
81 | %elif c.cur_type == 'repository': |
|
85 | %elif c.cur_type == 'repository': | |
82 | <%include file='search_repository.html'/> |
|
86 | <%include file='search_repository.html'/> | |
83 | %endif |
|
87 | %endif | |
84 | </div> |
|
88 | </div> | |
85 | </div> |
|
89 | </div> | |
86 |
|
90 | |||
87 | </%def> |
|
91 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now