##// END OF EJS Templates
auth: prepare code for removal of pylons request in pyramid migration.
auth: prepare code for removal of pylons request in pyramid migration.

File last commit:

r1413:44a048ec default
r1791:8160938e default
Show More
source.mako
90 lines | 3.3 KiB | application/x-mako | MakoHtmlLexer
templating: use .mako as extensions for template files.
r1282 <%def name="render_line(line_num, tokens,
annotation=None,
annotations: fixed UI problems in annotation view for newer browsers.
r1412 bgcolor=None, show_annotation=None)">
templating: use .mako as extensions for template files.
r1282 <%
from rhodecode.lib.codeblocks import render_tokenstream
# avoid module lookup for performance
html_escape = h.html_escape
%>
annotations: fixed UI problems in annotation view for newer browsers.
r1412 <tr class="cb-line cb-line-fresh ${'cb-annotate' if show_annotation else ''}"
templating: use .mako as extensions for template files.
r1282 %if annotation:
data-revision="${annotation.revision}"
%endif
>
annotations: fixed UI problems in annotation view for newer browsers.
r1412
% 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>
annotation: added shortcut links to browse the annotation view with previous commits.
r1413 <td class="cb-annotate-message-spacer">
<a class="tooltip" href="#show-previous-annotation" onclick="return annotationController.previousAnnotation('${annotation.raw_id}', '${c.f_path}')" title="${_('view annotation from before this change')}">
<i class="icon-left"></i>
</a>
</td>
annotations: fixed UI problems in annotation view for newer browsers.
r1412 <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
templating: use .mako as extensions for template files.
r1282 <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
>
## 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>
</tr>
</%def>
<%def name="render_annotation_lines(annotation, lines, color_hasher)">
annotations: fixed UI problems in annotation view for newer browsers.
r1412 % for line_num, tokens in lines:
templating: use .mako as extensions for template files.
r1282 ${render_line(line_num, tokens,
bgcolor=color_hasher(annotation and annotation.raw_id or ''),
annotations: fixed UI problems in annotation view for newer browsers.
r1412 annotation=annotation, show_annotation=loop.first
templating: use .mako as extensions for template files.
r1282 )}
annotations: fixed UI problems in annotation view for newer browsers.
r1412 % endfor
annotation: added shortcut links to browse the annotation view with previous commits.
r1413 <script>
var AnnotationController = function() {
var self = this;
annotations: fixed UI problems in annotation view for newer browsers.
r1412
annotation: added shortcut links to browse the annotation view with previous commits.
r1413 this.previousAnnotation = function(commitId, fPath) {
var params = {
'repo_name': templateContext.repo_name,
'revision': commitId,
'f_path': fPath
};
window.location = pyroutes.url('files_annotate_previous', params);
return false;
};
};
var annotationController = new AnnotationController();
</script>
templating: use .mako as extensions for template files.
r1282 </%def>