##// END OF EJS Templates
diffs: replace compare controller with new html based diffs:...
diffs: replace compare controller with new html based diffs: * side/side + unified support * redesign of diff changes/operations * added button to see file before the change * auto collapses large diffs refs #4232

File last commit:

r1025:8ba7d016 default
r1030:158ce501 default
Show More
source.html
68 lines | 2.2 KiB | text/html | HtmlLexer
dan
annotations: replace annotated source code viewer with renderer...
r986 <%def name="render_line(line_num, tokens,
annotation=None,
bgcolor=None)">
<%
dan
codeblocks: add new code token rendering function that...
r1025 from rhodecode.lib.codeblocks import render_tokenstream
# avoid module lookup for performance
html_escape = h.html_escape
dan
annotations: replace annotated source code viewer with renderer...
r986 %>
<tr class="cb-line cb-line-fresh"
%if annotation:
data-revision="${annotation.revision}"
%endif
>
<td class="cb-lineno" id="L${line_num}">
<a data-line-no="${line_num}" href="#L${line_num}"></a>
</td>
<td class="cb-content cb-content-fresh"
%if bgcolor:
style="background: ${bgcolor}"
%endif
dan
codeblocks: add new code token rendering function that...
r1025 >
## newline at end is necessary for highlight to work when line is empty
## and for copy pasting code to work as expected
<span class="cb-code">${render_tokenstream(tokens)|n}${'\n'}</span>
</td>
dan
annotations: replace annotated source code viewer with renderer...
r986 </tr>
</%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:
${render_line(line_num, tokens,
bgcolor=color_hasher(annotation and annotation.raw_id or ''),
annotation=annotation,
)}
%endfor
</%def>