##// END OF EJS Templates
docs: deprecate beaker.cache in docs
docs: deprecate beaker.cache in docs

File last commit:

r2808:241bd1e7 default
r3058:b5d3f00d default
Show More
diffs.mako
735 lines | 29.3 KiB | application/x-mako | MakoHtmlLexer
comments: allow submitting id of comment which submitted comment resolved....
r1325 <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/>
templating: use .mako as extensions for template files.
r1282 <%def name="diff_line_anchor(filename, line, type)"><%
return '%s_%s_%i' % (h.safeid(filename), type, line)
%></%def>
html: fixed found syntax problems
r1283 <%def name="action_class(action)">
<%
templating: use .mako as extensions for template files.
r1282 return {
'-': 'cb-deletion',
'+': 'cb-addition',
' ': 'cb-context',
}.get(action, 'cb-empty')
html: fixed found syntax problems
r1283 %>
</%def>
templating: use .mako as extensions for template files.
r1282
html: fixed found syntax problems
r1283 <%def name="op_class(op_id)">
<%
templating: use .mako as extensions for template files.
r1282 return {
DEL_FILENODE: 'deletion', # file deleted
BIN_FILENODE: 'warning' # binary diff hidden
}.get(op_id, 'addition')
html: fixed found syntax problems
r1283 %>
</%def>
templating: use .mako as extensions for template files.
r1282
routing: remove usage of url.current from pylons.
r2104
templating: use .mako as extensions for template files.
r1282
<%def name="render_diffset(diffset, commit=None,
# collapse all file diff entries when there are more than this amount of files in the diff
collapse_when_files_over=20,
# collapse lines in the diff when more than this amount of lines changed in the file diff
lines_changed_limit=500,
# add a ruler at to the output
ruler_at_chars=0,
# show inline comments
use_comments=False,
# disable new comments
disable_new_comments=False,
# special file-comments that were deleted in previous versions
# it's used for showing outdated comments for deleted files in a PR
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 deleted_files_comments=None,
# for cache purpose
inline_comments=None
templating: use .mako as extensions for template files.
r1282
)">
%if use_comments:
<div id="cb-comments-inline-container-template" class="js-template">
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container([], inline_comments)}
templating: use .mako as extensions for template files.
r1282 </div>
<div class="js-template" id="cb-comment-inline-form-template">
<div class="comment-inline-form ac">
%if c.rhodecode_user.username != h.DEFAULT_USER:
comments: allow submitting id of comment which submitted comment resolved....
r1325 ## render template for inline comments
${commentblock.comment_form(form_type='inline')}
templating: use .mako as extensions for template files.
r1282 %else:
${h.form('', class_='inline-form comment-form-login', method='get')}
<div class="pull-left">
<div class="comment-help pull-right">
routing: remove usage of url.current from pylons.
r2104 ${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="comment-button pull-right">
<button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
${_('Cancel')}
</button>
</div>
<div class="clearfix"></div>
${h.end_form()}
%endif
</div>
</div>
%endif
<%
collapse_all = len(diffset.files) > collapse_when_files_over
%>
%if c.diffmode == 'sideside':
<style>
.wrapper {
max-width: 1600px !important;
}
</style>
%endif
%if ruler_at_chars:
<style>
.diff table.cb .cb-content:after {
content: "";
border-left: 1px solid blue;
position: absolute;
top: 0;
height: 18px;
opacity: .2;
z-index: 10;
//## +5 to account for diff action (+/-)
left: ${ruler_at_chars + 5}ch;
</style>
%endif
<div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
<div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
%if commit:
<div class="pull-right">
files: ported repository files controllers to pyramid views.
r1927 <a class="btn tooltip" title="${h.tooltip(_('Browse Files at revision {}').format(commit.raw_id))}" href="${h.route_path('repo_files',repo_name=diffset.repo_name, commit_id=commit.raw_id, f_path='')}">
templating: use .mako as extensions for template files.
r1282 ${_('Browse Files')}
</a>
</div>
%endif
<h2 class="clearinner">
%if commit:
repo-commits: ported changeset code into pyramid views....
r1951 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=commit.raw_id)}">${'r%s:%s' % (commit.revision,h.short_id(commit.raw_id))}</a> -
templating: use .mako as extensions for template files.
r1282 ${h.age_component(commit.date)} -
%endif
routing: removed more usage of pylons url() objects.
r2103
%if diffset.limited_diff:
${_('The requested commit is too big and content was truncated.')}
templating: use .mako as extensions for template files.
r1282
routing: removed more usage of pylons url() objects.
r2103 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
routing: remove usage of url.current from pylons.
r2104 <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
routing: removed more usage of pylons url() objects.
r2103 %else:
${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
'%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}}
%endif
templating: use .mako as extensions for template files.
r1282
</h2>
</div>
path-permissions: Initial support for path-based permissions
r2618 %if diffset.has_hidden_changes:
<p class="empty_data">${_('Some changes may be hidden')}</p>
%elif not diffset.files:
templating: use .mako as extensions for template files.
r1282 <p class="empty_data">${_('No files')}</p>
%endif
<div class="filediffs">
pr-diffs: fixed a case when there are outdated comments and we're doing a rebase compare.
r1374 ## initial value could be marked as False later on
<% over_lines_changed_limit = False %>
templating: use .mako as extensions for template files.
r1282 %for i, filediff in enumerate(diffset.files):
<%
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
templating: use .mako as extensions for template files.
r1282 over_lines_changed_limit = lines_changed > lines_changed_limit
%>
<input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
<div
class="filediff"
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 data-f-path="${filediff.patch['filename']}"
id="a_${h.FID('', filediff.patch['filename'])}">
templating: use .mako as extensions for template files.
r1282 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
<div class="filediff-collapse-indicator"></div>
${diff_ops(filediff)}
</label>
${diff_menu(filediff, use_comments=use_comments)}
<table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
%if not filediff.hunks:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %for op_id, op_text in filediff.patch['stats']['ops'].items():
templating: use .mako as extensions for template files.
r1282 <tr>
<td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
%if op_id == DEL_FILENODE:
${_('File was deleted')}
%elif op_id == BIN_FILENODE:
${_('Binary file hidden')}
%else:
${op_text}
%endif
</td>
</tr>
%endfor
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.limited_diff:
templating: use .mako as extensions for template files.
r1282 <tr class="cb-warning cb-collapser">
<td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
routing: remove usage of url.current from pylons.
r2104 ${_('The requested commit is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%else:
%if over_lines_changed_limit:
<tr class="cb-warning cb-collapser">
<td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
<a href="#" class="cb-expand"
onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
</a>
<a href="#" class="cb-collapse"
onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
</a>
</td>
</tr>
%endif
%endif
%for hunk in filediff.hunks:
<tr class="cb-hunk">
<td ${c.diffmode == 'unified' and 'colspan=3' or ''}>
## TODO: dan: add ajax loading of more context here
## <a href="#">
<i class="icon-more"></i>
## </a>
</td>
<td ${c.diffmode == 'sideside' and 'colspan=5' or ''}>
@@
-${hunk.source_start},${hunk.source_length}
+${hunk.target_start},${hunk.target_length}
${hunk.section_header}
</td>
</tr>
%if c.diffmode == 'unified':
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${render_hunk_lines_unified(hunk, use_comments=use_comments, inline_comments=inline_comments)}
templating: use .mako as extensions for template files.
r1282 %elif c.diffmode == 'sideside':
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${render_hunk_lines_sideside(hunk, use_comments=use_comments, inline_comments=inline_comments)}
templating: use .mako as extensions for template files.
r1282 %else:
<tr class="cb-line">
<td>unknown diff mode</td>
</tr>
%endif
%endfor
## outdated comments that do not fit into currently displayed lines
% for lineno, comments in filediff.left_comments.items():
%if c.diffmode == 'unified':
<tr class="cb-line">
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-content cb-context">
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments, inline_comments)}
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%elif c.diffmode == 'sideside':
<tr class="cb-line">
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
comments: place the left over comments (outdated/misplaced) to the left or right pane....
r2249 <td class="cb-content cb-context">
% if lineno.startswith('o'):
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments, inline_comments)}
comments: place the left over comments (outdated/misplaced) to the left or right pane....
r2249 % endif
</td>
templating: use .mako as extensions for template files.
r1282
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-content cb-context">
comments: place the left over comments (outdated/misplaced) to the left or right pane....
r2249 % if lineno.startswith('n'):
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments, inline_comments)}
comments: place the left over comments (outdated/misplaced) to the left or right pane....
r2249 % endif
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%endif
% endfor
</table>
</div>
%endfor
## outdated comments that are made for a file that has been deleted
% for filename, comments_dict in (deleted_files_comments or {}).items():
pull-requests: fixed case of unresolved comments attached to removed file in pr....
r2808 <%
display_state = 'display: none'
open_comments_in_file = [x for x in comments_dict['comments'] if x.outdated is False]
if open_comments_in_file:
display_state = ''
%>
<div class="filediffs filediff-outdated" style="${display_state}">
templating: use .mako as extensions for template files.
r1282 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
<div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}">
<label for="filediff-collapse-${id(filename)}" class="filediff-heading">
<div class="filediff-collapse-indicator"></div>
<span class="pill">
## file was deleted
<strong>${filename}</strong>
</span>
<span class="pill-group" style="float: left">
## file op, doesn't need translation
<span class="pill" op="removed">removed in this version</span>
</span>
<a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">¶</a>
<span class="pill-group" style="float: right">
<span class="pill" op="deleted">-${comments_dict['stats']}</span>
</span>
</label>
<table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
<tr>
% if c.diffmode == 'unified':
<td></td>
%endif
<td></td>
<td class="cb-text cb-${op_class(BIN_FILENODE)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=5'}>
pull-requests: fixed case of unresolved comments attached to removed file in pr....
r2808 ${_('File was deleted in this version. There are still outdated/unresolved comments attached to it.')}
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%if c.diffmode == 'unified':
<tr class="cb-line">
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-content cb-context">
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments_dict['comments'], inline_comments)}
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%elif c.diffmode == 'sideside':
<tr class="cb-line">
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-content cb-context"></td>
<td class="cb-data cb-context"></td>
<td class="cb-lineno cb-context"></td>
<td class="cb-content cb-context">
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments_dict['comments'], inline_comments)}
templating: use .mako as extensions for template files.
r1282 </td>
</tr>
%endif
</table>
</div>
</div>
% endfor
</div>
</div>
</%def>
<%def name="diff_ops(filediff)">
<%
from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
diffs: support mercurial copy in diffs details.
r1582 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
templating: use .mako as extensions for template files.
r1282 %>
<span class="pill">
%if filediff.source_file_path and filediff.target_file_path:
html: fixed found syntax problems
r1283 %if filediff.source_file_path != filediff.target_file_path:
diffs: support mercurial copy in diffs details.
r1582 ## file was renamed, or copied
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
diffs: support mercurial copy in diffs details.
r1582 <strong>${filediff.target_file_path}</strong> ⬅ <del>${filediff.source_file_path}</del>
diffs: show copy-to-clipboard next to diff files
r2120 <% final_path = filediff.target_file_path %>
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
diffs: support mercurial copy in diffs details.
r1582 <strong>${filediff.target_file_path}</strong> ⬅ ${filediff.source_file_path}
diffs: show copy-to-clipboard next to diff files
r2120 <% final_path = filediff.target_file_path %>
diffs: support mercurial copy in diffs details.
r1582 %endif
templating: use .mako as extensions for template files.
r1282 %else:
## file was modified
<strong>${filediff.source_file_path}</strong>
diffs: show copy-to-clipboard next to diff files
r2120 <% final_path = filediff.source_file_path %>
templating: use .mako as extensions for template files.
r1282 %endif
%else:
%if filediff.source_file_path:
## file was deleted
<strong>${filediff.source_file_path}</strong>
diffs: show copy-to-clipboard next to diff files
r2120 <% final_path = filediff.source_file_path %>
templating: use .mako as extensions for template files.
r1282 %else:
## file was added
<strong>${filediff.target_file_path}</strong>
diffs: show copy-to-clipboard next to diff files
r2120 <% final_path = filediff.target_file_path %>
templating: use .mako as extensions for template files.
r1282 %endif
%endif
diffs: show copy-to-clipboard next to diff files
r2120 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
templating: use .mako as extensions for template files.
r1282 </span>
<span class="pill-group" style="float: left">
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.limited_diff:
templating: use .mako as extensions for template files.
r1282 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
%endif
diffs: support mercurial copy in diffs details.
r1582
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="renamed">renamed</span>
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if COPIED_FILENODE in filediff.patch['stats']['ops']:
diffs: support mercurial copy in diffs details.
r1582 <span class="pill" op="copied">copied</span>
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if NEW_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="created">created</span>
%if filediff['target_mode'].startswith('120'):
<span class="pill" op="symlink">symlink</span>
%else:
<span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
%endif
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if DEL_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="removed">removed</span>
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="mode">
${nice_mode(filediff['source_mode'])} âž¡ ${nice_mode(filediff['target_mode'])}
</span>
%endif
</span>
<a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">¶</a>
<span class="pill-group" style="float: right">
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if BIN_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="binary">binary</span>
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if MOD_FILENODE in filediff.patch['stats']['ops']:
templating: use .mako as extensions for template files.
r1282 <span class="pill" op="modified">modified</span>
%endif
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.patch['stats']['added']:
<span class="pill" op="added">+${filediff.patch['stats']['added']}</span>
templating: use .mako as extensions for template files.
r1282 %endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.patch['stats']['deleted']:
<span class="pill" op="deleted">-${filediff.patch['stats']['deleted']}</span>
templating: use .mako as extensions for template files.
r1282 %endif
</span>
</%def>
<%def name="nice_mode(filemode)">
${filemode.startswith('100') and filemode[3:] or filemode}
</%def>
<%def name="diff_menu(filediff, use_comments=False)">
<div class="filediff-menu">
%if filediff.diffset.source_ref:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.operation in ['D', 'M']:
templating: use .mako as extensions for template files.
r1282 <a
class="tooltip"
files: ported repository files controllers to pyramid views.
r1927 href="${h.route_path('repo_files',repo_name=filediff.diffset.repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
templating: use .mako as extensions for template files.
r1282 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
>
${_('Show file before')}
</a> |
%else:
<span
class="tooltip"
title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
>
${_('Show file before')}
</span> |
%endif
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 %if filediff.operation in ['A', 'M']:
templating: use .mako as extensions for template files.
r1282 <a
class="tooltip"
files: ported repository files controllers to pyramid views.
r1927 href="${h.route_path('repo_files',repo_name=filediff.diffset.source_repo_name,commit_id=filediff.diffset.target_ref,f_path=filediff.target_file_path)}"
templating: use .mako as extensions for template files.
r1282 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
>
${_('Show file after')}
</a> |
%else:
<span
class="tooltip"
title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
>
${_('Show file after')}
</span> |
%endif
<a
class="tooltip"
title="${h.tooltip(_('Raw diff'))}"
files: ported repository files controllers to pyramid views.
r1927 href="${h.route_path('repo_files_diff',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path, _query=dict(diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='raw'))}"
templating: use .mako as extensions for template files.
r1282 >
${_('Raw diff')}
</a> |
<a
class="tooltip"
title="${h.tooltip(_('Download diff'))}"
files: ported repository files controllers to pyramid views.
r1927 href="${h.route_path('repo_files_diff',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path, _query=dict(diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='download'))}"
templating: use .mako as extensions for template files.
r1282 >
${_('Download diff')}
</a>
% if use_comments:
|
% endif
## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks)
%if hasattr(c, 'ignorews_url'):
repo-commits: ported changeset code into pyramid views....
r1951 ${c.ignorews_url(request, h.FID('', filediff.patch['filename']))}
templating: use .mako as extensions for template files.
r1282 %endif
%if hasattr(c, 'context_url'):
repo-commits: ported changeset code into pyramid views....
r1951 ${c.context_url(request, h.FID('', filediff.patch['filename']))}
templating: use .mako as extensions for template files.
r1282 %endif
%if use_comments:
<a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
<span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
</a>
%endif
%endif
</div>
</%def>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <%def name="inline_comments_container(comments, inline_comments)">
templating: use .mako as extensions for template files.
r1282 <div class="inline-comments">
%for comment in comments:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${commentblock.comment_block(comment, inline=True)}
templating: use .mako as extensions for template files.
r1282 %endfor
% if comments and comments[-1].outdated:
<span class="btn btn-secondary cb-comment-add-button comment-outdated}"
style="display: none;}">
${_('Add another comment')}
</span>
% else:
<span onclick="return Rhodecode.comments.createComment(this)"
class="btn btn-secondary cb-comment-add-button">
${_('Add another comment')}
</span>
% endif
</div>
</%def>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <%!
def get_comments_for(comments, filename, line_version, line_number):
if hasattr(filename, 'unicode_path'):
filename = filename.unicode_path
templating: use .mako as extensions for template files.
r1282
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 if not isinstance(filename, basestring):
return None
line_key = '{}{}'.format(line_version, line_number)
if comments and filename in comments:
file_comments = comments[filename]
if line_key in file_comments:
return file_comments[line_key]
%>
<%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)">
templating: use .mako as extensions for template files.
r1282 %for i, line in enumerate(hunk.sideside):
<%
old_line_anchor, new_line_anchor = None, None
if line.original.lineno:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o')
templating: use .mako as extensions for template files.
r1282 if line.modified.lineno:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n')
templating: use .mako as extensions for template files.
r1282 %>
<tr class="cb-line">
<td class="cb-data ${action_class(line.original.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${line.original.lineno}"
templating: use .mako as extensions for template files.
r1282 >
<div>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <% loc = None %>
%if line.original.get_comment_args:
<% loc = get_comments_for(inline_comments, *line.original.get_comment_args) %>
%endif
%if loc:
<% has_outdated = any([x.outdated for x in loc]) %>
diffs: inidicate visually outdated comments in the icon.
r2611 % if has_outdated:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <i title="${_('comments including outdated')}:${len(loc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
diffs: inidicate visually outdated comments in the icon.
r2611 % else:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <i title="${_('comments')}: ${len(loc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
diffs: inidicate visually outdated comments in the icon.
r2611 % endif
templating: use .mako as extensions for template files.
r1282 %endif
</div>
</td>
<td class="cb-lineno ${action_class(line.original.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${line.original.lineno}"
templating: use .mako as extensions for template files.
r1282 %if old_line_anchor:
id="${old_line_anchor}"
%endif
>
%if line.original.lineno:
<a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
%endif
</td>
<td class="cb-content ${action_class(line.original.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="o${line.original.lineno}"
templating: use .mako as extensions for template files.
r1282 >
%if use_comments and line.original.lineno:
${render_add_comment_button()}
%endif
<span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685
%if use_comments and line.original.lineno and loc:
${inline_comments_container(loc, inline_comments)}
templating: use .mako as extensions for template files.
r1282 %endif
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685
templating: use .mako as extensions for template files.
r1282 </td>
<td class="cb-data ${action_class(line.modified.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${line.modified.lineno}"
templating: use .mako as extensions for template files.
r1282 >
<div>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685
%if line.modified.get_comment_args:
<% lmc = get_comments_for(inline_comments, *line.modified.get_comment_args) %>
%else:
<% lmc = None%>
%endif
%if lmc:
<% has_outdated = any([x.outdated for x in lmc]) %>
diffs: inidicate visually outdated comments in the icon.
r2611 % if has_outdated:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <i title="${_('comments including outdated')}:${len(lmc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
diffs: inidicate visually outdated comments in the icon.
r2611 % else:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <i title="${_('comments')}: ${len(lmc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
diffs: inidicate visually outdated comments in the icon.
r2611 % endif
templating: use .mako as extensions for template files.
r1282 %endif
</div>
</td>
<td class="cb-lineno ${action_class(line.modified.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${line.modified.lineno}"
templating: use .mako as extensions for template files.
r1282 %if new_line_anchor:
id="${new_line_anchor}"
%endif
>
%if line.modified.lineno:
<a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
%endif
</td>
<td class="cb-content ${action_class(line.modified.action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="n${line.modified.lineno}"
templating: use .mako as extensions for template files.
r1282 >
%if use_comments and line.modified.lineno:
${render_add_comment_button()}
%endif
<span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 %if use_comments and line.modified.lineno and lmc:
${inline_comments_container(lmc, inline_comments)}
templating: use .mako as extensions for template files.
r1282 %endif
</td>
</tr>
%endfor
</%def>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 <%def name="render_hunk_lines_unified(hunk, use_comments=False, inline_comments=None)">
%for old_line_no, new_line_no, action, content, comments_args in hunk.unified:
templating: use .mako as extensions for template files.
r1282 <%
old_line_anchor, new_line_anchor = None, None
if old_line_no:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o')
templating: use .mako as extensions for template files.
r1282 if new_line_no:
diffs: simplified the datastructure of fillediff. Hopefully this...
r1844 new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n')
templating: use .mako as extensions for template files.
r1282 %>
<tr class="cb-line">
<td class="cb-data ${action_class(action)}">
<div>
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685
%if comments_args:
<% comments = get_comments_for(inline_comments, *comments_args) %>
%else:
<% comments = None%>
%endif
diffs: inidicate visually outdated comments in the icon.
r2611 % if comments:
<% has_outdated = any([x.outdated for x in comments]) %>
% if has_outdated:
<i title="${_('comments including outdated')}:${len(comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
% else:
<i title="${_('comments')}: ${len(comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
% endif
% endif
templating: use .mako as extensions for template files.
r1282 </div>
</td>
<td class="cb-lineno ${action_class(action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${old_line_no}"
templating: use .mako as extensions for template files.
r1282 %if old_line_anchor:
id="${old_line_anchor}"
%endif
>
%if old_line_anchor:
<a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
%endif
</td>
<td class="cb-lineno ${action_class(action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${new_line_no}"
templating: use .mako as extensions for template files.
r1282 %if new_line_anchor:
id="${new_line_anchor}"
%endif
>
%if new_line_anchor:
<a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
%endif
</td>
<td class="cb-content ${action_class(action)}"
diffs/files: fix and improve line selections and anchor links.
r2642 data-line-no="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}"
templating: use .mako as extensions for template files.
r1282 >
%if use_comments:
${render_add_comment_button()}
%endif
<span class="cb-code">${action} ${content or '' | n}</span>
%if use_comments and comments:
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 ${inline_comments_container(comments, inline_comments)}
templating: use .mako as extensions for template files.
r1282 %endif
</td>
</tr>
%endfor
</%def>
<%def name="render_add_comment_button()">
<button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
<span><i class="icon-comment"></i></span>
</button>
</%def>
<%def name="render_diffset_menu()">
<div class="diffset-menu clearinner">
<div class="pull-right">
<div class="btn-group">
<a
class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
dan
tooltip: use consistent h.tooltip usage to set tooltips.
r1843 title="${h.tooltip(_('View side by side'))}"
routing: deprecate url_replace function in exchange of current_route_path which we now use in pyramid
r2307 href="${h.current_route_path(request, diffmode='sideside')}">
templating: use .mako as extensions for template files.
r1282 <span>${_('Side by Side')}</span>
</a>
<a
class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
routing: deprecate url_replace function in exchange of current_route_path which we now use in pyramid
r2307 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
templating: use .mako as extensions for template files.
r1282 <span>${_('Unified')}</span>
</a>
</div>
</div>
<div class="pull-left">
<div class="btn-group">
<a
class="btn"
href="#"
onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All Files')}</a>
<a
class="btn"
href="#"
onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All Files')}</a>
<a
class="btn"
href="#"
onclick="return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a>
</div>
</div>
</div>
</%def>