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