# HG changeset patch # User Marcin Kuzminski # Date 2019-02-10 15:48:32 # Node ID 36ee2e147ad49d8dfb571d35774a906578651108 # Parent 24601e964c0f2f6aee5452c5c58dd60d370ddedb search: added narrow result links for global search. diff --git a/rhodecode/public/css/summary.less b/rhodecode/public/css/summary.less --- a/rhodecode/public/css/summary.less +++ b/rhodecode/public/css/summary.less @@ -268,6 +268,12 @@ text-align: right; color: @grey4; } + + .file-container { + display: inline-block; + width: 100%; + } + } #summary-menu-stats { diff --git a/rhodecode/templates/search/search.mako b/rhodecode/templates/search/search.mako --- a/rhodecode/templates/search/search.mako +++ b/rhodecode/templates/search/search.mako @@ -43,6 +43,22 @@ %endif +<%def name="repo_icon(db_repo)"> + %if h.is_hg(db_repo): + + %endif + %if h.is_git(db_repo): + + %endif + %if h.is_svn(db_repo): + + %endif + + +<%def name="repo_group_icon()"> + + + <%def name="main()">
%if c.repo_name: @@ -80,9 +96,9 @@
%if c.repo_name: - ${_('Global Search')} + ${_('Global Search')} %elif c.repo_group_name: - ${_('Global Search')} + ${_('Global Search')} % else: ${_('Global Search')} %endif @@ -91,22 +107,14 @@ %if c.repo_name: » - %if h.is_hg(c.rhodecode_db_repo): - - %endif - %if h.is_git(c.rhodecode_db_repo): - - %endif - %if h.is_svn(c.rhodecode_db_repo): - - %endif + ${repo_icon(c.rhodecode_db_repo)} ${c.repo_name} %elif c.repo_group_name: » - + ${repo_group_icon()} ${c.repo_group_name} %endif diff --git a/rhodecode/templates/search/search_commit.mako b/rhodecode/templates/search/search_commit.mako --- a/rhodecode/templates/search/search_commit.mako +++ b/rhodecode/templates/search/search_commit.mako @@ -1,4 +1,5 @@ <%namespace name="base" file="/base/base.mako"/> +<%namespace name="search" file="/search/search.mako"/> % if c.formatted_results: @@ -23,13 +24,7 @@ <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> - %if repo_type == 'hg': - - %elif repo_type == 'git': - - %elif repo_type == 'svn': - - %endif + ${search.repo_icon(repo_type)} ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} diff --git a/rhodecode/templates/search/search_content.mako b/rhodecode/templates/search/search_content.mako --- a/rhodecode/templates/search/search_content.mako +++ b/rhodecode/templates/search/search_content.mako @@ -1,3 +1,4 @@ +<%namespace name="search" file="/search/search.mako"/> <%def name="highlight_text_file(has_matched_content, file_content, lexer, html_formatter, matching_lines, shown_matching_lines, url, use_hl_filter)"> % if has_matched_content: @@ -61,56 +62,83 @@

<% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> - %if repo_type == 'hg': - - %elif repo_type == 'git': - - %elif repo_type == 'svn': - - %endif + ${search.repo_icon(repo_type)} ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))}

- -
- - - - ${h.link_to(h.literal(entry['f_path']), h.route_path('repo_files',repo_name=entry['repository'],commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path']))} - - - -
- - ${len(matching_lines)} ${_ungettext('search match', 'search matches', len(matching_lines))} - + ## level 1 +
- - %if entry.get('lines'): - | ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} - %endif - +
+ + + + ${h.link_to(h.literal(entry['f_path']), h.route_path('repo_files',repo_name=entry['repository'],commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path']))} + + + + + +
- - %if entry.get('size'): - | ${h.format_byte_size_binary(entry['size'])} - %endif - - - - %if entry.get('mimetype'): - | ${entry.get('mimetype', "unknown mimetype")} - %endif - +
+
+ + ${_('Show Full History')} + + | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} + | ${h.link_to(_('Raw'), h.route_path('repo_file_raw', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} + | ${h.link_to(_('Download'), h.route_path('repo_file_download',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} +
+
-
- - ${_('Show Full History')} - - | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} - | ${h.link_to(_('Raw'), h.route_path('repo_file_raw', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} - | ${h.link_to(_('Download'), h.route_path('repo_file_download',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} + ## level 2 +
+ +
+ + %if entry.get('lines'): + ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} + (${len(matching_lines)} ${_ungettext('matched', 'matched', len(matching_lines))}) + %endif + + + + %if entry.get('size'): + | ${h.format_byte_size_binary(entry['size'])} + %endif + + + + %if entry.get('mimetype'): + | ${entry.get('mimetype', "unknown mimetype")} + %endif + +
+ +
+
+ + <% repo_group = entry.get('repository_group')%> + ## hiden if in repo group view + % if repo_group and not c.repo_group_name: + + ${search.repo_group_icon()} + ${_('Narrow to this repository group')} + + % endif + ## hiden if in repo view + % if not c.repo_name: + + ${search.repo_icon(repo_type)} + ${_('Narrow to this repository')} + + % endif +
+
+
+
diff --git a/rhodecode/templates/search/search_path.mako b/rhodecode/templates/search/search_path.mako --- a/rhodecode/templates/search/search_path.mako +++ b/rhodecode/templates/search/search_path.mako @@ -1,3 +1,5 @@ +<%namespace name="search" file="/search/search.mako"/> + % if c.formatted_results: @@ -13,13 +15,7 @@
<% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> - %if repo_type == 'hg': - - %elif repo_type == 'git': - - %elif repo_type == 'svn': - - %endif + ${search.repo_icon(repo_type)} ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))}