Show More
@@ -32,7 +32,13 b' def assert_and_get_main_filter_content(r' | |||
|
32 | 32 | |
|
33 | 33 | if data_item['type'] == 'search': |
|
34 | 34 | display_val = data_item['value_display'] |
|
35 | assert 'Search for:' in display_val, display_val | |
|
35 | if data_item['id'] == -1: | |
|
36 | assert 'File search for:' in display_val, display_val | |
|
37 | elif data_item['id'] == -2: | |
|
38 | assert 'Commit search for:' in display_val, display_val | |
|
39 | else: | |
|
40 | assert False, 'No Proper ID returned {}'.format(data_item['id']) | |
|
41 | ||
|
36 | 42 | elif data_item['type'] == 'repo': |
|
37 | 43 | repos.append(data_item) |
|
38 | 44 | elif data_item['type'] == 'repo_group': |
@@ -263,19 +263,30 b' class HomeView(BaseAppView):' | |||
|
263 | 263 | 'commit_id:{}*'.format(commit_hash), 'commit', auth_user, |
|
264 | 264 | raise_on_exc=False) |
|
265 | 265 | |
|
266 |
|
|
|
267 | { | |
|
266 | commits = [] | |
|
267 | for entry in result['results']: | |
|
268 | repo_data = { | |
|
269 | 'repository_id': entry.get('repository_id'), | |
|
270 | 'repository_type': entry.get('repo_type'), | |
|
271 | 'repository_name': entry.get('repository'), | |
|
272 | } | |
|
273 | ||
|
274 | commit_entry = { | |
|
268 | 275 | 'id': entry['commit_id'], |
|
269 | 276 | 'value': org_query, |
|
270 |
'value_display': ' |
|
|
277 | 'value_display': '`{}` commit: {}'.format( | |
|
271 | 278 | entry['repository'], entry['commit_id']), |
|
272 | 279 | 'type': 'commit', |
|
273 | 280 | 'repo': entry['repository'], |
|
281 | 'repo_data': repo_data, | |
|
282 | ||
|
274 | 283 | 'url': h.route_path( |
|
275 | 284 | 'repo_commit', |
|
276 | 285 | repo_name=entry['repository'], commit_id=entry['commit_id']) |
|
277 | 286 | } |
|
278 | for entry in result['results']] | |
|
287 | ||
|
288 | commits.append(commit_entry) | |
|
289 | return commits | |
|
279 | 290 | |
|
280 | 291 | @LoginRequired() |
|
281 | 292 | @view_config( |
@@ -373,7 +384,7 b' class HomeView(BaseAppView):' | |||
|
373 | 384 | label = u'Commit search for `{}` in this repository.'.format(query) |
|
374 | 385 | queries.append( |
|
375 | 386 | { |
|
376 |
'id': - |
|
|
387 | 'id': -20, | |
|
377 | 388 | 'value': query, |
|
378 | 389 | 'value_display': label, |
|
379 | 390 | 'type': 'search', |
@@ -392,7 +403,7 b' class HomeView(BaseAppView):' | |||
|
392 | 403 | label = u'File search for `{}` in this repository group'.format(query) |
|
393 | 404 | queries.append( |
|
394 | 405 | { |
|
395 |
'id': - |
|
|
406 | 'id': -30, | |
|
396 | 407 | 'value': query, |
|
397 | 408 | 'value_display': label, |
|
398 | 409 | 'type': 'search', |
@@ -410,7 +421,7 b' class HomeView(BaseAppView):' | |||
|
410 | 421 | label = u'Commit search for `{}` in this repository group'.format(query) |
|
411 | 422 | queries.append( |
|
412 | 423 | { |
|
413 |
'id': - |
|
|
424 | 'id': -40, | |
|
414 | 425 | 'value': query, |
|
415 | 426 | 'value_display': label, |
|
416 | 427 | 'type': 'search', |
@@ -425,16 +436,16 b' class HomeView(BaseAppView):' | |||
|
425 | 436 | { |
|
426 | 437 | 'id': -1, |
|
427 | 438 | 'value': query, |
|
428 |
'value_display': u' |
|
|
439 | 'value_display': u'File search for: `{}`'.format(query), | |
|
429 | 440 | 'type': 'search', |
|
430 | 441 | 'url': h.route_path('search', |
|
431 | 442 | _query={'q': query, 'type': 'content'}) |
|
432 | 443 | }) |
|
433 | 444 | queries.append( |
|
434 | 445 | { |
|
435 |
'id': - |
|
|
446 | 'id': -2, | |
|
436 | 447 | 'value': query, |
|
437 |
'value_display': u' |
|
|
448 | 'value_display': u'Commit search for: `{}`'.format(query), | |
|
438 | 449 | 'type': 'search', |
|
439 | 450 | 'url': h.route_path('search', |
|
440 | 451 | _query={'q': query, 'type': 'commit'}) |
@@ -636,8 +636,10 b' ul#context-pages {' | |||
|
636 | 636 | border-bottom: 1px solid @grey4; |
|
637 | 637 | display: inline-block; |
|
638 | 638 | vertical-align: top; |
|
639 | margin-left: -7px; | |
|
640 | background: @grey3; | |
|
639 | background: inherit; | |
|
640 | position: absolute; | |
|
641 | right: 8px; | |
|
642 | top: 9px; | |
|
641 | 643 | } |
|
642 | 644 | |
|
643 | 645 | .main_filter_input_box { |
@@ -652,24 +654,36 b' ul#context-pages {' | |||
|
652 | 654 | background: @grey3; |
|
653 | 655 | border: 1px solid black; |
|
654 | 656 | position: absolute; |
|
655 |
white-space: pre |
|
|
657 | white-space: pre; | |
|
656 | 658 | z-index: 9999; |
|
657 | 659 | color: @nav-grey; |
|
658 | 660 | margin: 1px 7px; |
|
659 |
padding: 0 |
|
|
661 | padding: 0 10px; | |
|
660 | 662 | } |
|
661 | 663 | |
|
662 | 664 | .main_filter_input { |
|
663 | 665 | padding: 5px; |
|
664 |
min-width: 2 |
|
|
666 | min-width: 260px; | |
|
665 | 667 | color: @nav-grey; |
|
666 | 668 | background: @grey3; |
|
667 | 669 | min-height: 18px; |
|
670 | ||
|
671 | ||
|
672 | &:active { | |
|
673 | color: @grey2 !important; | |
|
674 | background: white !important; | |
|
675 | } | |
|
676 | &:focus { | |
|
677 | color: @grey2 !important; | |
|
678 | background: white !important; | |
|
679 | } | |
|
668 | 680 | } |
|
669 | 681 | |
|
682 | ||
|
683 | ||
|
670 | 684 | .main_filter_input::placeholder { |
|
671 | color: @nav-grey; | |
|
672 | opacity: 1; | |
|
685 | color: @nav-grey; | |
|
686 | opacity: 1; | |
|
673 | 687 | } |
|
674 | 688 | |
|
675 | 689 | .notice-box { |
@@ -492,17 +492,17 b'' | |||
|
492 | 492 | </div> |
|
493 | 493 | |
|
494 | 494 | <div id="main_filter_help" style="display: none"> |
|
495 | Use '/' key to quickly access this field. | |
|
496 | Enter name of repository, or repository group for quick search. | |
|
495 | - Use '/' key to quickly access this field. | |
|
497 | 496 | |
|
498 | Prefix query to allow special search: | |
|
497 | - Enter a name of repository, or repository group for quick search. | |
|
498 | ||
|
499 | - Prefix query to allow special search: | |
|
499 | 500 | |
|
500 | user:admin, to search for usernames | |
|
501 | user:admin, to search for usernames | |
|
501 | 502 | |
|
502 | user_group:devops, to search for user groups | |
|
503 | user_group:devops, to search for user groups | |
|
503 | 504 | |
|
504 | commit:efced4, to search for commits | |
|
505 | ||
|
505 | commit:efced4, to search for commits | |
|
506 | 506 | </div> |
|
507 | 507 | </li> |
|
508 | 508 | |
@@ -626,10 +626,23 b' commit:efced4, to search for commits' | |||
|
626 | 626 | var valueDisplay = data['value_display']; |
|
627 | 627 | |
|
628 | 628 | var escapeRegExChars = function (value) { |
|
629 | return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
|
629 | return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
|
630 | 630 | }; |
|
631 | 631 | var pattern = '(' + escapeRegExChars(value) + ')'; |
|
632 | 632 | |
|
633 | var getRepoIcon = function(repo_type) { | |
|
634 | if (repo_type === 'hg') { | |
|
635 | return '<i class="icon-hg"></i> '; | |
|
636 | } | |
|
637 | else if (repo_type === 'git') { | |
|
638 | return '<i class="icon-git"></i> '; | |
|
639 | } | |
|
640 | else if (repo_type === 'svn') { | |
|
641 | return '<i class="icon-svn"></i> '; | |
|
642 | } | |
|
643 | return '' | |
|
644 | }; | |
|
645 | ||
|
633 | 646 | // highlight match |
|
634 | 647 | valueDisplay = Select2.util.escapeMarkup(valueDisplay); |
|
635 | 648 | valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>'); |
@@ -639,19 +652,16 b' commit:efced4, to search for commits' | |||
|
639 | 652 | if (searchType === 'hint') { |
|
640 | 653 | icon += '<i class="icon-folder-close"></i> '; |
|
641 | 654 | } |
|
655 | // full text search | |
|
642 | 656 | else if (searchType === 'search') { |
|
643 | 657 | icon += '<i class="icon-more"></i> '; |
|
644 | 658 | } |
|
659 | // repository | |
|
645 | 660 | else if (searchType === 'repo') { |
|
646 | if (data['repo_type'] === 'hg') { | |
|
647 | icon += '<i class="icon-hg"></i> '; | |
|
648 |
|
|
|
649 | else if (data['repo_type'] === 'git') { | |
|
650 | icon += '<i class="icon-git"></i> '; | |
|
651 | } | |
|
652 | else if (data['repo_type'] === 'svn') { | |
|
653 | icon += '<i class="icon-svn"></i> '; | |
|
654 | } | |
|
661 | ||
|
662 | var repoIcon = getRepoIcon(data['repo_type']); | |
|
663 | icon += repoIcon; | |
|
664 | ||
|
655 | 665 | if (data['private']) { |
|
656 | 666 | icon += '<i class="icon-lock" ></i> '; |
|
657 | 667 | } |
@@ -659,17 +669,26 b' commit:efced4, to search for commits' | |||
|
659 | 669 | icon += '<i class="icon-unlock-alt"></i> '; |
|
660 | 670 | } |
|
661 | 671 | } |
|
672 | // repository groups | |
|
662 | 673 | else if (searchType === 'repo_group') { |
|
663 | 674 | icon += '<i class="icon-folder-close"></i> '; |
|
664 | 675 | } |
|
676 | // user group | |
|
665 | 677 | else if (searchType === 'user_group') { |
|
666 | 678 | icon += '<i class="icon-group"></i> '; |
|
667 | 679 | } |
|
668 | 680 | else if (searchType === 'user') { |
|
669 | 681 | icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']); |
|
670 | 682 | } |
|
683 | // commit | |
|
671 | 684 | else if (searchType === 'commit') { |
|
672 | icon += '<i class="icon-tag"></i>'; | |
|
685 | var repo_data = data['repo_data']; | |
|
686 | var repoIcon = getRepoIcon(repo_data['repository_type']); | |
|
687 | if (repoIcon) { | |
|
688 | icon += repoIcon; | |
|
689 | } else { | |
|
690 | icon += '<i class="icon-tag"></i>'; | |
|
691 | } | |
|
673 | 692 | } |
|
674 | 693 | |
|
675 | 694 | var tmpl = '<div class="ac-container-wrap">{0}{1}</div>'; |
@@ -715,7 +734,7 b' commit:efced4, to search for commits' | |||
|
715 | 734 | |
|
716 | 735 | showMainFilterBox = function () { |
|
717 | 736 | $('#main_filter_help').toggle(); |
|
718 | } | |
|
737 | }; | |
|
719 | 738 | |
|
720 | 739 | </script> |
|
721 | 740 | <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script> |
General Comments 0
You need to be logged in to leave comments.
Login now