Show More
@@ -29,7 +29,7 b' from rhodecode.lib import helpers as h' | |||
|
29 | 29 | from rhodecode.lib.auth import ( |
|
30 | 30 | LoginRequired, NotAnonymous, HasRepoGroupPermissionAnyDecorator) |
|
31 | 31 | from rhodecode.lib.index import searcher_from_config |
|
32 | from rhodecode.lib.utils2 import safe_unicode, str2bool | |
|
32 | from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int | |
|
33 | 33 | from rhodecode.lib.ext_json import json |
|
34 | 34 | from rhodecode.model.db import ( |
|
35 | 35 | func, or_, in_filter_generator, Repository, RepoGroup, User, UserGroup) |
@@ -326,6 +326,20 b' class HomeView(BaseAppView):' | |||
|
326 | 326 | 'url': h.route_path( |
|
327 | 327 | 'search', _query={'q': query}) |
|
328 | 328 | }) |
|
329 | repo_group_id = safe_int(self.request.GET.get('repo_group_id')) | |
|
330 | if repo_group_id: | |
|
331 | repo_group = RepoGroup.get(repo_group_id) | |
|
332 | composed_hint = '{}/{}'.format(repo_group.group_name, query) | |
|
333 | show_hint = not query.startswith(repo_group.group_name) | |
|
334 | if repo_group and show_hint: | |
|
335 | hint = u'Group search: `{}`'.format(composed_hint) | |
|
336 | res.append({ | |
|
337 | 'id': -1, | |
|
338 | 'value': composed_hint, | |
|
339 | 'value_display': hint, | |
|
340 | 'type': 'hint', | |
|
341 | 'url': "" | |
|
342 | }) | |
|
329 | 343 | |
|
330 | 344 | repo_groups = self._get_repo_group_list(query) |
|
331 | 345 | for serialized_repo_group in repo_groups: |
@@ -523,7 +523,10 b' commit:efced4, to search for commits' | |||
|
523 | 523 | |
|
524 | 524 | var icon = ''; |
|
525 | 525 | |
|
526 |
if (searchType === ' |
|
|
526 | if (searchType === 'hint') { | |
|
527 | icon += '<i class="icon-folder-close"></i> '; | |
|
528 | } | |
|
529 | else if (searchType === 'search') { | |
|
527 | 530 | icon += '<i class="icon-more"></i> '; |
|
528 | 531 | } |
|
529 | 532 | else if (searchType === 'repo') { |
@@ -561,7 +564,12 b' commit:efced4, to search for commits' | |||
|
561 | 564 | }; |
|
562 | 565 | |
|
563 | 566 | var handleSelect = function(element, suggestion) { |
|
567 | if (suggestion.type === "hint") { | |
|
568 | // we skip action | |
|
569 | $('#main_filter').focus(); | |
|
570 | } else { | |
|
564 | 571 | window.location = suggestion['url']; |
|
572 | } | |
|
565 | 573 | }; |
|
566 | 574 | var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) { |
|
567 | 575 | if (queryLowerCase.split(':').length === 2) { |
@@ -572,6 +580,7 b' commit:efced4, to search for commits' | |||
|
572 | 580 | |
|
573 | 581 | $('#main_filter').autocomplete({ |
|
574 | 582 | serviceUrl: pyroutes.url('goto_switcher_data'), |
|
583 | params: {"repo_group_id": templateContext.repo_group_id}, | |
|
575 | 584 | minChars:2, |
|
576 | 585 | maxHeight:400, |
|
577 | 586 | deferRequestBy: 300, //miliseconds |
@@ -8,6 +8,9 b" if hasattr(c, 'rhodecode_db_repo'):" | |||
|
8 | 8 | c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type |
|
9 | 9 | c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1] |
|
10 | 10 | |
|
11 | if getattr(c, 'repo_group', None): | |
|
12 | c.template_context['repo_group_id'] = c.repo_group.group_id | |
|
13 | ||
|
11 | 14 | if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id: |
|
12 | 15 | c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username |
|
13 | 16 | c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email |
General Comments 0
You need to be logged in to leave comments.
Login now