annotations: fixed UI problems in annotation view for newer browsers.

This commit is contained in:
Marcin Kuzminski 2017-02-07 21:54:05 +01:00
parent af493443e3
commit 1b7412f886
3 changed files with 50 additions and 53 deletions

View file

@ -1,16 +1,50 @@
<%def name="render_line(line_num, tokens,
annotation=None,
bgcolor=None)">
bgcolor=None, show_annotation=None)">
<%
from rhodecode.lib.codeblocks import render_tokenstream
# avoid module lookup for performance
html_escape = h.html_escape
%>
<tr class="cb-line cb-line-fresh"
<tr class="cb-line cb-line-fresh ${'cb-annotate' if show_annotation else ''}"
%if annotation:
data-revision="${annotation.revision}"
%endif
>
% if annotation:
% if show_annotation:
<td class="cb-annotate-info tooltip"
title="Author: ${annotation.author | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}"
>
${h.gravatar_with_user(annotation.author, 16) | n}
<div class="cb-annotate-message truncate-wrap">${h.chop_at_smart(annotation.message, '\n', suffix_if_chopped='...')}</div>
</td>
<td class="cb-annotate-message-spacer"></td>
<td
class="cb-annotate-revision"
data-revision="${annotation.revision}"
onclick="$('[data-revision=${annotation.revision}]').toggleClass('cb-line-fresh')"
style="background: ${bgcolor}">
<a class="cb-annotate" href="${h.url('changeset_home',repo_name=c.repo_name,revision=annotation.raw_id)}">
r${annotation.revision}
</a>
</td>
% else:
<td></td>
<td class="cb-annotate-message-spacer"></td>
<td
class="cb-annotate-revision"
data-revision="${annotation.revision}"
onclick="$('[data-revision=${annotation.revision}]').toggleClass('cb-line-fresh')"
style="background: ${bgcolor}">
</td>
% endif
% else:
<td colspan="3"></td>
% endif
<td class="cb-lineno" id="L${line_num}">
<a data-line-no="${line_num}" href="#L${line_num}"></a>
</td>
@ -27,40 +61,11 @@
</%def>
<%def name="render_annotation_lines(annotation, lines, color_hasher)">
<%
rowspan = len(lines) + 1 # span the line's <tr> and annotation <tr>
%>
%if not annotation:
<tr class="cb-annotate">
<td class="cb-annotate-message" rowspan="${rowspan}"></td>
<td class="cb-annotate-revision" rowspan="${rowspan}"></td>
</tr>
%else:
<tr class="cb-annotate">
<td class="cb-annotate-info tooltip"
rowspan="${rowspan}"
title="Author: ${annotation.author | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}"
>
${h.gravatar_with_user(annotation.author, 16) | n}
<strong class="cb-annotate-message">${h.truncate(annotation.message, len(lines) * 30)}</strong>
</td>
<td
class="cb-annotate-revision"
rowspan="${rowspan}"
data-revision="${annotation.revision}"
onclick="$('[data-revision=${annotation.revision}]').toggleClass('cb-line-fresh')"
style="background: ${color_hasher(annotation.raw_id)}">
<a href="${h.url('changeset_home',repo_name=c.repo_name,revision=annotation.raw_id)}">
r${annotation.revision}
</a>
</td>
</tr>
%endif
%for line_num, tokens in lines:
% for line_num, tokens in lines:
${render_line(line_num, tokens,
bgcolor=color_hasher(annotation and annotation.raw_id or ''),
annotation=annotation,
annotation=annotation, show_annotation=loop.first
)}
%endfor
% endfor
</%def>