Show More
@@ -389,8 +389,12 b' def make_map(config):' | |||||
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') |
@@ -29,7 +29,7 b' 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 | |||
@@ -46,14 +46,14 b' from rhodecode.lib.utils2 import safe_st' | |||||
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) |
@@ -221,7 +221,7 b'' | |||||
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]: |
@@ -1,43 +1,47 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 | %if c.cur_query: |
|
|||
5 |
|
|
5 | %if c.repo_name: | |
6 | ${_('Search "%s" in repository: %s') % (c.cur_query, c.repo_name)} |
|
6 | ${_('Search repository')} ${c.repo_name} - ${c.rhodecode_name} | |
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 |
|
|
7 | %else: | |
14 |
|
|
8 | ${_('Search in all repositories')} | |
15 |
|
|
9 | %endif | |
16 | %endif |
|
|||
17 | - ${c.rhodecode_name} |
|
|||
18 | </%def> |
|
10 | </%def> | |
19 | <%def name="breadcrumbs()"> |
|
11 | ||
20 | ${c.rhodecode_name} |
|
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 | |||
21 | </%def> |
|
26 | </%def> | |
|
27 | ||||
22 | <%def name="page_nav()"> |
|
28 | <%def name="page_nav()"> | |
|
29 | %if c.repo_name: | |||
|
30 | ${self.menu('options')} | |||
|
31 | %else: | |||
23 | ${self.menu('search')} |
|
32 | ${self.menu('search')} | |
|
33 | %endif | |||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now