##// END OF EJS Templates
pull-requests: fixed case of unresolved comments attached to removed file in pr....
marcink -
r2808:241bd1e7 default
parent child Browse files
Show More
@@ -1,730 +1,735 b''
1 <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/>
1 <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/>
2
2
3 <%def name="diff_line_anchor(filename, line, type)"><%
3 <%def name="diff_line_anchor(filename, line, type)"><%
4 return '%s_%s_%i' % (h.safeid(filename), type, line)
4 return '%s_%s_%i' % (h.safeid(filename), type, line)
5 %></%def>
5 %></%def>
6
6
7 <%def name="action_class(action)">
7 <%def name="action_class(action)">
8 <%
8 <%
9 return {
9 return {
10 '-': 'cb-deletion',
10 '-': 'cb-deletion',
11 '+': 'cb-addition',
11 '+': 'cb-addition',
12 ' ': 'cb-context',
12 ' ': 'cb-context',
13 }.get(action, 'cb-empty')
13 }.get(action, 'cb-empty')
14 %>
14 %>
15 </%def>
15 </%def>
16
16
17 <%def name="op_class(op_id)">
17 <%def name="op_class(op_id)">
18 <%
18 <%
19 return {
19 return {
20 DEL_FILENODE: 'deletion', # file deleted
20 DEL_FILENODE: 'deletion', # file deleted
21 BIN_FILENODE: 'warning' # binary diff hidden
21 BIN_FILENODE: 'warning' # binary diff hidden
22 }.get(op_id, 'addition')
22 }.get(op_id, 'addition')
23 %>
23 %>
24 </%def>
24 </%def>
25
25
26
26
27
27
28 <%def name="render_diffset(diffset, commit=None,
28 <%def name="render_diffset(diffset, commit=None,
29
29
30 # collapse all file diff entries when there are more than this amount of files in the diff
30 # collapse all file diff entries when there are more than this amount of files in the diff
31 collapse_when_files_over=20,
31 collapse_when_files_over=20,
32
32
33 # collapse lines in the diff when more than this amount of lines changed in the file diff
33 # collapse lines in the diff when more than this amount of lines changed in the file diff
34 lines_changed_limit=500,
34 lines_changed_limit=500,
35
35
36 # add a ruler at to the output
36 # add a ruler at to the output
37 ruler_at_chars=0,
37 ruler_at_chars=0,
38
38
39 # show inline comments
39 # show inline comments
40 use_comments=False,
40 use_comments=False,
41
41
42 # disable new comments
42 # disable new comments
43 disable_new_comments=False,
43 disable_new_comments=False,
44
44
45 # special file-comments that were deleted in previous versions
45 # special file-comments that were deleted in previous versions
46 # it's used for showing outdated comments for deleted files in a PR
46 # it's used for showing outdated comments for deleted files in a PR
47 deleted_files_comments=None,
47 deleted_files_comments=None,
48
48
49 # for cache purpose
49 # for cache purpose
50 inline_comments=None
50 inline_comments=None
51
51
52 )">
52 )">
53 %if use_comments:
53 %if use_comments:
54 <div id="cb-comments-inline-container-template" class="js-template">
54 <div id="cb-comments-inline-container-template" class="js-template">
55 ${inline_comments_container([], inline_comments)}
55 ${inline_comments_container([], inline_comments)}
56 </div>
56 </div>
57 <div class="js-template" id="cb-comment-inline-form-template">
57 <div class="js-template" id="cb-comment-inline-form-template">
58 <div class="comment-inline-form ac">
58 <div class="comment-inline-form ac">
59
59
60 %if c.rhodecode_user.username != h.DEFAULT_USER:
60 %if c.rhodecode_user.username != h.DEFAULT_USER:
61 ## render template for inline comments
61 ## render template for inline comments
62 ${commentblock.comment_form(form_type='inline')}
62 ${commentblock.comment_form(form_type='inline')}
63 %else:
63 %else:
64 ${h.form('', class_='inline-form comment-form-login', method='get')}
64 ${h.form('', class_='inline-form comment-form-login', method='get')}
65 <div class="pull-left">
65 <div class="pull-left">
66 <div class="comment-help pull-right">
66 <div class="comment-help pull-right">
67 ${_('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>
67 ${_('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>
68 </div>
68 </div>
69 </div>
69 </div>
70 <div class="comment-button pull-right">
70 <div class="comment-button pull-right">
71 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
71 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
72 ${_('Cancel')}
72 ${_('Cancel')}
73 </button>
73 </button>
74 </div>
74 </div>
75 <div class="clearfix"></div>
75 <div class="clearfix"></div>
76 ${h.end_form()}
76 ${h.end_form()}
77 %endif
77 %endif
78 </div>
78 </div>
79 </div>
79 </div>
80
80
81 %endif
81 %endif
82 <%
82 <%
83 collapse_all = len(diffset.files) > collapse_when_files_over
83 collapse_all = len(diffset.files) > collapse_when_files_over
84 %>
84 %>
85
85
86 %if c.diffmode == 'sideside':
86 %if c.diffmode == 'sideside':
87 <style>
87 <style>
88 .wrapper {
88 .wrapper {
89 max-width: 1600px !important;
89 max-width: 1600px !important;
90 }
90 }
91 </style>
91 </style>
92 %endif
92 %endif
93
93
94 %if ruler_at_chars:
94 %if ruler_at_chars:
95 <style>
95 <style>
96 .diff table.cb .cb-content:after {
96 .diff table.cb .cb-content:after {
97 content: "";
97 content: "";
98 border-left: 1px solid blue;
98 border-left: 1px solid blue;
99 position: absolute;
99 position: absolute;
100 top: 0;
100 top: 0;
101 height: 18px;
101 height: 18px;
102 opacity: .2;
102 opacity: .2;
103 z-index: 10;
103 z-index: 10;
104 //## +5 to account for diff action (+/-)
104 //## +5 to account for diff action (+/-)
105 left: ${ruler_at_chars + 5}ch;
105 left: ${ruler_at_chars + 5}ch;
106 </style>
106 </style>
107 %endif
107 %endif
108
108
109 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
109 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
110 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
110 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
111 %if commit:
111 %if commit:
112 <div class="pull-right">
112 <div class="pull-right">
113 <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='')}">
113 <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='')}">
114 ${_('Browse Files')}
114 ${_('Browse Files')}
115 </a>
115 </a>
116 </div>
116 </div>
117 %endif
117 %endif
118 <h2 class="clearinner">
118 <h2 class="clearinner">
119 %if commit:
119 %if commit:
120 <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> -
120 <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> -
121 ${h.age_component(commit.date)} -
121 ${h.age_component(commit.date)} -
122 %endif
122 %endif
123
123
124 %if diffset.limited_diff:
124 %if diffset.limited_diff:
125 ${_('The requested commit is too big and content was truncated.')}
125 ${_('The requested commit is too big and content was truncated.')}
126
126
127 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
127 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
128 <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>
128 <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>
129 %else:
129 %else:
130 ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
130 ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
131 '%(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}}
131 '%(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}}
132 %endif
132 %endif
133
133
134 </h2>
134 </h2>
135 </div>
135 </div>
136
136
137 %if diffset.has_hidden_changes:
137 %if diffset.has_hidden_changes:
138 <p class="empty_data">${_('Some changes may be hidden')}</p>
138 <p class="empty_data">${_('Some changes may be hidden')}</p>
139 %elif not diffset.files:
139 %elif not diffset.files:
140 <p class="empty_data">${_('No files')}</p>
140 <p class="empty_data">${_('No files')}</p>
141 %endif
141 %endif
142
142
143 <div class="filediffs">
143 <div class="filediffs">
144 ## initial value could be marked as False later on
144 ## initial value could be marked as False later on
145 <% over_lines_changed_limit = False %>
145 <% over_lines_changed_limit = False %>
146 %for i, filediff in enumerate(diffset.files):
146 %for i, filediff in enumerate(diffset.files):
147
147
148 <%
148 <%
149 lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
149 lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
150 over_lines_changed_limit = lines_changed > lines_changed_limit
150 over_lines_changed_limit = lines_changed > lines_changed_limit
151 %>
151 %>
152 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
152 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
153 <div
153 <div
154 class="filediff"
154 class="filediff"
155 data-f-path="${filediff.patch['filename']}"
155 data-f-path="${filediff.patch['filename']}"
156 id="a_${h.FID('', filediff.patch['filename'])}">
156 id="a_${h.FID('', filediff.patch['filename'])}">
157 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
157 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
158 <div class="filediff-collapse-indicator"></div>
158 <div class="filediff-collapse-indicator"></div>
159 ${diff_ops(filediff)}
159 ${diff_ops(filediff)}
160 </label>
160 </label>
161 ${diff_menu(filediff, use_comments=use_comments)}
161 ${diff_menu(filediff, use_comments=use_comments)}
162 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
162 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
163 %if not filediff.hunks:
163 %if not filediff.hunks:
164 %for op_id, op_text in filediff.patch['stats']['ops'].items():
164 %for op_id, op_text in filediff.patch['stats']['ops'].items():
165 <tr>
165 <tr>
166 <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
166 <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
167 %if op_id == DEL_FILENODE:
167 %if op_id == DEL_FILENODE:
168 ${_('File was deleted')}
168 ${_('File was deleted')}
169 %elif op_id == BIN_FILENODE:
169 %elif op_id == BIN_FILENODE:
170 ${_('Binary file hidden')}
170 ${_('Binary file hidden')}
171 %else:
171 %else:
172 ${op_text}
172 ${op_text}
173 %endif
173 %endif
174 </td>
174 </td>
175 </tr>
175 </tr>
176 %endfor
176 %endfor
177 %endif
177 %endif
178 %if filediff.limited_diff:
178 %if filediff.limited_diff:
179 <tr class="cb-warning cb-collapser">
179 <tr class="cb-warning cb-collapser">
180 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
180 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
181 ${_('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>
181 ${_('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>
182 </td>
182 </td>
183 </tr>
183 </tr>
184 %else:
184 %else:
185 %if over_lines_changed_limit:
185 %if over_lines_changed_limit:
186 <tr class="cb-warning cb-collapser">
186 <tr class="cb-warning cb-collapser">
187 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
187 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
188 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
188 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
189 <a href="#" class="cb-expand"
189 <a href="#" class="cb-expand"
190 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
190 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
191 </a>
191 </a>
192 <a href="#" class="cb-collapse"
192 <a href="#" class="cb-collapse"
193 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
193 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
194 </a>
194 </a>
195 </td>
195 </td>
196 </tr>
196 </tr>
197 %endif
197 %endif
198 %endif
198 %endif
199
199
200 %for hunk in filediff.hunks:
200 %for hunk in filediff.hunks:
201 <tr class="cb-hunk">
201 <tr class="cb-hunk">
202 <td ${c.diffmode == 'unified' and 'colspan=3' or ''}>
202 <td ${c.diffmode == 'unified' and 'colspan=3' or ''}>
203 ## TODO: dan: add ajax loading of more context here
203 ## TODO: dan: add ajax loading of more context here
204 ## <a href="#">
204 ## <a href="#">
205 <i class="icon-more"></i>
205 <i class="icon-more"></i>
206 ## </a>
206 ## </a>
207 </td>
207 </td>
208 <td ${c.diffmode == 'sideside' and 'colspan=5' or ''}>
208 <td ${c.diffmode == 'sideside' and 'colspan=5' or ''}>
209 @@
209 @@
210 -${hunk.source_start},${hunk.source_length}
210 -${hunk.source_start},${hunk.source_length}
211 +${hunk.target_start},${hunk.target_length}
211 +${hunk.target_start},${hunk.target_length}
212 ${hunk.section_header}
212 ${hunk.section_header}
213 </td>
213 </td>
214 </tr>
214 </tr>
215 %if c.diffmode == 'unified':
215 %if c.diffmode == 'unified':
216 ${render_hunk_lines_unified(hunk, use_comments=use_comments, inline_comments=inline_comments)}
216 ${render_hunk_lines_unified(hunk, use_comments=use_comments, inline_comments=inline_comments)}
217 %elif c.diffmode == 'sideside':
217 %elif c.diffmode == 'sideside':
218 ${render_hunk_lines_sideside(hunk, use_comments=use_comments, inline_comments=inline_comments)}
218 ${render_hunk_lines_sideside(hunk, use_comments=use_comments, inline_comments=inline_comments)}
219 %else:
219 %else:
220 <tr class="cb-line">
220 <tr class="cb-line">
221 <td>unknown diff mode</td>
221 <td>unknown diff mode</td>
222 </tr>
222 </tr>
223 %endif
223 %endif
224 %endfor
224 %endfor
225
225
226 ## outdated comments that do not fit into currently displayed lines
226 ## outdated comments that do not fit into currently displayed lines
227 % for lineno, comments in filediff.left_comments.items():
227 % for lineno, comments in filediff.left_comments.items():
228
228
229 %if c.diffmode == 'unified':
229 %if c.diffmode == 'unified':
230 <tr class="cb-line">
230 <tr class="cb-line">
231 <td class="cb-data cb-context"></td>
231 <td class="cb-data cb-context"></td>
232 <td class="cb-lineno cb-context"></td>
232 <td class="cb-lineno cb-context"></td>
233 <td class="cb-lineno cb-context"></td>
233 <td class="cb-lineno cb-context"></td>
234 <td class="cb-content cb-context">
234 <td class="cb-content cb-context">
235 ${inline_comments_container(comments, inline_comments)}
235 ${inline_comments_container(comments, inline_comments)}
236 </td>
236 </td>
237 </tr>
237 </tr>
238 %elif c.diffmode == 'sideside':
238 %elif c.diffmode == 'sideside':
239 <tr class="cb-line">
239 <tr class="cb-line">
240 <td class="cb-data cb-context"></td>
240 <td class="cb-data cb-context"></td>
241 <td class="cb-lineno cb-context"></td>
241 <td class="cb-lineno cb-context"></td>
242 <td class="cb-content cb-context">
242 <td class="cb-content cb-context">
243 % if lineno.startswith('o'):
243 % if lineno.startswith('o'):
244 ${inline_comments_container(comments, inline_comments)}
244 ${inline_comments_container(comments, inline_comments)}
245 % endif
245 % endif
246 </td>
246 </td>
247
247
248 <td class="cb-data cb-context"></td>
248 <td class="cb-data cb-context"></td>
249 <td class="cb-lineno cb-context"></td>
249 <td class="cb-lineno cb-context"></td>
250 <td class="cb-content cb-context">
250 <td class="cb-content cb-context">
251 % if lineno.startswith('n'):
251 % if lineno.startswith('n'):
252 ${inline_comments_container(comments, inline_comments)}
252 ${inline_comments_container(comments, inline_comments)}
253 % endif
253 % endif
254 </td>
254 </td>
255 </tr>
255 </tr>
256 %endif
256 %endif
257
257
258 % endfor
258 % endfor
259
259
260 </table>
260 </table>
261 </div>
261 </div>
262 %endfor
262 %endfor
263
263
264 ## outdated comments that are made for a file that has been deleted
264 ## outdated comments that are made for a file that has been deleted
265 % for filename, comments_dict in (deleted_files_comments or {}).items():
265 % for filename, comments_dict in (deleted_files_comments or {}).items():
266
266 <%
267 <div class="filediffs filediff-outdated" style="display: none">
267 display_state = 'display: none'
268 open_comments_in_file = [x for x in comments_dict['comments'] if x.outdated is False]
269 if open_comments_in_file:
270 display_state = ''
271 %>
272 <div class="filediffs filediff-outdated" style="${display_state}">
268 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
273 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
269 <div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}">
274 <div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}">
270 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
275 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
271 <div class="filediff-collapse-indicator"></div>
276 <div class="filediff-collapse-indicator"></div>
272 <span class="pill">
277 <span class="pill">
273 ## file was deleted
278 ## file was deleted
274 <strong>${filename}</strong>
279 <strong>${filename}</strong>
275 </span>
280 </span>
276 <span class="pill-group" style="float: left">
281 <span class="pill-group" style="float: left">
277 ## file op, doesn't need translation
282 ## file op, doesn't need translation
278 <span class="pill" op="removed">removed in this version</span>
283 <span class="pill" op="removed">removed in this version</span>
279 </span>
284 </span>
280 <a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">ΒΆ</a>
285 <a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">ΒΆ</a>
281 <span class="pill-group" style="float: right">
286 <span class="pill-group" style="float: right">
282 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
287 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
283 </span>
288 </span>
284 </label>
289 </label>
285
290
286 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
291 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
287 <tr>
292 <tr>
288 % if c.diffmode == 'unified':
293 % if c.diffmode == 'unified':
289 <td></td>
294 <td></td>
290 %endif
295 %endif
291
296
292 <td></td>
297 <td></td>
293 <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=5'}>
298 <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=5'}>
294 ${_('File was deleted in this version, and outdated comments were made on it')}
299 ${_('File was deleted in this version. There are still outdated/unresolved comments attached to it.')}
295 </td>
300 </td>
296 </tr>
301 </tr>
297 %if c.diffmode == 'unified':
302 %if c.diffmode == 'unified':
298 <tr class="cb-line">
303 <tr class="cb-line">
299 <td class="cb-data cb-context"></td>
304 <td class="cb-data cb-context"></td>
300 <td class="cb-lineno cb-context"></td>
305 <td class="cb-lineno cb-context"></td>
301 <td class="cb-lineno cb-context"></td>
306 <td class="cb-lineno cb-context"></td>
302 <td class="cb-content cb-context">
307 <td class="cb-content cb-context">
303 ${inline_comments_container(comments_dict['comments'], inline_comments)}
308 ${inline_comments_container(comments_dict['comments'], inline_comments)}
304 </td>
309 </td>
305 </tr>
310 </tr>
306 %elif c.diffmode == 'sideside':
311 %elif c.diffmode == 'sideside':
307 <tr class="cb-line">
312 <tr class="cb-line">
308 <td class="cb-data cb-context"></td>
313 <td class="cb-data cb-context"></td>
309 <td class="cb-lineno cb-context"></td>
314 <td class="cb-lineno cb-context"></td>
310 <td class="cb-content cb-context"></td>
315 <td class="cb-content cb-context"></td>
311
316
312 <td class="cb-data cb-context"></td>
317 <td class="cb-data cb-context"></td>
313 <td class="cb-lineno cb-context"></td>
318 <td class="cb-lineno cb-context"></td>
314 <td class="cb-content cb-context">
319 <td class="cb-content cb-context">
315 ${inline_comments_container(comments_dict['comments'], inline_comments)}
320 ${inline_comments_container(comments_dict['comments'], inline_comments)}
316 </td>
321 </td>
317 </tr>
322 </tr>
318 %endif
323 %endif
319 </table>
324 </table>
320 </div>
325 </div>
321 </div>
326 </div>
322 % endfor
327 % endfor
323
328
324 </div>
329 </div>
325 </div>
330 </div>
326 </%def>
331 </%def>
327
332
328 <%def name="diff_ops(filediff)">
333 <%def name="diff_ops(filediff)">
329 <%
334 <%
330 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
335 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
331 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
336 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
332 %>
337 %>
333 <span class="pill">
338 <span class="pill">
334 %if filediff.source_file_path and filediff.target_file_path:
339 %if filediff.source_file_path and filediff.target_file_path:
335 %if filediff.source_file_path != filediff.target_file_path:
340 %if filediff.source_file_path != filediff.target_file_path:
336 ## file was renamed, or copied
341 ## file was renamed, or copied
337 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
342 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
338 <strong>${filediff.target_file_path}</strong> β¬… <del>${filediff.source_file_path}</del>
343 <strong>${filediff.target_file_path}</strong> β¬… <del>${filediff.source_file_path}</del>
339 <% final_path = filediff.target_file_path %>
344 <% final_path = filediff.target_file_path %>
340 %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
345 %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
341 <strong>${filediff.target_file_path}</strong> β¬… ${filediff.source_file_path}
346 <strong>${filediff.target_file_path}</strong> β¬… ${filediff.source_file_path}
342 <% final_path = filediff.target_file_path %>
347 <% final_path = filediff.target_file_path %>
343 %endif
348 %endif
344 %else:
349 %else:
345 ## file was modified
350 ## file was modified
346 <strong>${filediff.source_file_path}</strong>
351 <strong>${filediff.source_file_path}</strong>
347 <% final_path = filediff.source_file_path %>
352 <% final_path = filediff.source_file_path %>
348 %endif
353 %endif
349 %else:
354 %else:
350 %if filediff.source_file_path:
355 %if filediff.source_file_path:
351 ## file was deleted
356 ## file was deleted
352 <strong>${filediff.source_file_path}</strong>
357 <strong>${filediff.source_file_path}</strong>
353 <% final_path = filediff.source_file_path %>
358 <% final_path = filediff.source_file_path %>
354 %else:
359 %else:
355 ## file was added
360 ## file was added
356 <strong>${filediff.target_file_path}</strong>
361 <strong>${filediff.target_file_path}</strong>
357 <% final_path = filediff.target_file_path %>
362 <% final_path = filediff.target_file_path %>
358 %endif
363 %endif
359 %endif
364 %endif
360 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
365 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
361 </span>
366 </span>
362 <span class="pill-group" style="float: left">
367 <span class="pill-group" style="float: left">
363 %if filediff.limited_diff:
368 %if filediff.limited_diff:
364 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
369 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
365 %endif
370 %endif
366
371
367 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
372 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
368 <span class="pill" op="renamed">renamed</span>
373 <span class="pill" op="renamed">renamed</span>
369 %endif
374 %endif
370
375
371 %if COPIED_FILENODE in filediff.patch['stats']['ops']:
376 %if COPIED_FILENODE in filediff.patch['stats']['ops']:
372 <span class="pill" op="copied">copied</span>
377 <span class="pill" op="copied">copied</span>
373 %endif
378 %endif
374
379
375 %if NEW_FILENODE in filediff.patch['stats']['ops']:
380 %if NEW_FILENODE in filediff.patch['stats']['ops']:
376 <span class="pill" op="created">created</span>
381 <span class="pill" op="created">created</span>
377 %if filediff['target_mode'].startswith('120'):
382 %if filediff['target_mode'].startswith('120'):
378 <span class="pill" op="symlink">symlink</span>
383 <span class="pill" op="symlink">symlink</span>
379 %else:
384 %else:
380 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
385 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
381 %endif
386 %endif
382 %endif
387 %endif
383
388
384 %if DEL_FILENODE in filediff.patch['stats']['ops']:
389 %if DEL_FILENODE in filediff.patch['stats']['ops']:
385 <span class="pill" op="removed">removed</span>
390 <span class="pill" op="removed">removed</span>
386 %endif
391 %endif
387
392
388 %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
393 %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
389 <span class="pill" op="mode">
394 <span class="pill" op="mode">
390 ${nice_mode(filediff['source_mode'])} ➑ ${nice_mode(filediff['target_mode'])}
395 ${nice_mode(filediff['source_mode'])} ➑ ${nice_mode(filediff['target_mode'])}
391 </span>
396 </span>
392 %endif
397 %endif
393 </span>
398 </span>
394
399
395 <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a>
400 <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a>
396
401
397 <span class="pill-group" style="float: right">
402 <span class="pill-group" style="float: right">
398 %if BIN_FILENODE in filediff.patch['stats']['ops']:
403 %if BIN_FILENODE in filediff.patch['stats']['ops']:
399 <span class="pill" op="binary">binary</span>
404 <span class="pill" op="binary">binary</span>
400 %if MOD_FILENODE in filediff.patch['stats']['ops']:
405 %if MOD_FILENODE in filediff.patch['stats']['ops']:
401 <span class="pill" op="modified">modified</span>
406 <span class="pill" op="modified">modified</span>
402 %endif
407 %endif
403 %endif
408 %endif
404 %if filediff.patch['stats']['added']:
409 %if filediff.patch['stats']['added']:
405 <span class="pill" op="added">+${filediff.patch['stats']['added']}</span>
410 <span class="pill" op="added">+${filediff.patch['stats']['added']}</span>
406 %endif
411 %endif
407 %if filediff.patch['stats']['deleted']:
412 %if filediff.patch['stats']['deleted']:
408 <span class="pill" op="deleted">-${filediff.patch['stats']['deleted']}</span>
413 <span class="pill" op="deleted">-${filediff.patch['stats']['deleted']}</span>
409 %endif
414 %endif
410 </span>
415 </span>
411
416
412 </%def>
417 </%def>
413
418
414 <%def name="nice_mode(filemode)">
419 <%def name="nice_mode(filemode)">
415 ${filemode.startswith('100') and filemode[3:] or filemode}
420 ${filemode.startswith('100') and filemode[3:] or filemode}
416 </%def>
421 </%def>
417
422
418 <%def name="diff_menu(filediff, use_comments=False)">
423 <%def name="diff_menu(filediff, use_comments=False)">
419 <div class="filediff-menu">
424 <div class="filediff-menu">
420 %if filediff.diffset.source_ref:
425 %if filediff.diffset.source_ref:
421 %if filediff.operation in ['D', 'M']:
426 %if filediff.operation in ['D', 'M']:
422 <a
427 <a
423 class="tooltip"
428 class="tooltip"
424 href="${h.route_path('repo_files',repo_name=filediff.diffset.repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
429 href="${h.route_path('repo_files',repo_name=filediff.diffset.repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
425 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
430 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
426 >
431 >
427 ${_('Show file before')}
432 ${_('Show file before')}
428 </a> |
433 </a> |
429 %else:
434 %else:
430 <span
435 <span
431 class="tooltip"
436 class="tooltip"
432 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
437 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
433 >
438 >
434 ${_('Show file before')}
439 ${_('Show file before')}
435 </span> |
440 </span> |
436 %endif
441 %endif
437 %if filediff.operation in ['A', 'M']:
442 %if filediff.operation in ['A', 'M']:
438 <a
443 <a
439 class="tooltip"
444 class="tooltip"
440 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)}"
445 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)}"
441 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
446 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
442 >
447 >
443 ${_('Show file after')}
448 ${_('Show file after')}
444 </a> |
449 </a> |
445 %else:
450 %else:
446 <span
451 <span
447 class="tooltip"
452 class="tooltip"
448 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
453 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
449 >
454 >
450 ${_('Show file after')}
455 ${_('Show file after')}
451 </span> |
456 </span> |
452 %endif
457 %endif
453 <a
458 <a
454 class="tooltip"
459 class="tooltip"
455 title="${h.tooltip(_('Raw diff'))}"
460 title="${h.tooltip(_('Raw diff'))}"
456 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'))}"
461 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'))}"
457 >
462 >
458 ${_('Raw diff')}
463 ${_('Raw diff')}
459 </a> |
464 </a> |
460 <a
465 <a
461 class="tooltip"
466 class="tooltip"
462 title="${h.tooltip(_('Download diff'))}"
467 title="${h.tooltip(_('Download diff'))}"
463 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'))}"
468 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'))}"
464 >
469 >
465 ${_('Download diff')}
470 ${_('Download diff')}
466 </a>
471 </a>
467 % if use_comments:
472 % if use_comments:
468 |
473 |
469 % endif
474 % endif
470
475
471 ## 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)
476 ## 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)
472 %if hasattr(c, 'ignorews_url'):
477 %if hasattr(c, 'ignorews_url'):
473 ${c.ignorews_url(request, h.FID('', filediff.patch['filename']))}
478 ${c.ignorews_url(request, h.FID('', filediff.patch['filename']))}
474 %endif
479 %endif
475 %if hasattr(c, 'context_url'):
480 %if hasattr(c, 'context_url'):
476 ${c.context_url(request, h.FID('', filediff.patch['filename']))}
481 ${c.context_url(request, h.FID('', filediff.patch['filename']))}
477 %endif
482 %endif
478
483
479 %if use_comments:
484 %if use_comments:
480 <a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
485 <a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
481 <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
486 <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
482 </a>
487 </a>
483 %endif
488 %endif
484 %endif
489 %endif
485 </div>
490 </div>
486 </%def>
491 </%def>
487
492
488
493
489 <%def name="inline_comments_container(comments, inline_comments)">
494 <%def name="inline_comments_container(comments, inline_comments)">
490 <div class="inline-comments">
495 <div class="inline-comments">
491 %for comment in comments:
496 %for comment in comments:
492 ${commentblock.comment_block(comment, inline=True)}
497 ${commentblock.comment_block(comment, inline=True)}
493 %endfor
498 %endfor
494 % if comments and comments[-1].outdated:
499 % if comments and comments[-1].outdated:
495 <span class="btn btn-secondary cb-comment-add-button comment-outdated}"
500 <span class="btn btn-secondary cb-comment-add-button comment-outdated}"
496 style="display: none;}">
501 style="display: none;}">
497 ${_('Add another comment')}
502 ${_('Add another comment')}
498 </span>
503 </span>
499 % else:
504 % else:
500 <span onclick="return Rhodecode.comments.createComment(this)"
505 <span onclick="return Rhodecode.comments.createComment(this)"
501 class="btn btn-secondary cb-comment-add-button">
506 class="btn btn-secondary cb-comment-add-button">
502 ${_('Add another comment')}
507 ${_('Add another comment')}
503 </span>
508 </span>
504 % endif
509 % endif
505
510
506 </div>
511 </div>
507 </%def>
512 </%def>
508
513
509 <%!
514 <%!
510 def get_comments_for(comments, filename, line_version, line_number):
515 def get_comments_for(comments, filename, line_version, line_number):
511 if hasattr(filename, 'unicode_path'):
516 if hasattr(filename, 'unicode_path'):
512 filename = filename.unicode_path
517 filename = filename.unicode_path
513
518
514 if not isinstance(filename, basestring):
519 if not isinstance(filename, basestring):
515 return None
520 return None
516
521
517 line_key = '{}{}'.format(line_version, line_number)
522 line_key = '{}{}'.format(line_version, line_number)
518 if comments and filename in comments:
523 if comments and filename in comments:
519 file_comments = comments[filename]
524 file_comments = comments[filename]
520 if line_key in file_comments:
525 if line_key in file_comments:
521 return file_comments[line_key]
526 return file_comments[line_key]
522 %>
527 %>
523
528
524 <%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)">
529 <%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)">
525
530
526 %for i, line in enumerate(hunk.sideside):
531 %for i, line in enumerate(hunk.sideside):
527 <%
532 <%
528 old_line_anchor, new_line_anchor = None, None
533 old_line_anchor, new_line_anchor = None, None
529 if line.original.lineno:
534 if line.original.lineno:
530 old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o')
535 old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o')
531 if line.modified.lineno:
536 if line.modified.lineno:
532 new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n')
537 new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n')
533 %>
538 %>
534
539
535 <tr class="cb-line">
540 <tr class="cb-line">
536 <td class="cb-data ${action_class(line.original.action)}"
541 <td class="cb-data ${action_class(line.original.action)}"
537 data-line-no="${line.original.lineno}"
542 data-line-no="${line.original.lineno}"
538 >
543 >
539 <div>
544 <div>
540 <% loc = None %>
545 <% loc = None %>
541 %if line.original.get_comment_args:
546 %if line.original.get_comment_args:
542 <% loc = get_comments_for(inline_comments, *line.original.get_comment_args) %>
547 <% loc = get_comments_for(inline_comments, *line.original.get_comment_args) %>
543 %endif
548 %endif
544 %if loc:
549 %if loc:
545 <% has_outdated = any([x.outdated for x in loc]) %>
550 <% has_outdated = any([x.outdated for x in loc]) %>
546 % if has_outdated:
551 % if has_outdated:
547 <i title="${_('comments including outdated')}:${len(loc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
552 <i title="${_('comments including outdated')}:${len(loc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
548 % else:
553 % else:
549 <i title="${_('comments')}: ${len(loc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
554 <i title="${_('comments')}: ${len(loc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
550 % endif
555 % endif
551 %endif
556 %endif
552 </div>
557 </div>
553 </td>
558 </td>
554 <td class="cb-lineno ${action_class(line.original.action)}"
559 <td class="cb-lineno ${action_class(line.original.action)}"
555 data-line-no="${line.original.lineno}"
560 data-line-no="${line.original.lineno}"
556 %if old_line_anchor:
561 %if old_line_anchor:
557 id="${old_line_anchor}"
562 id="${old_line_anchor}"
558 %endif
563 %endif
559 >
564 >
560 %if line.original.lineno:
565 %if line.original.lineno:
561 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
566 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
562 %endif
567 %endif
563 </td>
568 </td>
564 <td class="cb-content ${action_class(line.original.action)}"
569 <td class="cb-content ${action_class(line.original.action)}"
565 data-line-no="o${line.original.lineno}"
570 data-line-no="o${line.original.lineno}"
566 >
571 >
567 %if use_comments and line.original.lineno:
572 %if use_comments and line.original.lineno:
568 ${render_add_comment_button()}
573 ${render_add_comment_button()}
569 %endif
574 %endif
570 <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
575 <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
571
576
572 %if use_comments and line.original.lineno and loc:
577 %if use_comments and line.original.lineno and loc:
573 ${inline_comments_container(loc, inline_comments)}
578 ${inline_comments_container(loc, inline_comments)}
574 %endif
579 %endif
575
580
576 </td>
581 </td>
577 <td class="cb-data ${action_class(line.modified.action)}"
582 <td class="cb-data ${action_class(line.modified.action)}"
578 data-line-no="${line.modified.lineno}"
583 data-line-no="${line.modified.lineno}"
579 >
584 >
580 <div>
585 <div>
581
586
582 %if line.modified.get_comment_args:
587 %if line.modified.get_comment_args:
583 <% lmc = get_comments_for(inline_comments, *line.modified.get_comment_args) %>
588 <% lmc = get_comments_for(inline_comments, *line.modified.get_comment_args) %>
584 %else:
589 %else:
585 <% lmc = None%>
590 <% lmc = None%>
586 %endif
591 %endif
587 %if lmc:
592 %if lmc:
588 <% has_outdated = any([x.outdated for x in lmc]) %>
593 <% has_outdated = any([x.outdated for x in lmc]) %>
589 % if has_outdated:
594 % if has_outdated:
590 <i title="${_('comments including outdated')}:${len(lmc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
595 <i title="${_('comments including outdated')}:${len(lmc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
591 % else:
596 % else:
592 <i title="${_('comments')}: ${len(lmc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
597 <i title="${_('comments')}: ${len(lmc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
593 % endif
598 % endif
594 %endif
599 %endif
595 </div>
600 </div>
596 </td>
601 </td>
597 <td class="cb-lineno ${action_class(line.modified.action)}"
602 <td class="cb-lineno ${action_class(line.modified.action)}"
598 data-line-no="${line.modified.lineno}"
603 data-line-no="${line.modified.lineno}"
599 %if new_line_anchor:
604 %if new_line_anchor:
600 id="${new_line_anchor}"
605 id="${new_line_anchor}"
601 %endif
606 %endif
602 >
607 >
603 %if line.modified.lineno:
608 %if line.modified.lineno:
604 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
609 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
605 %endif
610 %endif
606 </td>
611 </td>
607 <td class="cb-content ${action_class(line.modified.action)}"
612 <td class="cb-content ${action_class(line.modified.action)}"
608 data-line-no="n${line.modified.lineno}"
613 data-line-no="n${line.modified.lineno}"
609 >
614 >
610 %if use_comments and line.modified.lineno:
615 %if use_comments and line.modified.lineno:
611 ${render_add_comment_button()}
616 ${render_add_comment_button()}
612 %endif
617 %endif
613 <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
618 <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
614 %if use_comments and line.modified.lineno and lmc:
619 %if use_comments and line.modified.lineno and lmc:
615 ${inline_comments_container(lmc, inline_comments)}
620 ${inline_comments_container(lmc, inline_comments)}
616 %endif
621 %endif
617 </td>
622 </td>
618 </tr>
623 </tr>
619 %endfor
624 %endfor
620 </%def>
625 </%def>
621
626
622
627
623 <%def name="render_hunk_lines_unified(hunk, use_comments=False, inline_comments=None)">
628 <%def name="render_hunk_lines_unified(hunk, use_comments=False, inline_comments=None)">
624 %for old_line_no, new_line_no, action, content, comments_args in hunk.unified:
629 %for old_line_no, new_line_no, action, content, comments_args in hunk.unified:
625 <%
630 <%
626 old_line_anchor, new_line_anchor = None, None
631 old_line_anchor, new_line_anchor = None, None
627 if old_line_no:
632 if old_line_no:
628 old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o')
633 old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o')
629 if new_line_no:
634 if new_line_no:
630 new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n')
635 new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n')
631 %>
636 %>
632 <tr class="cb-line">
637 <tr class="cb-line">
633 <td class="cb-data ${action_class(action)}">
638 <td class="cb-data ${action_class(action)}">
634 <div>
639 <div>
635
640
636 %if comments_args:
641 %if comments_args:
637 <% comments = get_comments_for(inline_comments, *comments_args) %>
642 <% comments = get_comments_for(inline_comments, *comments_args) %>
638 %else:
643 %else:
639 <% comments = None%>
644 <% comments = None%>
640 %endif
645 %endif
641
646
642 % if comments:
647 % if comments:
643 <% has_outdated = any([x.outdated for x in comments]) %>
648 <% has_outdated = any([x.outdated for x in comments]) %>
644 % if has_outdated:
649 % if has_outdated:
645 <i title="${_('comments including outdated')}:${len(comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
650 <i title="${_('comments including outdated')}:${len(comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
646 % else:
651 % else:
647 <i title="${_('comments')}: ${len(comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
652 <i title="${_('comments')}: ${len(comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
648 % endif
653 % endif
649 % endif
654 % endif
650 </div>
655 </div>
651 </td>
656 </td>
652 <td class="cb-lineno ${action_class(action)}"
657 <td class="cb-lineno ${action_class(action)}"
653 data-line-no="${old_line_no}"
658 data-line-no="${old_line_no}"
654 %if old_line_anchor:
659 %if old_line_anchor:
655 id="${old_line_anchor}"
660 id="${old_line_anchor}"
656 %endif
661 %endif
657 >
662 >
658 %if old_line_anchor:
663 %if old_line_anchor:
659 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
664 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
660 %endif
665 %endif
661 </td>
666 </td>
662 <td class="cb-lineno ${action_class(action)}"
667 <td class="cb-lineno ${action_class(action)}"
663 data-line-no="${new_line_no}"
668 data-line-no="${new_line_no}"
664 %if new_line_anchor:
669 %if new_line_anchor:
665 id="${new_line_anchor}"
670 id="${new_line_anchor}"
666 %endif
671 %endif
667 >
672 >
668 %if new_line_anchor:
673 %if new_line_anchor:
669 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
674 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
670 %endif
675 %endif
671 </td>
676 </td>
672 <td class="cb-content ${action_class(action)}"
677 <td class="cb-content ${action_class(action)}"
673 data-line-no="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}"
678 data-line-no="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}"
674 >
679 >
675 %if use_comments:
680 %if use_comments:
676 ${render_add_comment_button()}
681 ${render_add_comment_button()}
677 %endif
682 %endif
678 <span class="cb-code">${action} ${content or '' | n}</span>
683 <span class="cb-code">${action} ${content or '' | n}</span>
679 %if use_comments and comments:
684 %if use_comments and comments:
680 ${inline_comments_container(comments, inline_comments)}
685 ${inline_comments_container(comments, inline_comments)}
681 %endif
686 %endif
682 </td>
687 </td>
683 </tr>
688 </tr>
684 %endfor
689 %endfor
685 </%def>
690 </%def>
686
691
687 <%def name="render_add_comment_button()">
692 <%def name="render_add_comment_button()">
688 <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
693 <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
689 <span><i class="icon-comment"></i></span>
694 <span><i class="icon-comment"></i></span>
690 </button>
695 </button>
691 </%def>
696 </%def>
692
697
693 <%def name="render_diffset_menu()">
698 <%def name="render_diffset_menu()">
694
699
695 <div class="diffset-menu clearinner">
700 <div class="diffset-menu clearinner">
696 <div class="pull-right">
701 <div class="pull-right">
697 <div class="btn-group">
702 <div class="btn-group">
698
703
699 <a
704 <a
700 class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
705 class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
701 title="${h.tooltip(_('View side by side'))}"
706 title="${h.tooltip(_('View side by side'))}"
702 href="${h.current_route_path(request, diffmode='sideside')}">
707 href="${h.current_route_path(request, diffmode='sideside')}">
703 <span>${_('Side by Side')}</span>
708 <span>${_('Side by Side')}</span>
704 </a>
709 </a>
705 <a
710 <a
706 class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
711 class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
707 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
712 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
708 <span>${_('Unified')}</span>
713 <span>${_('Unified')}</span>
709 </a>
714 </a>
710 </div>
715 </div>
711 </div>
716 </div>
712
717
713 <div class="pull-left">
718 <div class="pull-left">
714 <div class="btn-group">
719 <div class="btn-group">
715 <a
720 <a
716 class="btn"
721 class="btn"
717 href="#"
722 href="#"
718 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All Files')}</a>
723 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All Files')}</a>
719 <a
724 <a
720 class="btn"
725 class="btn"
721 href="#"
726 href="#"
722 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All Files')}</a>
727 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All Files')}</a>
723 <a
728 <a
724 class="btn"
729 class="btn"
725 href="#"
730 href="#"
726 onclick="return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a>
731 onclick="return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a>
727 </div>
732 </div>
728 </div>
733 </div>
729 </div>
734 </div>
730 </%def>
735 </%def>
General Comments 0
You need to be logged in to leave comments. Login now