##// END OF EJS Templates
ux: make the diffset header more pronounced and show commit details...
dan -
r1138:dd921caf default
parent child Browse files
Show More
@@ -1,1006 +1,1039 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 @pill-padding: 2px 7px;
652 652
653 653 input.filediff-collapse-state {
654 654 display: none;
655 655
656 656 &:checked + .filediff { /* file diff is collapsed */
657 657 .cb {
658 658 display: none
659 659 }
660 660 .filediff-collapse-indicator {
661 661 border-width: 9px 0 9px 15.6px;
662 662 border-color: transparent transparent transparent #ccc;
663 663 }
664 664 .filediff-menu {
665 665 display: none;
666 666 }
667 667 margin: -1px 0 0 0;
668 668 }
669 669
670 670 &+ .filediff { /* file diff is expanded */
671 671 .filediff-collapse-indicator {
672 672 border-width: 15.6px 9px 0 9px;
673 673 border-color: #ccc transparent transparent transparent;
674 674 }
675 675 .filediff-menu {
676 676 display: block;
677 677 }
678 678 margin: 20px 0;
679 &:nth-child(2) {
680 margin: 0;
681 }
682 }
683 }
684 .cs_files {
685 clear: both;
686 }
687
688 .diffset-menu {
689 margin-bottom: 20px;
690 }
691 .diffset {
692 margin: 20px auto;
693 .diffset-heading {
694 border: 1px solid @grey5;
695 margin-bottom: -1px;
696 // margin-top: 20px;
697 h2 {
698 margin: 0;
699 line-height: 38px;
700 padding-left: 10px;
701 }
702 .btn {
703 margin: 0;
704 }
705 background: @grey6;
706 display: block;
707 padding: 5px;
708 }
709 .diffset-heading-warning {
710 background: @alert3-inner;
711 border: 1px solid @alert3;
712 }
713 }
714 .pill {
715 display: block;
716 float: left;
717 padding: @pill-padding;
718 }
719 .pill-group {
720 .pill {
721 opacity: .8;
722 &:first-child {
723 border-radius: @border-radius 0 0 @border-radius;
724 }
725 &:last-child {
726 border-radius: 0 @border-radius @border-radius 0;
727 }
728 &:only-child {
729 border-radius: @border-radius;
730 }
679 731 }
680 732 }
681 733 .filediff {
682 734 border: 1px solid @grey5;
683 735
684 736 /* START OVERRIDES */
685 737 .code-highlight {
686 738 border: none; // TODO: remove this border from the global
687 739 // .code-highlight, it doesn't belong there
688 740 }
689 741 label {
690 742 margin: 0; // TODO: remove this margin definition from global label
691 743 // it doesn't belong there - if margin on labels
692 744 // are needed for a form they should be defined
693 745 // in the form's class
694 746 }
695 747 /* END OVERRIDES */
696 748
697 749 * {
698 750 box-sizing: border-box;
699 751 }
700 752 .filediff-anchor {
701 753 visibility: hidden;
702 754 }
703 755 &:hover {
704 756 .filediff-anchor {
705 757 visibility: visible;
706 758 }
707 759 }
708 760
709 761 .filediff-collapse-indicator {
710 762 width: 0;
711 763 height: 0;
712 764 border-style: solid;
713 765 float: left;
714 766 margin: 2px 2px 0 0;
715 767 cursor: pointer;
716 768 }
717 769
718 770 .filediff-heading {
719 771 background: @grey7;
720 772 cursor: pointer;
721 773 display: block;
722 774 padding: 5px 10px;
723 775 }
724 776 .filediff-heading:after {
725 777 content: "";
726 778 display: table;
727 779 clear: both;
728 780 }
729 781 .filediff-heading:hover {
730 782 background: #e1e9f4 !important;
731 783 }
732 784
733 785 .filediff-menu {
734 786 float: right;
735 787
736 788 a, span {
737 789 padding: 5px;
738 790 display: block;
739 791 float: left
740 792 }
741 793 }
742 794 .pill {
743 display: block;
744 float: left;
745 padding: @pill-padding;
746 }
747 .pill-group {
748 .pill {
749 opacity: .8;
750 &:first-child {
751 border-radius: @border-radius 0 0 @border-radius;
752 }
753 &:last-child {
754 border-radius: 0 @border-radius @border-radius 0;
755 }
756 &:only-child {
757 border-radius: @border-radius;
758 }
759 }
760 }
761 .pill {
762 795 &[op="name"] {
763 796 background: none;
764 797 color: @grey2;
765 798 opacity: 1;
766 799 color: white;
767 800 }
768 801 &[op="limited"] {
769 802 background: @grey2;
770 803 color: white;
771 804 }
772 805 &[op="binary"] {
773 806 background: @color7;
774 807 color: white;
775 808 }
776 809 &[op="modified"] {
777 810 background: @alert1;
778 811 color: white;
779 812 }
780 813 &[op="renamed"] {
781 814 background: @color4;
782 815 color: white;
783 816 }
784 817 &[op="mode"] {
785 818 background: @grey3;
786 819 color: white;
787 820 }
788 821 &[op="symlink"] {
789 822 background: @color8;
790 823 color: white;
791 824 }
792 825
793 826 &[op="added"] { /* added lines */
794 827 background: @alert1;
795 828 color: white;
796 829 }
797 830 &[op="deleted"] { /* deleted lines */
798 831 background: @alert2;
799 832 color: white;
800 833 }
801 834
802 835 &[op="created"] { /* created file */
803 836 background: @alert1;
804 837 color: white;
805 838 }
806 839 &[op="removed"] { /* deleted file */
807 840 background: @color5;
808 841 color: white;
809 842 }
810 843 }
811 844
812 845 .filediff-collapse-button, .filediff-expand-button {
813 846 cursor: pointer;
814 847 }
815 848 .filediff-collapse-button {
816 849 display: inline;
817 850 }
818 851 .filediff-expand-button {
819 852 display: none;
820 853 }
821 854 .filediff-collapsed .filediff-collapse-button {
822 855 display: none;
823 856 }
824 857 .filediff-collapsed .filediff-expand-button {
825 858 display: inline;
826 859 }
827 860 }
828 861 table.cb {
829 862 width: 100%;
830 863 border-collapse: collapse;
831 864
832 865 .cb-text {
833 866 padding: @cb-text-padding;
834 867 }
835 868 .cb-hunk {
836 869 padding: @cb-text-padding;
837 870 }
838 871 .cb-expand {
839 872 display: none;
840 873 }
841 874 .cb-collapse {
842 875 display: inline;
843 876 }
844 877 &.cb-collapsed {
845 878 .cb-line {
846 879 display: none;
847 880 }
848 881 .cb-expand {
849 882 display: inline;
850 883 }
851 884 .cb-collapse {
852 885 display: none;
853 886 }
854 887 }
855 888
856 889 /* intentionally general selector since .cb-line-selected must override it
857 890 and they both use !important since the td itself may have a random color
858 891 generated by annotation blocks. TLDR: if you change it, make sure
859 892 annotated block selection and line selection in file view still work */
860 893 .cb-line-fresh .cb-content {
861 894 background: white !important;
862 895 }
863 896 .cb-warning {
864 897 background: #fff4dd;
865 898 }
866 899
867 900 &.cb-diff-sideside {
868 901 td {
869 902 &.cb-content {
870 903 width: 50%;
871 904 }
872 905 }
873 906 }
874 907
875 908 tr {
876 909 &.cb-annotate {
877 910 border-top: 1px solid #eee;
878 911
879 912 &+ .cb-line {
880 913 border-top: 1px solid #eee;
881 914 }
882 915
883 916 &:first-child {
884 917 border-top: none;
885 918 &+ .cb-line {
886 919 border-top: none;
887 920 }
888 921 }
889 922 }
890 923
891 924 &.cb-hunk {
892 925 font-family: @font-family-monospace;
893 926 color: rgba(0, 0, 0, 0.3);
894 927
895 928 td {
896 929 &:first-child {
897 930 background: #edf2f9;
898 931 }
899 932 &:last-child {
900 933 background: #f4f7fb;
901 934 }
902 935 }
903 936 }
904 937 }
905 938
906 939 td {
907 940 vertical-align: top;
908 941 padding: 0;
909 942
910 943 &.cb-content {
911 944 font-size: 12.35px;
912 945
913 946 &.cb-line-selected .cb-code {
914 947 background: @comment-highlight-color !important;
915 948 }
916 949
917 950 span.cb-code {
918 951 line-height: @cb-line-height;
919 952 padding-left: @cb-line-code-padding;
920 953 padding-right: @cb-line-code-padding;
921 954 display: block;
922 955 white-space: pre-wrap;
923 956 font-family: @font-family-monospace;
924 957 word-break: break-word;
925 958 }
926 959 }
927 960
928 961 &.cb-lineno {
929 962 padding: 0;
930 963 width: 50px;
931 964 color: rgba(0, 0, 0, 0.3);
932 965 text-align: right;
933 966 border-right: 1px solid #eee;
934 967 font-family: @font-family-monospace;
935 968
936 969 a::before {
937 970 content: attr(data-line-no);
938 971 }
939 972 &.cb-line-selected a {
940 973 background: @comment-highlight-color !important;
941 974 }
942 975
943 976 a {
944 977 display: block;
945 978 padding-right: @cb-line-code-padding;
946 979 padding-left: @cb-line-code-padding;
947 980 line-height: @cb-line-height;
948 981 color: rgba(0, 0, 0, 0.3);
949 982 }
950 983 }
951 984
952 985 &.cb-empty {
953 986 background: @grey7;
954 987 }
955 988
956 989 ins {
957 990 color: black;
958 991 background: #a6f3a6;
959 992 text-decoration: none;
960 993 }
961 994 del {
962 995 color: black;
963 996 background: #f8cbcb;
964 997 text-decoration: none;
965 998 }
966 999 &.cb-addition {
967 1000 background: #ecffec;
968 1001
969 1002 &.blob-lineno {
970 1003 background: #ddffdd;
971 1004 }
972 1005 }
973 1006 &.cb-deletion {
974 1007 background: #ffecec;
975 1008
976 1009 &.blob-lineno {
977 1010 background: #ffdddd;
978 1011 }
979 1012 }
980 1013
981 1014 &.cb-annotate-info {
982 1015 width: 320px;
983 1016 min-width: 320px;
984 1017 max-width: 320px;
985 1018 padding: 5px 2px;
986 1019 font-size: 13px;
987 1020
988 1021 strong.cb-annotate-message {
989 1022 padding: 5px 0;
990 1023 white-space: pre-line;
991 1024 display: inline-block;
992 1025 }
993 1026 .rc-user {
994 1027 float: none;
995 1028 padding: 0 6px 0 17px;
996 1029 min-width: auto;
997 1030 min-height: auto;
998 1031 }
999 1032 }
1000 1033
1001 1034 &.cb-annotate-revision {
1002 1035 cursor: pointer;
1003 1036 text-align: right;
1004 1037 }
1005 1038 }
1006 1039 }
@@ -1,78 +1,85 b''
1 1 //--- RESETS ---//
2 2 :focus { outline: none; }
3 3 a { cursor: pointer; }
4 4
5 5 //--- clearfix --//
6 6 .clearfix {
7 7 &:before,
8 8 &:after {
9 9 content:"";
10 10 width: 100%;
11 11 clear: both;
12 12 float: left;
13 13 }
14 14 }
15 15
16 .clearinner:after { /* clears all floating divs inside a block */
17 content: "";
18 display: table;
19 clear: both;
20 }
21
22
16 23 .linebreak {
17 24 display: block;
18 25 }
19 26
20 27 .pull-right {
21 28 float: right !important;
22 29 }
23 30
24 31 .pull-left {
25 32 float: left !important;
26 33 }
27 34
28 35 .block-left {
29 36 float: left;
30 37 }
31 38
32 39 .block-right {
33 40 float: right;
34 41 clear: right;
35 42
36 43 li:before { content:none; }
37 44 }
38 45
39 46 //--- DEVICE-SPECIFIC CLASSES ---------------//
40 47 //regular tablet and up
41 48 @media (min-width:768px) {
42 49 .no-mobile {
43 50 display: block;
44 51 }
45 52 .mobile-only {
46 53 display: none;
47 54 }
48 55 }
49 56 //small tablet and phone
50 57 @media (max-width:767px) {
51 58 .mobile-only {
52 59 display: block;
53 60 }
54 61 .no-mobile {
55 62 display: none;
56 63 }
57 64 }
58 65
59 66 //--- STICKY FOOTER ---//
60 67 html, body {
61 68 height: 100%;
62 69 margin: 0;
63 70 }
64 71 .outerwrapper {
65 72 height: 100%;
66 73 min-height: 100%;
67 74 margin: 0;
68 75 padding-bottom: 3em; /* must be equal to footer height */
69 76 }
70 77 .outerwrapper:after{
71 78 content:" ";
72 79 }
73 80 #footer {
74 81 clear: both;
75 82 position: relative;
76 83 height: 3em; /* footer height */
77 84 margin: -3em 0 0; /* must be equal to footer height */
78 85 }
@@ -1,404 +1,420 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 <%def name="render_diffset(diffset, commit_id=None,
26 <%def name="render_diffset(diffset, commit=None,
27 27
28 28 # collapse all file diff entries when there are more than this amount of files in the diff
29 29 collapse_when_files_over=20,
30 30
31 31 # collapse lines in the diff when more than this amount of lines changed in the file diff
32 32 lines_changed_limit=500,
33 33
34 34 # add a ruler at to the output
35 35 ruler_at_chars=0,
36
36 37 )">
37 38 <%
38 39 collapse_all = len(diffset.files) > collapse_when_files_over
39 40 %>
40 41
41 42 %if c.diffmode == 'sideside':
42 43 <style>
43 44 .wrapper {
44 45 max-width: 1600px !important;
45 46 }
46 47 </style>
47 48 %endif
48 49 %if ruler_at_chars:
49 50 <style>
50 51 .diff table.cb .cb-content:after {
51 52 content: "";
52 53 border-left: 1px solid blue;
53 54 position: absolute;
54 55 top: 0;
55 56 height: 18px;
56 57 opacity: .2;
57 58 z-index: 10;
58 59 ## +5 to account for diff action (+/-)
59 60 left: ${ruler_at_chars + 5}ch;
60 61 </style>
61 62 %endif
62 % if diffset.limited_diff:
63 <div class="alert alert-warning">
64 ${_('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>
65 </div>
66 % endif
67 63
68 64 <div class="diffset">
69 <div class="diffset-heading">
70 <div class="pull-right">
71 <div class="btn-group">
72 <a
73 class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
74 title="${_('View side by side')}"
75 href="${h.url_replace(diffmode='sideside')}">
76 <span>${_('Side by Side')}</span>
77 </a>
78 <a
79 class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
80 title="${_('View unified')}" href="${h.url_replace(diffmode='unified')}">
81 <span>${_('Unified')}</span>
65 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
66 %if commit:
67 <div class="pull-right">
68 <a class="btn tooltip" title="${_('Browse Files at revision {}').format(commit.raw_id)}" href="${h.url('files_home',repo_name=c.repo_name, revision=commit.raw_id, f_path='')}">
69 ${_('Browse Files')}
82 70 </a>
83 71 </div>
84 </div>
85 <div class="pull-left">
86 <div class="btn-group">
87 <a
88 class="btn"
89 href="#"
90 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All')}</a>
91 <a
92 class="btn"
93 href="#"
94 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All')}</a>
95 </div>
96 </div>
97 <h2 style="padding: 5px; text-align: center;">
72 %endif
73 <h2 class="clearinner">
74 %if commit:
75 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">${'r%s:%s' % (commit.revision,h.short_id(commit.raw_id))}</a> -
76 ${h.age_component(commit.date)} -
77 %endif
98 78 %if diffset.limited_diff:
99 ${ungettext('%(num)s file changed', '%(num)s files changed', diffset.changed_files) % {'num': diffset.changed_files}}
79 ${_('The requested commit is too big and content was truncated.')}
80
81 ${ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
82 <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
100 83 %else:
101 84 ${ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
102 85 '%(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}}
103 86 %endif
104 87 </h2>
105 88 </div>
106 89
107 90 %if not diffset.files:
108 91 <p class="empty_data">${_('No files')}</p>
109 92 %endif
110 93
111 94 <div class="filediffs">
112 95 %for i, filediff in enumerate(diffset.files):
113 96 <%
114 97 lines_changed = filediff['patch']['stats']['added'] + filediff['patch']['stats']['deleted']
115 98 over_lines_changed_limit = lines_changed > lines_changed_limit
116 99 %>
117 100 <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
118 101 <div
119 102 class="filediff"
120 103 data-f-path="${filediff['patch']['filename']}"
121 id="a_${h.FID(commit_id or '', filediff['patch']['filename'])}">
104 id="a_${h.FID(commit and commit.raw_id or '', filediff['patch']['filename'])}">
122 105 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
123 106 <div class="filediff-collapse-indicator"></div>
124 107 ${diff_ops(filediff)}
125 108 </label>
126 109 ${diff_menu(filediff)}
127 110 <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
128 111 %if not filediff.hunks:
129 112 %for op_id, op_text in filediff['patch']['stats']['ops'].items():
130 113 <tr>
131 114 <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=3' or 'colspan=4'}>
132 115 %if op_id == DEL_FILENODE:
133 116 ${_('File was deleted')}
134 117 %elif op_id == BIN_FILENODE:
135 118 ${_('Binary file hidden')}
136 119 %else:
137 120 ${op_text}
138 121 %endif
139 122 </td>
140 123 </tr>
141 124 %endfor
142 125 %endif
143 126 %if over_lines_changed_limit:
144 127 <tr class="cb-warning cb-collapser">
145 128 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=3' or 'colspan=4'}>
146 129 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
147 130 <a href="#" class="cb-expand"
148 131 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
149 132 </a>
150 133 <a href="#" class="cb-collapse"
151 134 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
152 135 </a>
153 136 </td>
154 137 </tr>
155 138 %endif
156 139 %if filediff.patch['is_limited_diff']:
157 140 <tr class="cb-warning cb-collapser">
158 141 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=3' or 'colspan=4'}>
159 142 ${_('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>
160 143 </td>
161 144 </tr>
162 145 %endif
163 146 %for hunk in filediff.hunks:
164 147 <tr class="cb-hunk">
165 148 <td ${c.diffmode == 'unified' and 'colspan=2' or ''}>
166 149 ## TODO: dan: add ajax loading of more context here
167 150 ## <a href="#">
168 151 <i class="icon-more"></i>
169 152 ## </a>
170 153 </td>
171 154 <td ${c.diffmode == 'sideside' and 'colspan=3' or ''}>
172 155 @@
173 156 -${hunk.source_start},${hunk.source_length}
174 157 +${hunk.target_start},${hunk.target_length}
175 158 ${hunk.section_header}
176 159 </td>
177 160 </tr>
178 161 %if c.diffmode == 'unified':
179 162 ${render_hunk_lines_unified(hunk)}
180 163 %elif c.diffmode == 'sideside':
181 164 ${render_hunk_lines_sideside(hunk)}
182 165 %else:
183 166 <tr class="cb-line">
184 167 <td>unknown diff mode</td>
185 168 </tr>
186 169 %endif
187 170 %endfor
188 171 </table>
189 172 </div>
190 173 %endfor
191 174 </div>
192 175 </div>
193 176 </%def>
194 177
195 178 <%def name="diff_ops(filediff)">
196 179 <%
197 180 stats = filediff['patch']['stats']
198 181 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
199 182 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE
200 183 %>
201 184 <span class="pill">
202 185 %if filediff.source_file_path and filediff.target_file_path:
203 186 %if filediff.source_file_path != filediff.target_file_path: # file was renamed
204 187 <strong>${filediff.target_file_path}</strong> β¬… <del>${filediff.source_file_path}</del>
205 188 %else:
206 189 ## file was modified
207 190 <strong>${filediff.source_file_path}</strong>
208 191 %endif
209 192 %else:
210 193 %if filediff.source_file_path:
211 194 ## file was deleted
212 195 <strong>${filediff.source_file_path}</strong>
213 196 %else:
214 197 ## file was added
215 198 <strong>${filediff.target_file_path}</strong>
216 199 %endif
217 200 %endif
218 201 </span>
219 202 <span class="pill-group" style="float: left">
220 203 %if filediff.patch['is_limited_diff']:
221 204 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
222 205 %endif
223 206 %if RENAMED_FILENODE in stats['ops']:
224 207 <span class="pill" op="renamed">renamed</span>
225 208 %endif
226 209
227 210 %if NEW_FILENODE in stats['ops']:
228 211 <span class="pill" op="created">created</span>
229 212 %if filediff['target_mode'].startswith('120'):
230 213 <span class="pill" op="symlink">symlink</span>
231 214 %else:
232 215 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
233 216 %endif
234 217 %endif
235 218
236 219 %if DEL_FILENODE in stats['ops']:
237 220 <span class="pill" op="removed">removed</span>
238 221 %endif
239 222
240 223 %if CHMOD_FILENODE in stats['ops']:
241 224 <span class="pill" op="mode">
242 225 ${nice_mode(filediff['source_mode'])} ➑ ${nice_mode(filediff['target_mode'])}
243 226 </span>
244 227 %endif
245 228 </span>
246 229
247 <a class="pill filediff-anchor" href="#a_${h.FID(commit_id or '', filediff.patch['filename'])}">ΒΆ</a>
230 <a class="pill filediff-anchor" href="#a_${h.FID(commit and commit.raw_id or '', filediff.patch['filename'])}">ΒΆ</a>
248 231
249 232 <span class="pill-group" style="float: right">
250 233 %if BIN_FILENODE in stats['ops']:
251 234 <span class="pill" op="binary">binary</span>
252 235 %if MOD_FILENODE in stats['ops']:
253 236 <span class="pill" op="modified">modified</span>
254 237 %endif
255 238 %endif
256 239 %if stats['added']:
257 240 <span class="pill" op="added">+${stats['added']}</span>
258 241 %endif
259 242 %if stats['deleted']:
260 243 <span class="pill" op="deleted">-${stats['deleted']}</span>
261 244 %endif
262 245 </span>
263 246
264 247 </%def>
265 248
266 249 <%def name="nice_mode(filemode)">
267 250 ${filemode.startswith('100') and filemode[3:] or filemode}
268 251 </%def>
269 252
270 253 <%def name="diff_menu(filediff)">
271 254 <div class="filediff-menu">
272 255 %if filediff.diffset.source_ref:
273 256 %if filediff.patch['operation'] in ['D', 'M']:
274 257 <a
275 258 class="tooltip"
276 259 href="${h.url('files_home',repo_name=c.repo_name,f_path=filediff.source_file_path,revision=filediff.diffset.source_ref)}"
277 260 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
278 261 >
279 262 ${_('Show file before')}
280 263 </a>
281 264 %else:
282 265 <span
283 266 class="tooltip"
284 267 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
285 268 >
286 269 ${_('Show file before')}
287 270 </span>
288 271 %endif
289 272 %if filediff.patch['operation'] in ['A', 'M']:
290 273 <a
291 274 class="tooltip"
292 275 href="${h.url('files_home',repo_name=c.repo_name,f_path=filediff.target_file_path,revision=filediff.diffset.target_ref)}"
293 276 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
294 277 >
295 278 ${_('Show file after')}
296 279 </a>
297 280 %else:
298 281 <span
299 282 class="tooltip"
300 283 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
301 284 >
302 285 ${_('Show file after')}
303 286 </span>
304 287 %endif
305 288 <a
306 289 class="tooltip"
307 290 title="${h.tooltip(_('Raw diff'))}"
308 291 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')}"
309 292 >
310 293 ${_('Raw diff')}
311 294 </a>
312 295 <a
313 296 class="tooltip"
314 297 title="${h.tooltip(_('Download diff'))}"
315 298 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')}"
316 299 >
317 300 ${_('Download diff')}
318 301 </a>
319 302 %endif
320 303 </div>
321 304 </%def>
322 305
323 306
324 307 <%def name="render_hunk_lines_sideside(hunk)">
325 308 %for i, line in enumerate(hunk.sideside):
326 309 <%
327 310 old_line_anchor, new_line_anchor = None, None
328 311 if line.original.lineno:
329 312 old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o')
330 313 if line.modified.lineno:
331 314 new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n')
332 315 %>
333 316 <tr class="cb-line">
334 317 <td class="cb-lineno ${action_class(line.original.action)}"
335 318 data-line-number="${line.original.lineno}"
336 319 %if old_line_anchor:
337 320 id="${old_line_anchor}"
338 321 %endif
339 322 >
340 323 %if line.original.lineno:
341 324 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
342 325 %endif
343 326 </td>
344 327 <td class="cb-content ${action_class(line.original.action)}"
345 328 data-line-number="o${line.original.lineno}"
346 329 ><span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
347 330 </td>
348 331 <td class="cb-lineno ${action_class(line.modified.action)}"
349 332 data-line-number="${line.modified.lineno}"
350 333 %if new_line_anchor:
351 334 id="${new_line_anchor}"
352 335 %endif
353 336 >
354 337 %if line.modified.lineno:
355 338 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
356 339 %endif
357 340 </td>
358 341 <td class="cb-content ${action_class(line.modified.action)}"
359 342 data-line-number="n${line.modified.lineno}"
360 343 >
361 344 <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
362 345 </td>
363 346 </tr>
364 347 %endfor
365 348 </%def>
366 349
367 350
368 351 <%def name="render_hunk_lines_unified(hunk)">
369 352 %for old_line_no, new_line_no, action, content in hunk.unified:
370 353 <%
371 354 old_line_anchor, new_line_anchor = None, None
372 355 if old_line_no:
373 356 old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, old_line_no, 'o')
374 357 if new_line_no:
375 358 new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, new_line_no, 'n')
376 359 %>
377 360 <tr class="cb-line">
378 361 <td class="cb-lineno ${action_class(action)}"
379 362 data-line-number="${old_line_no}"
380 363 %if old_line_anchor:
381 364 id="${old_line_anchor}"
382 365 %endif
383 366 >
384 367 %if old_line_anchor:
385 368 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
386 369 %endif
387 370 </td>
388 371 <td class="cb-lineno ${action_class(action)}"
389 372 data-line-number="${new_line_no}"
390 373 %if new_line_anchor:
391 374 id="${new_line_anchor}"
392 375 %endif
393 376 >
394 377 %if new_line_anchor:
395 378 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
396 379 %endif
397 380 </td>
398 381 <td class="cb-content ${action_class(action)}"
399 382 data-line-number="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}"
400 383 ><span class="cb-code">${action} ${content or '' | n}</span>
401 384 </td>
402 385 </tr>
403 386 %endfor
404 387 </%def>
388
389
390 <%def name="render_diffset_menu()">
391 <div class="diffset-menu clearinner">
392 <div class="pull-right">
393 <div class="btn-group">
394 <a
395 class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip"
396 title="${_('View side by side')}"
397 href="${h.url_replace(diffmode='sideside')}">
398 <span>${_('Side by Side')}</span>
399 </a>
400 <a
401 class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip"
402 title="${_('View unified')}" href="${h.url_replace(diffmode='unified')}">
403 <span>${_('Unified')}</span>
404 </a>
405 </div>
406 </div>
407 <div class="pull-left">
408 <div class="btn-group">
409 <a
410 class="btn"
411 href="#"
412 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All')}</a>
413 <a
414 class="btn"
415 href="#"
416 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All')}</a>
417 </div>
418 </div>
419 </div>
420 </%def> No newline at end of file
@@ -1,258 +1,259 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3 <%namespace name="cbdiffs" file="/codeblocks/diffs.html"/>
4 4
5 5 <%def name="title()">
6 6 %if c.compare_home:
7 7 ${_('%s Compare') % c.repo_name}
8 8 %else:
9 9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
10 10 %endif
11 11 %if c.rhodecode_name:
12 12 &middot; ${h.branding(c.rhodecode_name)}
13 13 %endif
14 14 </%def>
15 15
16 16 <%def name="breadcrumbs_links()">
17 17 ${ungettext('%s commit','%s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
18 18 </%def>
19 19
20 20 <%def name="menu_bar_nav()">
21 21 ${self.menu_items(active='repositories')}
22 22 </%def>
23 23
24 24 <%def name="menu_bar_subnav()">
25 25 ${self.repo_menu(active='compare')}
26 26 </%def>
27 27
28 28 <%def name="main()">
29 29 <script type="text/javascript">
30 30 // set fake commitId on this commit-range page
31 31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
32 32 </script>
33 33
34 34 <div class="box">
35 35 <div class="title">
36 36 ${self.repo_page_title(c.rhodecode_db_repo)}
37 37 <div class="breadcrumbs">
38 38 ${_('Compare Commits')}
39 39 </div>
40 40 </div>
41 41
42 42 <div class="table">
43 43 <div id="codeblock" class="diffblock">
44 44 <div class="code-header" >
45 45 <div class="compare_header">
46 46 ## The hidden elements are replaced with a select2 widget
47 47 <div class="compare-label">${_('Target')}</div>${h.hidden('compare_source')}
48 48 <div class="compare-label">${_('Source')}</div>${h.hidden('compare_target')}
49 49
50 50 %if not c.preview_mode:
51 51 <div class="compare-label"></div>
52 52 <div class="compare-buttons">
53 53 %if not c.compare_home:
54 54 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}"><i class="icon-refresh"></i> ${_('Swap')}</a>
55 55 %endif
56 56 <div id="compare_revs" class="btn btn-primary"><i class ="icon-loop"></i> ${_('Compare Commits')}</div>
57 57 %if c.diffset and c.diffset.files:
58 58 <div id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</div>
59 59 %endif
60 60 </div>
61 61 %endif
62 62 </div>
63 63 </div>
64 64 </div>
65 65 ## use JS script to load it quickly before potentially large diffs render long time
66 66 ## this prevents from situation when large diffs block rendering of select2 fields
67 67 <script type="text/javascript">
68 68
69 69 var cache = {};
70 70
71 71 var formatSelection = function(repoName){
72 72 return function(data, container, escapeMarkup) {
73 73 var selection = data ? this.text(data) : "";
74 74 return escapeMarkup('{0}@{1}'.format(repoName, selection));
75 75 }
76 76 };
77 77
78 78 var feedCompareData = function(query, cachedValue){
79 79 var data = {results: []};
80 80 //filter results
81 81 $.each(cachedValue.results, function() {
82 82 var section = this.text;
83 83 var children = [];
84 84 $.each(this.children, function() {
85 85 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
86 86 children.push({
87 87 'id': this.id,
88 88 'text': this.text,
89 89 'type': this.type
90 90 })
91 91 }
92 92 });
93 93 data.results.push({
94 94 'text': section,
95 95 'children': children
96 96 })
97 97 });
98 98 //push the typed in changeset
99 99 data.results.push({
100 100 'text': _gettext('specify commit'),
101 101 'children': [{
102 102 'id': query.term,
103 103 'text': query.term,
104 104 'type': 'rev'
105 105 }]
106 106 });
107 107 query.callback(data);
108 108 };
109 109
110 110 var loadCompareData = function(repoName, query, cache){
111 111 $.ajax({
112 112 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
113 113 data: {},
114 114 dataType: 'json',
115 115 type: 'GET',
116 116 success: function(data) {
117 117 cache[repoName] = data;
118 118 query.callback({results: data.results});
119 119 }
120 120 })
121 121 };
122 122
123 123 var enable_fields = ${"false" if c.preview_mode else "true"};
124 124 $("#compare_source").select2({
125 125 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
126 126 containerCssClass: "drop-menu",
127 127 dropdownCssClass: "drop-menu-dropdown",
128 128 formatSelection: formatSelection("${c.source_repo.repo_name}"),
129 129 dropdownAutoWidth: true,
130 130 query: function(query) {
131 131 var repoName = '${c.source_repo.repo_name}';
132 132 var cachedValue = cache[repoName];
133 133
134 134 if (cachedValue){
135 135 feedCompareData(query, cachedValue);
136 136 }
137 137 else {
138 138 loadCompareData(repoName, query, cache);
139 139 }
140 140 }
141 141 }).select2("enable", enable_fields);
142 142
143 143 $("#compare_target").select2({
144 144 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
145 145 dropdownAutoWidth: true,
146 146 containerCssClass: "drop-menu",
147 147 dropdownCssClass: "drop-menu-dropdown",
148 148 formatSelection: formatSelection("${c.target_repo.repo_name}"),
149 149 query: function(query) {
150 150 var repoName = '${c.target_repo.repo_name}';
151 151 var cachedValue = cache[repoName];
152 152
153 153 if (cachedValue){
154 154 feedCompareData(query, cachedValue);
155 155 }
156 156 else {
157 157 loadCompareData(repoName, query, cache);
158 158 }
159 159 }
160 160 }).select2("enable", enable_fields);
161 161 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
162 162 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
163 163
164 164 $('#compare_revs').on('click', function(e) {
165 165 var source = $('#compare_source').select2('data') || initial_compare_source;
166 166 var target = $('#compare_target').select2('data') || initial_compare_target;
167 167 if (source && target) {
168 168 var url_data = {
169 169 repo_name: "${c.repo_name}",
170 170 source_ref: source.id,
171 171 source_ref_type: source.type,
172 172 target_ref: target.id,
173 173 target_ref_type: target.type
174 174 };
175 175 window.location = pyroutes.url('compare_url', url_data);
176 176 }
177 177 });
178 178 $('#compare_changeset_status_toggle').on('click', function(e) {
179 179 $('#compare_changeset_status').toggle();
180 180 });
181 181
182 182 </script>
183 183
184 184 ## changeset status form
185 185 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
186 186 ## main comment form and it status
187 187 <%
188 188 def revs(_revs):
189 189 form_inputs = []
190 190 for cs in _revs:
191 191 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
192 192 form_inputs.append(tmpl)
193 193 return form_inputs
194 194 %>
195 195 <div id="compare_changeset_status" style="display: none;">
196 196 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
197 197 <script type="text/javascript">
198 198
199 199 mainCommentForm.setHandleFormSubmit(function(o) {
200 200 var text = mainCommentForm.cm.getValue();
201 201 var status = mainCommentForm.getCommentStatus();
202 202
203 203 if (text === "" && !status) {
204 204 return;
205 205 }
206 206
207 207 // we can pick which commits we want to make the comment by
208 208 // selecting them via click on preview pane, this will alter the hidden inputs
209 209 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
210 210
211 211 var commitIds = [];
212 212 $('#changeset_compare_view_content .compare_select').each(function(el) {
213 213 var commitId = this.id.replace('row-', '');
214 214 if ($(this).hasClass('hl') || !cherryPicked) {
215 215 $("input[data-commit-id='{0}']".format(commitId)).val(commitId)
216 216 commitIds.push(commitId);
217 217 } else {
218 218 $("input[data-commit-id='{0}']".format(commitId)).val('')
219 219 }
220 220 });
221 221
222 222 mainCommentForm.setActionButtonsDisabled(true);
223 223 mainCommentForm.cm.setOption("readOnly", true);
224 224 var postData = {
225 225 'text': text,
226 226 'changeset_status': status,
227 227 'commit_ids': commitIds,
228 228 'csrf_token': CSRF_TOKEN
229 229 };
230 230
231 231 var submitSuccessCallback = function(o) {
232 232 location.reload(true);
233 233 };
234 234 var submitFailCallback = function(){
235 235 mainCommentForm.resetCommentFormState(text)
236 236 };
237 237 mainCommentForm.submitAjaxPOST(
238 238 mainCommentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
239 239 });
240 240 </script>
241 241
242 242 </div>
243 243
244 244 %if c.compare_home:
245 245 <div id="changeset_compare_view_content">
246 246 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
247 247 </div>
248 248 %else:
249 249 <div id="changeset_compare_view_content">
250 250 ##CS
251 251 <%include file="compare_commits.html"/>
252 ${cbdiffs.render_diffset_menu()}
252 253 ${cbdiffs.render_diffset(c.diffset)}
253 254 </div>
254 255 %endif
255 256 </div>
256 257 </div>
257 258 </div>
258 259 </%def>
General Comments 0
You need to be logged in to leave comments. Login now