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