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