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