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