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