search: fixed UI of search items after redesign.

This commit is contained in:
Marcin Kuzminski 2019-06-12 21:27:38 +02:00
parent bdc62537a6
commit 8501ae81be
3 changed files with 58 additions and 64 deletions

View file

@ -221,7 +221,8 @@ tooltip = _ToolTip()
files_icon = icon = '<i class="file-breadcrumb-copy tooltip icon-clipboard clipboard-action" data-clipboard-text="{}" title="Copy the full path"></i>'
def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=False):
def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=False, linkify_last_item=False):
if isinstance(file_path, str):
file_path = safe_unicode(file_path)
@ -247,7 +248,12 @@ def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=
continue
segment_html = escape(segment)
if cnt != last_cnt:
last_item = cnt == last_cnt
if last_item and linkify_last_item is False:
# plain version
url_segments.append(segment_html)
else:
url_segments.append(
link_to(
segment_html,
@ -257,9 +263,7 @@ def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=
commit_id=commit_id,
f_path='/'.join(path_segments[:cnt + 1]),
_query=route_qry),
))
else:
url_segments.append(segment_html)
))
limited_url_segments = url_segments[:1] + ['...'] + url_segments[-5:]
if limit_items and len(limited_url_segments) < len(url_segments):

View file

@ -2360,7 +2360,7 @@ div.search-code-body {
}
.code-body {
border: @border-thickness solid @border-default-color;
border: @border-thickness solid @grey6;
.border-radius(@border-radius);
}
@ -2380,6 +2380,11 @@ div.search-code-body {
.break { background-color: #DDE7EF; width: 100%; color: #747474; display: block; }
}
.path {
border-bottom: none !important;
border-left: 1px solid @grey6 !important;
border-right: 1px solid @grey6 !important;
}
}
table.rctable td.td-search-results div {

View file

@ -58,65 +58,50 @@
%>
## search results are additionally filtered, and this check is just a safe gate
% if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results content check'):
<div id="codeblock" class="codeblock">
<div class="codeblock">
<h1>
<% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %>
${search.repo_icon(repo_type)}
${h.link_to(entry['repository'], h.route_path('repo_summary', repo_name=entry['repository']))}
</h1>
<div class="codeblock-header">
<h1>
<% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %>
${search.repo_icon(repo_type)}
${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))}
</h1>
## level 1
<div class="file-container">
<div class="file-filename">
<i class="icon-file"></i> ${entry['f_path'].split('/')[-1]}
</div>
<div class="file-stats">
<div class="stats-info">
<span class="stats-first-item">
${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))}
(${len(matching_lines)} ${_ungettext('matched', 'matched', len(matching_lines))})
</span>
<span>
% if entry.get('size'):
| ${h.format_byte_size_binary(entry['size'])}
% endif
</span>
<span>
% if entry.get('mimetype'):
| ${entry.get('mimetype', "unknown mimetype")}
% endif
</span>
</div>
</div>
</div>
<div class="path clear-fix">
<div class="pull-left">
<span class="stats-filename">
<strong>
<i class="icon-file-text"></i>
${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']))}
</strong>
</span>
<span class="item last">
<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${entry['f_path']}" title="${_('Copy the full path')}"></i>
</span>
${h.files_breadcrumbs(entry['repository'],entry.get('commit_id', 'tip'),entry['f_path'], linkify_last_item=True)}
</div>
<div class="pull-right">
<div class="buttons">
<a id="file_history_overview_full" href="${h.route_path('repo_commits_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}">
${_('Show Full History')}
</a>
| ${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','')))}
</div>
</div>
</div>
## level 2
<div class="file-container">
<div class="pull-left">
<span class="stats-first-item">
%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
</span>
<span>
%if entry.get('size'):
| ${h.format_byte_size_binary(entry['size'])}
%endif
</span>
<span>
%if entry.get('mimetype'):
| ${entry.get('mimetype', "unknown mimetype")}
%endif
</span>
</div>
<div class="pull-right">
<div class="pull-right stats">
## <a id="file_history_overview_full" href="${h.route_path('repo_commits_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}">
## ${_('Show Full History')}
## </a>
## | ${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','')))}
<div class="search-tags">
<% repo_group = entry.get('repository_group')%>
@ -135,13 +120,13 @@
</span>
% endif
</div>
</div>
</div>
<div class="clear-fix"></div>
</div>
<div class="code-body search-code-body">
<div class="code-body search-code-body clear-fix">
${highlight_text_file(
has_matched_content=has_matched_content,
file_content=file_content,