##// END OF EJS Templates
diffs: support mercurial copy in diffs details.
marcink -
r1582:dcac0725 default
parent child Browse files
Show More
@@ -1,1140 +1,1143 b''
1 1 // Default styles
2 2
3 3 .diff-collapse {
4 4 margin: @padding 0;
5 5 text-align: right;
6 6 }
7 7
8 8 .diff-container {
9 9 margin-bottom: @space;
10 10
11 11 .diffblock {
12 12 margin-bottom: @space;
13 13 }
14 14
15 15 &.hidden {
16 16 display: none;
17 17 overflow: hidden;
18 18 }
19 19 }
20 20
21 21 .compare_view_files {
22 22
23 23 .diff-container {
24 24
25 25 .diffblock {
26 26 margin-bottom: 0;
27 27 }
28 28 }
29 29 }
30 30
31 31 div.diffblock .sidebyside {
32 32 background: #ffffff;
33 33 }
34 34
35 35 div.diffblock {
36 36 overflow-x: auto;
37 37 overflow-y: hidden;
38 38 clear: both;
39 39 padding: 0px;
40 40 background: @grey6;
41 41 border: @border-thickness solid @grey5;
42 42 -webkit-border-radius: @border-radius @border-radius 0px 0px;
43 43 border-radius: @border-radius @border-radius 0px 0px;
44 44
45 45
46 46 .comments-number {
47 47 float: right;
48 48 }
49 49
50 50 // BEGIN CODE-HEADER STYLES
51 51
52 52 .code-header {
53 53 background: @grey6;
54 54 padding: 10px 0 10px 0;
55 55 height: auto;
56 56 width: 100%;
57 57
58 58 .hash {
59 59 float: left;
60 60 padding: 2px 0 0 2px;
61 61 }
62 62
63 63 .date {
64 64 float: left;
65 65 text-transform: uppercase;
66 66 padding: 4px 0px 0px 2px;
67 67 }
68 68
69 69 div {
70 70 margin-left: 4px;
71 71 }
72 72
73 73 div.compare_header {
74 74 min-height: 40px;
75 75 margin: 0;
76 76 padding: 0 @padding;
77 77
78 78 .drop-menu {
79 79 float:left;
80 80 display: block;
81 81 margin:0 0 @padding 0;
82 82 }
83 83
84 84 .compare-label {
85 85 float: left;
86 86 clear: both;
87 87 display: inline-block;
88 88 min-width: 5em;
89 89 margin: 0;
90 90 padding: @button-padding @button-padding @button-padding 0;
91 91 font-family: @text-semibold;
92 92 }
93 93
94 94 .compare-buttons {
95 95 float: left;
96 96 margin: 0;
97 97 padding: 0 0 @padding;
98 98
99 99 .btn {
100 100 margin: 0 @padding 0 0;
101 101 }
102 102 }
103 103 }
104 104
105 105 }
106 106
107 107 .parents {
108 108 float: left;
109 109 width: 100px;
110 110 font-weight: 400;
111 111 vertical-align: middle;
112 112 padding: 0px 2px 0px 2px;
113 113 background-color: @grey6;
114 114
115 115 #parent_link {
116 116 margin: 00px 2px;
117 117
118 118 &.double {
119 119 margin: 0px 2px;
120 120 }
121 121
122 122 &.disabled{
123 123 margin-right: @padding;
124 124 }
125 125 }
126 126 }
127 127
128 128 .children {
129 129 float: right;
130 130 width: 100px;
131 131 font-weight: 400;
132 132 vertical-align: middle;
133 133 text-align: right;
134 134 padding: 0px 2px 0px 2px;
135 135 background-color: @grey6;
136 136
137 137 #child_link {
138 138 margin: 0px 2px;
139 139
140 140 &.double {
141 141 margin: 0px 2px;
142 142 }
143 143
144 144 &.disabled{
145 145 margin-right: @padding;
146 146 }
147 147 }
148 148 }
149 149
150 150 .changeset_header {
151 151 height: 16px;
152 152
153 153 & > div{
154 154 margin-right: @padding;
155 155 }
156 156 }
157 157
158 158 .changeset_file {
159 159 text-align: left;
160 160 float: left;
161 161 padding: 0;
162 162
163 163 a{
164 164 display: inline-block;
165 165 margin-right: 0.5em;
166 166 }
167 167
168 168 #selected_mode{
169 169 margin-left: 0;
170 170 }
171 171 }
172 172
173 173 .diff-menu-wrapper {
174 174 float: left;
175 175 }
176 176
177 177 .diff-menu {
178 178 position: absolute;
179 179 background: none repeat scroll 0 0 #FFFFFF;
180 180 border-color: #003367 @grey3 @grey3;
181 181 border-right: 1px solid @grey3;
182 182 border-style: solid solid solid;
183 183 border-width: @border-thickness;
184 184 box-shadow: 2px 8px 4px rgba(0, 0, 0, 0.2);
185 185 margin-top: 5px;
186 186 margin-left: 1px;
187 187 }
188 188
189 189 .diff-actions, .editor-actions {
190 190 float: left;
191 191
192 192 input{
193 193 margin: 0 0.5em 0 0;
194 194 }
195 195 }
196 196
197 197 // END CODE-HEADER STYLES
198 198
199 199 // BEGIN CODE-BODY STYLES
200 200
201 201 .code-body {
202 202 padding: 0;
203 203 background-color: #ffffff;
204 204 position: relative;
205 205 max-width: none;
206 206 box-sizing: border-box;
207 207 // TODO: johbo: Parent has overflow: auto, this forces the child here
208 208 // to have the intended size and to scroll. Should be simplified.
209 209 width: 100%;
210 210 overflow-x: auto;
211 211 }
212 212
213 213 pre.raw {
214 214 background: white;
215 215 color: @grey1;
216 216 }
217 217 // END CODE-BODY STYLES
218 218
219 219 }
220 220
221 221
222 222 table.code-difftable {
223 223 border-collapse: collapse;
224 224 width: 99%;
225 225 border-radius: 0px !important;
226 226
227 227 td {
228 228 padding: 0 !important;
229 229 background: none !important;
230 230 border: 0 !important;
231 231 }
232 232
233 233 .context {
234 234 background: none repeat scroll 0 0 #DDE7EF;
235 235 }
236 236
237 237 .add {
238 238 background: none repeat scroll 0 0 #DDFFDD;
239 239
240 240 ins {
241 241 background: none repeat scroll 0 0 #AAFFAA;
242 242 text-decoration: none;
243 243 }
244 244 }
245 245
246 246 .del {
247 247 background: none repeat scroll 0 0 #FFDDDD;
248 248
249 249 del {
250 250 background: none repeat scroll 0 0 #FFAAAA;
251 251 text-decoration: none;
252 252 }
253 253 }
254 254
255 255 /** LINE NUMBERS **/
256 256 .lineno {
257 257 padding-left: 2px !important;
258 258 padding-right: 2px;
259 259 text-align: right;
260 260 width: 32px;
261 261 -moz-user-select: none;
262 262 -webkit-user-select: none;
263 263 border-right: @border-thickness solid @grey5 !important;
264 264 border-left: 0px solid #CCC !important;
265 265 border-top: 0px solid #CCC !important;
266 266 border-bottom: none !important;
267 267
268 268 a {
269 269 &:extend(pre);
270 270 text-align: right;
271 271 padding-right: 2px;
272 272 cursor: pointer;
273 273 display: block;
274 274 width: 32px;
275 275 }
276 276 }
277 277
278 278 .context {
279 279 cursor: auto;
280 280 &:extend(pre);
281 281 }
282 282
283 283 .lineno-inline {
284 284 background: none repeat scroll 0 0 #FFF !important;
285 285 padding-left: 2px;
286 286 padding-right: 2px;
287 287 text-align: right;
288 288 width: 30px;
289 289 -moz-user-select: none;
290 290 -webkit-user-select: none;
291 291 }
292 292
293 293 /** CODE **/
294 294 .code {
295 295 display: block;
296 296 width: 100%;
297 297
298 298 td {
299 299 margin: 0;
300 300 padding: 0;
301 301 }
302 302
303 303 pre {
304 304 margin: 0;
305 305 padding: 0;
306 306 margin-left: .5em;
307 307 }
308 308 }
309 309 }
310 310
311 311
312 312 // Comments
313 313
314 314 div.comment:target {
315 315 border-left: 6px solid @comment-highlight-color !important;
316 316 padding-left: 3px;
317 317 margin-left: -9px;
318 318 }
319 319
320 320 //TODO: anderson: can't get an absolute number out of anything, so had to put the
321 321 //current values that might change. But to make it clear I put as a calculation
322 322 @comment-max-width: 1065px;
323 323 @pr-extra-margin: 34px;
324 324 @pr-border-spacing: 4px;
325 325 @pr-comment-width: @comment-max-width - @pr-extra-margin - @pr-border-spacing;
326 326
327 327 // Pull Request
328 328 .cs_files .code-difftable {
329 329 border: @border-thickness solid @grey5; //borders only on PRs
330 330
331 331 .comment-inline-form,
332 332 div.comment {
333 333 width: @pr-comment-width;
334 334 }
335 335 }
336 336
337 337 // Changeset
338 338 .code-difftable {
339 339 .comment-inline-form,
340 340 div.comment {
341 341 width: @comment-max-width;
342 342 }
343 343 }
344 344
345 345 //Style page
346 346 @style-extra-margin: @sidebar-width + (@sidebarpadding * 3) + @padding;
347 347 #style-page .code-difftable{
348 348 .comment-inline-form,
349 349 div.comment {
350 350 width: @comment-max-width - @style-extra-margin;
351 351 }
352 352 }
353 353
354 354 #context-bar > h2 {
355 355 font-size: 20px;
356 356 }
357 357
358 358 #context-bar > h2> a {
359 359 font-size: 20px;
360 360 }
361 361 // end of defaults
362 362
363 363 .file_diff_buttons {
364 364 padding: 0 0 @padding;
365 365
366 366 .drop-menu {
367 367 float: left;
368 368 margin: 0 @padding 0 0;
369 369 }
370 370 .btn {
371 371 margin: 0 @padding 0 0;
372 372 }
373 373 }
374 374
375 375 .code-body.textarea.editor {
376 376 max-width: none;
377 377 padding: 15px;
378 378 }
379 379
380 380 td.injected_diff{
381 381 max-width: 1178px;
382 382 overflow-x: auto;
383 383 overflow-y: hidden;
384 384
385 385 div.diff-container,
386 386 div.diffblock{
387 387 max-width: 100%;
388 388 }
389 389
390 390 div.code-body {
391 391 max-width: 1124px;
392 392 overflow-x: auto;
393 393 overflow-y: hidden;
394 394 padding: 0;
395 395 }
396 396 div.diffblock {
397 397 border: none;
398 398 }
399 399
400 400 &.inline-form {
401 401 width: 99%
402 402 }
403 403 }
404 404
405 405
406 406 table.code-difftable {
407 407 width: 100%;
408 408 }
409 409
410 410 /** PYGMENTS COLORING **/
411 411 div.codeblock {
412 412
413 413 // TODO: johbo: Added interim to get rid of the margin around
414 414 // Select2 widgets. This needs further cleanup.
415 415 margin-top: @padding;
416 416
417 417 overflow: auto;
418 418 padding: 0px;
419 419 border: @border-thickness solid @grey5;
420 420 background: @grey6;
421 421 .border-radius(@border-radius);
422 422
423 423 #remove_gist {
424 424 float: right;
425 425 }
426 426
427 427 .author {
428 428 clear: both;
429 429 vertical-align: middle;
430 430 font-family: @text-bold;
431 431 }
432 432
433 433 .btn-mini {
434 434 float: left;
435 435 margin: 0 5px 0 0;
436 436 }
437 437
438 438 .code-header {
439 439 padding: @padding;
440 440 border-bottom: @border-thickness solid @grey5;
441 441
442 442 .rc-user {
443 443 min-width: 0;
444 444 margin-right: .5em;
445 445 }
446 446
447 447 .stats {
448 448 clear: both;
449 449 margin: 0 0 @padding 0;
450 450 padding: 0;
451 451 .left {
452 452 float: left;
453 453 clear: left;
454 454 max-width: 75%;
455 455 margin: 0 0 @padding 0;
456 456
457 457 &.item {
458 458 margin-right: @padding;
459 459 &.last { border-right: none; }
460 460 }
461 461 }
462 462 .buttons { float: right; }
463 463 .author {
464 464 height: 25px; margin-left: 15px; font-weight: bold;
465 465 }
466 466 }
467 467
468 468 .commit {
469 469 margin: 5px 0 0 26px;
470 470 font-weight: normal;
471 471 white-space: pre-wrap;
472 472 }
473 473 }
474 474
475 475 .message {
476 476 position: relative;
477 477 margin: @padding;
478 478
479 479 .codeblock-label {
480 480 margin: 0 0 1em 0;
481 481 }
482 482 }
483 483
484 484 .code-body {
485 485 padding: @padding;
486 486 background-color: #ffffff;
487 487 min-width: 100%;
488 488 box-sizing: border-box;
489 489 // TODO: johbo: Parent has overflow: auto, this forces the child here
490 490 // to have the intended size and to scroll. Should be simplified.
491 491 width: 100%;
492 492 overflow-x: auto;
493 493
494 494 img.rendered-binary {
495 495 height: auto;
496 496 width: 100%;
497 497 }
498 498 }
499 499 }
500 500
501 501 .code-highlighttable,
502 502 div.codeblock {
503 503
504 504 &.readme {
505 505 background-color: white;
506 506 }
507 507
508 508 .markdown-block table {
509 509 border-collapse: collapse;
510 510
511 511 th,
512 512 td {
513 513 padding: .5em;
514 514 border: @border-thickness solid @border-default-color;
515 515 }
516 516 }
517 517
518 518 table {
519 519 border: 0px;
520 520 margin: 0;
521 521 letter-spacing: normal;
522 522
523 523
524 524 td {
525 525 border: 0px;
526 526 vertical-align: top;
527 527 }
528 528 }
529 529 }
530 530
531 531 div.codeblock .code-header .search-path { padding: 0 0 0 10px; }
532 532 div.search-code-body {
533 533 background-color: #ffffff; padding: 5px 0 5px 10px;
534 534 pre {
535 535 .match { background-color: #faffa6;}
536 536 .break { display: block; width: 100%; background-color: #DDE7EF; color: #747474; }
537 537 }
538 538 .code-highlighttable {
539 539 border-collapse: collapse;
540 540
541 541 tr:hover {
542 542 background: #fafafa;
543 543 }
544 544 td.code {
545 545 padding-left: 10px;
546 546 }
547 547 td.line {
548 548 border-right: 1px solid #ccc !important;
549 549 padding-right: 10px;
550 550 text-align: right;
551 551 font-family: "Lucida Console",Monaco,monospace;
552 552 span {
553 553 white-space: pre-wrap;
554 554 color: #666666;
555 555 }
556 556 }
557 557 }
558 558 }
559 559
560 560 div.annotatediv { margin-left: 2px; margin-right: 4px; }
561 561 .code-highlight {
562 562 margin: 0; padding: 0; border-left: @border-thickness solid @grey5;
563 563 pre, .linenodiv pre { padding: 0 5px; margin: 0; }
564 564 pre div:target {background-color: @comment-highlight-color !important;}
565 565 }
566 566
567 567 .linenos a { text-decoration: none; }
568 568
569 569 .CodeMirror-selected { background: @rchighlightblue; }
570 570 .CodeMirror-focused .CodeMirror-selected { background: @rchighlightblue; }
571 571 .CodeMirror ::selection { background: @rchighlightblue; }
572 572 .CodeMirror ::-moz-selection { background: @rchighlightblue; }
573 573
574 574 .code { display: block; border:0px !important; }
575 575 .code-highlight, /* TODO: dan: merge codehilite into code-highlight */
576 576 .codehilite {
577 577 .hll { background-color: #ffffcc }
578 578 .c { color: #408080; font-style: italic } /* Comment */
579 579 .err, .codehilite .err { border: @border-thickness solid #FF0000 } /* Error */
580 580 .k { color: #008000; font-weight: bold } /* Keyword */
581 581 .o { color: #666666 } /* Operator */
582 582 .cm { color: #408080; font-style: italic } /* Comment.Multiline */
583 583 .cp { color: #BC7A00 } /* Comment.Preproc */
584 584 .c1 { color: #408080; font-style: italic } /* Comment.Single */
585 585 .cs { color: #408080; font-style: italic } /* Comment.Special */
586 586 .gd { color: #A00000 } /* Generic.Deleted */
587 587 .ge { font-style: italic } /* Generic.Emph */
588 588 .gr { color: #FF0000 } /* Generic.Error */
589 589 .gh { color: #000080; font-weight: bold } /* Generic.Heading */
590 590 .gi { color: #00A000 } /* Generic.Inserted */
591 591 .go { color: #808080 } /* Generic.Output */
592 592 .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
593 593 .gs { font-weight: bold } /* Generic.Strong */
594 594 .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
595 595 .gt { color: #0040D0 } /* Generic.Traceback */
596 596 .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
597 597 .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
598 598 .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
599 599 .kp { color: #008000 } /* Keyword.Pseudo */
600 600 .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
601 601 .kt { color: #B00040 } /* Keyword.Type */
602 602 .m { color: #666666 } /* Literal.Number */
603 603 .s { color: #BA2121 } /* Literal.String */
604 604 .na { color: #7D9029 } /* Name.Attribute */
605 605 .nb { color: #008000 } /* Name.Builtin */
606 606 .nc { color: #0000FF; font-weight: bold } /* Name.Class */
607 607 .no { color: #880000 } /* Name.Constant */
608 608 .nd { color: #AA22FF } /* Name.Decorator */
609 609 .ni { color: #999999; font-weight: bold } /* Name.Entity */
610 610 .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
611 611 .nf { color: #0000FF } /* Name.Function */
612 612 .nl { color: #A0A000 } /* Name.Label */
613 613 .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
614 614 .nt { color: #008000; font-weight: bold } /* Name.Tag */
615 615 .nv { color: #19177C } /* Name.Variable */
616 616 .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
617 617 .w { color: #bbbbbb } /* Text.Whitespace */
618 618 .mf { color: #666666 } /* Literal.Number.Float */
619 619 .mh { color: #666666 } /* Literal.Number.Hex */
620 620 .mi { color: #666666 } /* Literal.Number.Integer */
621 621 .mo { color: #666666 } /* Literal.Number.Oct */
622 622 .sb { color: #BA2121 } /* Literal.String.Backtick */
623 623 .sc { color: #BA2121 } /* Literal.String.Char */
624 624 .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
625 625 .s2 { color: #BA2121 } /* Literal.String.Double */
626 626 .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
627 627 .sh { color: #BA2121 } /* Literal.String.Heredoc */
628 628 .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
629 629 .sx { color: #008000 } /* Literal.String.Other */
630 630 .sr { color: #BB6688 } /* Literal.String.Regex */
631 631 .s1 { color: #BA2121 } /* Literal.String.Single */
632 632 .ss { color: #19177C } /* Literal.String.Symbol */
633 633 .bp { color: #008000 } /* Name.Builtin.Pseudo */
634 634 .vc { color: #19177C } /* Name.Variable.Class */
635 635 .vg { color: #19177C } /* Name.Variable.Global */
636 636 .vi { color: #19177C } /* Name.Variable.Instance */
637 637 .il { color: #666666 } /* Literal.Number.Integer.Long */
638 638 }
639 639
640 640 /* customized pre blocks for markdown/rst */
641 641 pre.literal-block, .codehilite pre{
642 642 padding: @padding;
643 643 border: 1px solid @grey6;
644 644 .border-radius(@border-radius);
645 645 background-color: @grey7;
646 646 }
647 647
648 648
649 649 /* START NEW CODE BLOCK CSS */
650 650
651 651 @cb-line-height: 18px;
652 652 @cb-line-code-padding: 10px;
653 653 @cb-text-padding: 5px;
654 654
655 655 @pill-padding: 2px 7px;
656 656
657 657 input.filediff-collapse-state {
658 658 display: none;
659 659
660 660 &:checked + .filediff { /* file diff is collapsed */
661 661 .cb {
662 662 display: none
663 663 }
664 664 .filediff-collapse-indicator {
665 665 width: 0;
666 666 height: 0;
667 667 border-style: solid;
668 668 border-width: 6.5px 0 6.5px 11.3px;
669 669 border-color: transparent transparent transparent #ccc;
670 670 }
671 671 .filediff-menu {
672 672 display: none;
673 673 }
674 674 margin: 10px 0 0 0;
675 675 }
676 676
677 677 &+ .filediff { /* file diff is expanded */
678 678 .filediff-collapse-indicator {
679 679 width: 0;
680 680 height: 0;
681 681 border-style: solid;
682 682 border-width: 11.3px 6.5px 0 6.5px;
683 683 border-color: #ccc transparent transparent transparent;
684 684 }
685 685 .filediff-menu {
686 686 display: block;
687 687 }
688 688 margin: 10px 0;
689 689 &:nth-child(2) {
690 690 margin: 0;
691 691 }
692 692 }
693 693 }
694 694 .cs_files {
695 695 clear: both;
696 696 }
697 697
698 698 .diffset-menu {
699 699 margin-bottom: 20px;
700 700 }
701 701 .diffset {
702 702 margin: 20px auto;
703 703 .diffset-heading {
704 704 border: 1px solid @grey5;
705 705 margin-bottom: -1px;
706 706 // margin-top: 20px;
707 707 h2 {
708 708 margin: 0;
709 709 line-height: 38px;
710 710 padding-left: 10px;
711 711 }
712 712 .btn {
713 713 margin: 0;
714 714 }
715 715 background: @grey6;
716 716 display: block;
717 717 padding: 5px;
718 718 }
719 719 .diffset-heading-warning {
720 720 background: @alert3-inner;
721 721 border: 1px solid @alert3;
722 722 }
723 723 &.diffset-comments-disabled {
724 724 .cb-comment-box-opener, .comment-inline-form, .cb-comment-add-button {
725 725 display: none !important;
726 726 }
727 727 }
728 728 }
729 729
730 730 .pill {
731 731 display: block;
732 732 float: left;
733 733 padding: @pill-padding;
734 734 }
735 735 .pill-group {
736 736 .pill {
737 737 opacity: .8;
738 738 &:first-child {
739 739 border-radius: @border-radius 0 0 @border-radius;
740 740 }
741 741 &:last-child {
742 742 border-radius: 0 @border-radius @border-radius 0;
743 743 }
744 744 &:only-child {
745 745 border-radius: @border-radius;
746 746 }
747 747 }
748 748 }
749 749
750 750 /* Main comments*/
751 751 #comments {
752 752 .comment-selected {
753 753 border-left: 6px solid @comment-highlight-color;
754 754 padding-left: 3px;
755 755 margin-left: -9px;
756 756 }
757 757 }
758 758
759 759 .filediff {
760 760 border: 1px solid @grey5;
761 761
762 762 /* START OVERRIDES */
763 763 .code-highlight {
764 764 border: none; // TODO: remove this border from the global
765 765 // .code-highlight, it doesn't belong there
766 766 }
767 767 label {
768 768 margin: 0; // TODO: remove this margin definition from global label
769 769 // it doesn't belong there - if margin on labels
770 770 // are needed for a form they should be defined
771 771 // in the form's class
772 772 }
773 773 /* END OVERRIDES */
774 774
775 775 * {
776 776 box-sizing: border-box;
777 777 }
778 778 .filediff-anchor {
779 779 visibility: hidden;
780 780 }
781 781 &:hover {
782 782 .filediff-anchor {
783 783 visibility: visible;
784 784 }
785 785 }
786 786
787 787 .filediff-collapse-indicator {
788 788 border-style: solid;
789 789 float: left;
790 790 margin: 4px 0px 0 0;
791 791 cursor: pointer;
792 792 }
793 793
794 794 .filediff-heading {
795 795 background: @grey7;
796 796 cursor: pointer;
797 797 display: block;
798 798 padding: 5px 10px;
799 799 }
800 800 .filediff-heading:after {
801 801 content: "";
802 802 display: table;
803 803 clear: both;
804 804 }
805 805 .filediff-heading:hover {
806 806 background: #e1e9f4 !important;
807 807 }
808 808
809 809 .filediff-menu {
810 810 float: right;
811 811 text-align: right;
812 812 padding: 5px 5px 5px 0px;
813 813
814 814 &> a,
815 815 &> span {
816 816 padding: 1px;
817 817 }
818 818 }
819 819
820 820 .pill {
821 821 &[op="name"] {
822 822 background: none;
823 color: @grey2;
824 823 opacity: 1;
825 824 color: white;
826 825 }
827 826 &[op="limited"] {
828 827 background: @grey2;
829 828 color: white;
830 829 }
831 830 &[op="binary"] {
832 831 background: @color7;
833 832 color: white;
834 833 }
835 834 &[op="modified"] {
836 835 background: @alert1;
837 836 color: white;
838 837 }
839 838 &[op="renamed"] {
840 839 background: @color4;
841 840 color: white;
842 841 }
842 &[op="copied"] {
843 background: @color4;
844 color: white;
845 }
843 846 &[op="mode"] {
844 847 background: @grey3;
845 848 color: white;
846 849 }
847 850 &[op="symlink"] {
848 851 background: @color8;
849 852 color: white;
850 853 }
851 854
852 855 &[op="added"] { /* added lines */
853 856 background: @alert1;
854 857 color: white;
855 858 }
856 859 &[op="deleted"] { /* deleted lines */
857 860 background: @alert2;
858 861 color: white;
859 862 }
860 863
861 864 &[op="created"] { /* created file */
862 865 background: @alert1;
863 866 color: white;
864 867 }
865 868 &[op="removed"] { /* deleted file */
866 869 background: @color5;
867 870 color: white;
868 871 }
869 872 }
870 873
871 874 .filediff-collapse-button, .filediff-expand-button {
872 875 cursor: pointer;
873 876 }
874 877 .filediff-collapse-button {
875 878 display: inline;
876 879 }
877 880 .filediff-expand-button {
878 881 display: none;
879 882 }
880 883 .filediff-collapsed .filediff-collapse-button {
881 884 display: none;
882 885 }
883 886 .filediff-collapsed .filediff-expand-button {
884 887 display: inline;
885 888 }
886 889
887 890 /**** COMMENTS ****/
888 891
889 892 .filediff-menu {
890 893 .show-comment-button {
891 894 display: none;
892 895 }
893 896 }
894 897 &.hide-comments {
895 898 .inline-comments {
896 899 display: none;
897 900 }
898 901 .filediff-menu {
899 902 .show-comment-button {
900 903 display: inline;
901 904 }
902 905 .hide-comment-button {
903 906 display: none;
904 907 }
905 908 }
906 909 }
907 910
908 911 .hide-line-comments {
909 912 .inline-comments {
910 913 display: none;
911 914 }
912 915 }
913 916
914 917 /**** END COMMENTS ****/
915 918
916 919 }
917 920
918 921 .filediff-outdated {
919 922 padding: 8px 0;
920 923
921 924 .filediff-heading {
922 925 opacity: .5;
923 926 }
924 927 }
925 928
926 929 table.cb {
927 930 width: 100%;
928 931 border-collapse: collapse;
929 932
930 933 .cb-text {
931 934 padding: @cb-text-padding;
932 935 }
933 936 .cb-hunk {
934 937 padding: @cb-text-padding;
935 938 }
936 939 .cb-expand {
937 940 display: none;
938 941 }
939 942 .cb-collapse {
940 943 display: inline;
941 944 }
942 945 &.cb-collapsed {
943 946 .cb-line {
944 947 display: none;
945 948 }
946 949 .cb-expand {
947 950 display: inline;
948 951 }
949 952 .cb-collapse {
950 953 display: none;
951 954 }
952 955 }
953 956
954 957 /* intentionally general selector since .cb-line-selected must override it
955 958 and they both use !important since the td itself may have a random color
956 959 generated by annotation blocks. TLDR: if you change it, make sure
957 960 annotated block selection and line selection in file view still work */
958 961 .cb-line-fresh .cb-content {
959 962 background: white !important;
960 963 }
961 964 .cb-warning {
962 965 background: #fff4dd;
963 966 }
964 967
965 968 &.cb-diff-sideside {
966 969 td {
967 970 &.cb-content {
968 971 width: 50%;
969 972 }
970 973 }
971 974 }
972 975
973 976 tr {
974 977 &.cb-annotate {
975 978 border-top: 1px solid #eee;
976 979 }
977 980
978 981 &.cb-hunk {
979 982 font-family: @font-family-monospace;
980 983 color: rgba(0, 0, 0, 0.3);
981 984
982 985 td {
983 986 &:first-child {
984 987 background: #edf2f9;
985 988 }
986 989 &:last-child {
987 990 background: #f4f7fb;
988 991 }
989 992 }
990 993 }
991 994 }
992 995
993 996
994 997 td {
995 998 vertical-align: top;
996 999 padding: 0;
997 1000
998 1001 &.cb-content {
999 1002 font-size: 12.35px;
1000 1003
1001 1004 &.cb-line-selected .cb-code {
1002 1005 background: @comment-highlight-color !important;
1003 1006 }
1004 1007
1005 1008 span.cb-code {
1006 1009 line-height: @cb-line-height;
1007 1010 padding-left: @cb-line-code-padding;
1008 1011 padding-right: @cb-line-code-padding;
1009 1012 display: block;
1010 1013 white-space: pre-wrap;
1011 1014 font-family: @font-family-monospace;
1012 1015 word-break: break-all;
1013 1016 .nonl {
1014 1017 color: @color5;
1015 1018 }
1016 1019 }
1017 1020
1018 1021 &> button.cb-comment-box-opener {
1019 1022
1020 1023 padding: 2px 2px 1px 3px;
1021 1024 margin-left: -6px;
1022 1025 margin-top: -1px;
1023 1026
1024 1027 border-radius: @border-radius;
1025 1028 position: absolute;
1026 1029 display: none;
1027 1030 }
1028 1031 .cb-comment {
1029 1032 margin-top: 10px;
1030 1033 white-space: normal;
1031 1034 }
1032 1035 }
1033 1036 &:hover {
1034 1037 button.cb-comment-box-opener {
1035 1038 display: block;
1036 1039 }
1037 1040 &+ td button.cb-comment-box-opener {
1038 1041 display: block
1039 1042 }
1040 1043 }
1041 1044
1042 1045 &.cb-data {
1043 1046 text-align: right;
1044 1047 width: 30px;
1045 1048 font-family: @font-family-monospace;
1046 1049
1047 1050 .icon-comment {
1048 1051 cursor: pointer;
1049 1052 }
1050 1053 &.cb-line-selected > div {
1051 1054 display: block;
1052 1055 background: @comment-highlight-color !important;
1053 1056 line-height: @cb-line-height;
1054 1057 color: rgba(0, 0, 0, 0.3);
1055 1058 }
1056 1059 }
1057 1060
1058 1061 &.cb-lineno {
1059 1062 padding: 0;
1060 1063 width: 50px;
1061 1064 color: rgba(0, 0, 0, 0.3);
1062 1065 text-align: right;
1063 1066 border-right: 1px solid #eee;
1064 1067 font-family: @font-family-monospace;
1065 1068
1066 1069 a::before {
1067 1070 content: attr(data-line-no);
1068 1071 }
1069 1072 &.cb-line-selected a {
1070 1073 background: @comment-highlight-color !important;
1071 1074 }
1072 1075
1073 1076 a {
1074 1077 display: block;
1075 1078 padding-right: @cb-line-code-padding;
1076 1079 padding-left: @cb-line-code-padding;
1077 1080 line-height: @cb-line-height;
1078 1081 color: rgba(0, 0, 0, 0.3);
1079 1082 }
1080 1083 }
1081 1084
1082 1085 &.cb-empty {
1083 1086 background: @grey7;
1084 1087 }
1085 1088
1086 1089 ins {
1087 1090 color: black;
1088 1091 background: #a6f3a6;
1089 1092 text-decoration: none;
1090 1093 }
1091 1094 del {
1092 1095 color: black;
1093 1096 background: #f8cbcb;
1094 1097 text-decoration: none;
1095 1098 }
1096 1099 &.cb-addition {
1097 1100 background: #ecffec;
1098 1101
1099 1102 &.blob-lineno {
1100 1103 background: #ddffdd;
1101 1104 }
1102 1105 }
1103 1106 &.cb-deletion {
1104 1107 background: #ffecec;
1105 1108
1106 1109 &.blob-lineno {
1107 1110 background: #ffdddd;
1108 1111 }
1109 1112 }
1110 1113 &.cb-annotate-message-spacer {
1111 1114 width:8px;
1112 1115 padding: 1px 0px 0px 3px;
1113 1116 }
1114 1117 &.cb-annotate-info {
1115 1118 width: 320px;
1116 1119 min-width: 320px;
1117 1120 max-width: 320px;
1118 1121 padding: 5px 2px;
1119 1122 font-size: 13px;
1120 1123
1121 1124 .cb-annotate-message {
1122 1125 padding: 2px 0px 0px 0px;
1123 1126 white-space: pre-line;
1124 1127 overflow: hidden;
1125 1128 }
1126 1129 .rc-user {
1127 1130 float: none;
1128 1131 padding: 0 6px 0 17px;
1129 1132 min-width: unset;
1130 1133 min-height: unset;
1131 1134 }
1132 1135 }
1133 1136
1134 1137 &.cb-annotate-revision {
1135 1138 cursor: pointer;
1136 1139 text-align: right;
1137 1140 padding: 1px 3px 0px 3px;
1138 1141 }
1139 1142 }
1140 1143 }
@@ -1,663 +1,672 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 145 ## initial value could be marked as False later on
146 146 <% over_lines_changed_limit = False %>
147 147 %for i, filediff in enumerate(diffset.files):
148 148
149 149 <%
150 150 lines_changed = filediff['patch']['stats']['added'] + filediff['patch']['stats']['deleted']
151 151 over_lines_changed_limit = lines_changed > lines_changed_limit
152 152 %>
153 153 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
154 154 <div
155 155 class="filediff"
156 156 data-f-path="${filediff['patch']['filename']}"
157 157 id="a_${h.FID('', filediff['patch']['filename'])}">
158 158 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
159 159 <div class="filediff-collapse-indicator"></div>
160 160 ${diff_ops(filediff)}
161 161 </label>
162 162 ${diff_menu(filediff, use_comments=use_comments)}
163 163 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
164 164 %if not filediff.hunks:
165 165 %for op_id, op_text in filediff['patch']['stats']['ops'].items():
166 166 <tr>
167 167 <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
168 168 %if op_id == DEL_FILENODE:
169 169 ${_('File was deleted')}
170 170 %elif op_id == BIN_FILENODE:
171 171 ${_('Binary file hidden')}
172 172 %else:
173 173 ${op_text}
174 174 %endif
175 175 </td>
176 176 </tr>
177 177 %endfor
178 178 %endif
179 179 %if filediff.patch['is_limited_diff']:
180 180 <tr class="cb-warning cb-collapser">
181 181 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
182 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>
183 183 </td>
184 184 </tr>
185 185 %else:
186 186 %if over_lines_changed_limit:
187 187 <tr class="cb-warning cb-collapser">
188 188 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
189 189 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
190 190 <a href="#" class="cb-expand"
191 191 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
192 192 </a>
193 193 <a href="#" class="cb-collapse"
194 194 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
195 195 </a>
196 196 </td>
197 197 </tr>
198 198 %endif
199 199 %endif
200 200
201 201 %for hunk in filediff.hunks:
202 202 <tr class="cb-hunk">
203 203 <td ${c.diffmode == 'unified' and 'colspan=3' or ''}>
204 204 ## TODO: dan: add ajax loading of more context here
205 205 ## <a href="#">
206 206 <i class="icon-more"></i>
207 207 ## </a>
208 208 </td>
209 209 <td ${c.diffmode == 'sideside' and 'colspan=5' or ''}>
210 210 @@
211 211 -${hunk.source_start},${hunk.source_length}
212 212 +${hunk.target_start},${hunk.target_length}
213 213 ${hunk.section_header}
214 214 </td>
215 215 </tr>
216 216 %if c.diffmode == 'unified':
217 217 ${render_hunk_lines_unified(hunk, use_comments=use_comments)}
218 218 %elif c.diffmode == 'sideside':
219 219 ${render_hunk_lines_sideside(hunk, use_comments=use_comments)}
220 220 %else:
221 221 <tr class="cb-line">
222 222 <td>unknown diff mode</td>
223 223 </tr>
224 224 %endif
225 225 %endfor
226 226
227 227 ## outdated comments that do not fit into currently displayed lines
228 228 % for lineno, comments in filediff.left_comments.items():
229 229
230 230 %if c.diffmode == 'unified':
231 231 <tr class="cb-line">
232 232 <td class="cb-data cb-context"></td>
233 233 <td class="cb-lineno cb-context"></td>
234 234 <td class="cb-lineno cb-context"></td>
235 235 <td class="cb-content cb-context">
236 236 ${inline_comments_container(comments)}
237 237 </td>
238 238 </tr>
239 239 %elif c.diffmode == 'sideside':
240 240 <tr class="cb-line">
241 241 <td class="cb-data cb-context"></td>
242 242 <td class="cb-lineno cb-context"></td>
243 243 <td class="cb-content cb-context"></td>
244 244
245 245 <td class="cb-data cb-context"></td>
246 246 <td class="cb-lineno cb-context"></td>
247 247 <td class="cb-content cb-context">
248 248 ${inline_comments_container(comments)}
249 249 </td>
250 250 </tr>
251 251 %endif
252 252
253 253 % endfor
254 254
255 255 </table>
256 256 </div>
257 257 %endfor
258 258
259 259 ## outdated comments that are made for a file that has been deleted
260 260 % for filename, comments_dict in (deleted_files_comments or {}).items():
261 261
262 262 <div class="filediffs filediff-outdated" style="display: none">
263 263 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
264 264 <div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}">
265 265 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
266 266 <div class="filediff-collapse-indicator"></div>
267 267 <span class="pill">
268 268 ## file was deleted
269 269 <strong>${filename}</strong>
270 270 </span>
271 271 <span class="pill-group" style="float: left">
272 272 ## file op, doesn't need translation
273 273 <span class="pill" op="removed">removed in this version</span>
274 274 </span>
275 275 <a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">ΒΆ</a>
276 276 <span class="pill-group" style="float: right">
277 277 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
278 278 </span>
279 279 </label>
280 280
281 281 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
282 282 <tr>
283 283 % if c.diffmode == 'unified':
284 284 <td></td>
285 285 %endif
286 286
287 287 <td></td>
288 288 <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=5'}>
289 289 ${_('File was deleted in this version, and outdated comments were made on it')}
290 290 </td>
291 291 </tr>
292 292 %if c.diffmode == 'unified':
293 293 <tr class="cb-line">
294 294 <td class="cb-data cb-context"></td>
295 295 <td class="cb-lineno cb-context"></td>
296 296 <td class="cb-lineno cb-context"></td>
297 297 <td class="cb-content cb-context">
298 298 ${inline_comments_container(comments_dict['comments'])}
299 299 </td>
300 300 </tr>
301 301 %elif c.diffmode == 'sideside':
302 302 <tr class="cb-line">
303 303 <td class="cb-data cb-context"></td>
304 304 <td class="cb-lineno cb-context"></td>
305 305 <td class="cb-content cb-context"></td>
306 306
307 307 <td class="cb-data cb-context"></td>
308 308 <td class="cb-lineno cb-context"></td>
309 309 <td class="cb-content cb-context">
310 310 ${inline_comments_container(comments_dict['comments'])}
311 311 </td>
312 312 </tr>
313 313 %endif
314 314 </table>
315 315 </div>
316 316 </div>
317 317 % endfor
318 318
319 319 </div>
320 320 </div>
321 321 </%def>
322 322
323 323 <%def name="diff_ops(filediff)">
324 324 <%
325 325 stats = filediff['patch']['stats']
326 326 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
327 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE
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 ## file was renamed
332 ## file was renamed, or copied
333 %if RENAMED_FILENODE in stats['ops']:
333 334 <strong>${filediff.target_file_path}</strong> β¬… <del>${filediff.source_file_path}</del>
335 %elif COPIED_FILENODE in stats['ops']:
336 <strong>${filediff.target_file_path}</strong> β¬… ${filediff.source_file_path}
337 %endif
334 338 %else:
335 339 ## file was modified
336 340 <strong>${filediff.source_file_path}</strong>
337 341 %endif
338 342 %else:
339 343 %if filediff.source_file_path:
340 344 ## file was deleted
341 345 <strong>${filediff.source_file_path}</strong>
342 346 %else:
343 347 ## file was added
344 348 <strong>${filediff.target_file_path}</strong>
345 349 %endif
346 350 %endif
347 351 </span>
348 352 <span class="pill-group" style="float: left">
349 353 %if filediff.patch['is_limited_diff']:
350 354 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
351 355 %endif
356
352 357 %if RENAMED_FILENODE in stats['ops']:
353 358 <span class="pill" op="renamed">renamed</span>
354 359 %endif
355 360
361 %if COPIED_FILENODE in stats['ops']:
362 <span class="pill" op="copied">copied</span>
363 %endif
364
356 365 %if NEW_FILENODE in stats['ops']:
357 366 <span class="pill" op="created">created</span>
358 367 %if filediff['target_mode'].startswith('120'):
359 368 <span class="pill" op="symlink">symlink</span>
360 369 %else:
361 370 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
362 371 %endif
363 372 %endif
364 373
365 374 %if DEL_FILENODE in stats['ops']:
366 375 <span class="pill" op="removed">removed</span>
367 376 %endif
368 377
369 378 %if CHMOD_FILENODE in stats['ops']:
370 379 <span class="pill" op="mode">
371 380 ${nice_mode(filediff['source_mode'])} ➑ ${nice_mode(filediff['target_mode'])}
372 381 </span>
373 382 %endif
374 383 </span>
375 384
376 385 <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a>
377 386
378 387 <span class="pill-group" style="float: right">
379 388 %if BIN_FILENODE in stats['ops']:
380 389 <span class="pill" op="binary">binary</span>
381 390 %if MOD_FILENODE in stats['ops']:
382 391 <span class="pill" op="modified">modified</span>
383 392 %endif
384 393 %endif
385 394 %if stats['added']:
386 395 <span class="pill" op="added">+${stats['added']}</span>
387 396 %endif
388 397 %if stats['deleted']:
389 398 <span class="pill" op="deleted">-${stats['deleted']}</span>
390 399 %endif
391 400 </span>
392 401
393 402 </%def>
394 403
395 404 <%def name="nice_mode(filemode)">
396 405 ${filemode.startswith('100') and filemode[3:] or filemode}
397 406 </%def>
398 407
399 408 <%def name="diff_menu(filediff, use_comments=False)">
400 409 <div class="filediff-menu">
401 410 %if filediff.diffset.source_ref:
402 411 %if filediff.patch['operation'] in ['D', 'M']:
403 412 <a
404 413 class="tooltip"
405 414 href="${h.url('files_home',repo_name=filediff.diffset.repo_name,f_path=filediff.source_file_path,revision=filediff.diffset.source_ref)}"
406 415 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
407 416 >
408 417 ${_('Show file before')}
409 418 </a> |
410 419 %else:
411 420 <span
412 421 class="tooltip"
413 422 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
414 423 >
415 424 ${_('Show file before')}
416 425 </span> |
417 426 %endif
418 427 %if filediff.patch['operation'] in ['A', 'M']:
419 428 <a
420 429 class="tooltip"
421 430 href="${h.url('files_home',repo_name=filediff.diffset.source_repo_name,f_path=filediff.target_file_path,revision=filediff.diffset.target_ref)}"
422 431 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
423 432 >
424 433 ${_('Show file after')}
425 434 </a> |
426 435 %else:
427 436 <span
428 437 class="tooltip"
429 438 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
430 439 >
431 440 ${_('Show file after')}
432 441 </span> |
433 442 %endif
434 443 <a
435 444 class="tooltip"
436 445 title="${h.tooltip(_('Raw diff'))}"
437 446 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')}"
438 447 >
439 448 ${_('Raw diff')}
440 449 </a> |
441 450 <a
442 451 class="tooltip"
443 452 title="${h.tooltip(_('Download diff'))}"
444 453 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')}"
445 454 >
446 455 ${_('Download diff')}
447 456 </a>
448 457 % if use_comments:
449 458 |
450 459 % endif
451 460
452 461 ## 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)
453 462 %if hasattr(c, 'ignorews_url'):
454 463 ${c.ignorews_url(request.GET, h.FID('', filediff['patch']['filename']))}
455 464 %endif
456 465 %if hasattr(c, 'context_url'):
457 466 ${c.context_url(request.GET, h.FID('', filediff['patch']['filename']))}
458 467 %endif
459 468
460 469 %if use_comments:
461 470 <a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
462 471 <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
463 472 </a>
464 473 %endif
465 474 %endif
466 475 </div>
467 476 </%def>
468 477
469 478
470 479 <%def name="inline_comments_container(comments)">
471 480 <div class="inline-comments">
472 481 %for comment in comments:
473 482 ${commentblock.comment_block(comment, inline=True)}
474 483 %endfor
475 484
476 485 % if comments and comments[-1].outdated:
477 486 <span class="btn btn-secondary cb-comment-add-button comment-outdated}"
478 487 style="display: none;}">
479 488 ${_('Add another comment')}
480 489 </span>
481 490 % else:
482 491 <span onclick="return Rhodecode.comments.createComment(this)"
483 492 class="btn btn-secondary cb-comment-add-button">
484 493 ${_('Add another comment')}
485 494 </span>
486 495 % endif
487 496
488 497 </div>
489 498 </%def>
490 499
491 500
492 501 <%def name="render_hunk_lines_sideside(hunk, use_comments=False)">
493 502 %for i, line in enumerate(hunk.sideside):
494 503 <%
495 504 old_line_anchor, new_line_anchor = None, None
496 505 if line.original.lineno:
497 506 old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o')
498 507 if line.modified.lineno:
499 508 new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n')
500 509 %>
501 510
502 511 <tr class="cb-line">
503 512 <td class="cb-data ${action_class(line.original.action)}"
504 513 data-line-number="${line.original.lineno}"
505 514 >
506 515 <div>
507 516 %if line.original.comments:
508 517 <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
509 518 %endif
510 519 </div>
511 520 </td>
512 521 <td class="cb-lineno ${action_class(line.original.action)}"
513 522 data-line-number="${line.original.lineno}"
514 523 %if old_line_anchor:
515 524 id="${old_line_anchor}"
516 525 %endif
517 526 >
518 527 %if line.original.lineno:
519 528 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
520 529 %endif
521 530 </td>
522 531 <td class="cb-content ${action_class(line.original.action)}"
523 532 data-line-number="o${line.original.lineno}"
524 533 >
525 534 %if use_comments and line.original.lineno:
526 535 ${render_add_comment_button()}
527 536 %endif
528 537 <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
529 538 %if use_comments and line.original.lineno and line.original.comments:
530 539 ${inline_comments_container(line.original.comments)}
531 540 %endif
532 541 </td>
533 542 <td class="cb-data ${action_class(line.modified.action)}"
534 543 data-line-number="${line.modified.lineno}"
535 544 >
536 545 <div>
537 546 %if line.modified.comments:
538 547 <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
539 548 %endif
540 549 </div>
541 550 </td>
542 551 <td class="cb-lineno ${action_class(line.modified.action)}"
543 552 data-line-number="${line.modified.lineno}"
544 553 %if new_line_anchor:
545 554 id="${new_line_anchor}"
546 555 %endif
547 556 >
548 557 %if line.modified.lineno:
549 558 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
550 559 %endif
551 560 </td>
552 561 <td class="cb-content ${action_class(line.modified.action)}"
553 562 data-line-number="n${line.modified.lineno}"
554 563 >
555 564 %if use_comments and line.modified.lineno:
556 565 ${render_add_comment_button()}
557 566 %endif
558 567 <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
559 568 %if use_comments and line.modified.lineno and line.modified.comments:
560 569 ${inline_comments_container(line.modified.comments)}
561 570 %endif
562 571 </td>
563 572 </tr>
564 573 %endfor
565 574 </%def>
566 575
567 576
568 577 <%def name="render_hunk_lines_unified(hunk, use_comments=False)">
569 578 %for old_line_no, new_line_no, action, content, comments in hunk.unified:
570 579 <%
571 580 old_line_anchor, new_line_anchor = None, None
572 581 if old_line_no:
573 582 old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, old_line_no, 'o')
574 583 if new_line_no:
575 584 new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, new_line_no, 'n')
576 585 %>
577 586 <tr class="cb-line">
578 587 <td class="cb-data ${action_class(action)}">
579 588 <div>
580 589 %if comments:
581 590 <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
582 591 %endif
583 592 </div>
584 593 </td>
585 594 <td class="cb-lineno ${action_class(action)}"
586 595 data-line-number="${old_line_no}"
587 596 %if old_line_anchor:
588 597 id="${old_line_anchor}"
589 598 %endif
590 599 >
591 600 %if old_line_anchor:
592 601 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
593 602 %endif
594 603 </td>
595 604 <td class="cb-lineno ${action_class(action)}"
596 605 data-line-number="${new_line_no}"
597 606 %if new_line_anchor:
598 607 id="${new_line_anchor}"
599 608 %endif
600 609 >
601 610 %if new_line_anchor:
602 611 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
603 612 %endif
604 613 </td>
605 614 <td class="cb-content ${action_class(action)}"
606 615 data-line-number="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}"
607 616 >
608 617 %if use_comments:
609 618 ${render_add_comment_button()}
610 619 %endif
611 620 <span class="cb-code">${action} ${content or '' | n}</span>
612 621 %if use_comments and comments:
613 622 ${inline_comments_container(comments)}
614 623 %endif
615 624 </td>
616 625 </tr>
617 626 %endfor
618 627 </%def>
619 628
620 629 <%def name="render_add_comment_button()">
621 630 <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
622 631 <span><i class="icon-comment"></i></span>
623 632 </button>
624 633 </%def>
625 634
626 635 <%def name="render_diffset_menu()">
627 636
628 637 <div class="diffset-menu clearinner">
629 638 <div class="pull-right">
630 639 <div class="btn-group">
631 640
632 641 <a
633 642 class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
634 643 title="${_('View side by side')}"
635 644 href="${h.url_replace(diffmode='sideside')}">
636 645 <span>${_('Side by Side')}</span>
637 646 </a>
638 647 <a
639 648 class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
640 649 title="${_('View unified')}" href="${h.url_replace(diffmode='unified')}">
641 650 <span>${_('Unified')}</span>
642 651 </a>
643 652 </div>
644 653 </div>
645 654
646 655 <div class="pull-left">
647 656 <div class="btn-group">
648 657 <a
649 658 class="btn"
650 659 href="#"
651 660 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All Files')}</a>
652 661 <a
653 662 class="btn"
654 663 href="#"
655 664 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All Files')}</a>
656 665 <a
657 666 class="btn"
658 667 href="#"
659 668 onclick="return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a>
660 669 </div>
661 670 </div>
662 671 </div>
663 672 </%def>
General Comments 0
You need to be logged in to leave comments. Login now