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