##// END OF EJS Templates
comments: made few UI changes/improvements for how we show comments status, ribbons and general comment data.
marcink -
r4411:569617be default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,1322 +1,1326 b''
1 1 // Default styles
2 2
3 3 .diff-collapse {
4 4 margin: @padding 0;
5 5 text-align: right;
6 6 }
7 7
8 8 .diff-container {
9 9 margin-bottom: @space;
10 10
11 11 .diffblock {
12 12 margin-bottom: @space;
13 13 }
14 14
15 15 &.hidden {
16 16 display: none;
17 17 overflow: hidden;
18 18 }
19 19 }
20 20
21 21
22 22 div.diffblock .sidebyside {
23 23 background: #ffffff;
24 24 }
25 25
26 26 div.diffblock {
27 27 overflow-x: auto;
28 28 overflow-y: hidden;
29 29 clear: both;
30 30 padding: 0px;
31 31 background: @grey6;
32 32 border: @border-thickness solid @grey5;
33 33 -webkit-border-radius: @border-radius @border-radius 0px 0px;
34 34 border-radius: @border-radius @border-radius 0px 0px;
35 35
36 36
37 37 .comments-number {
38 38 float: right;
39 39 }
40 40
41 41 // BEGIN CODE-HEADER STYLES
42 42
43 43 .code-header {
44 44 background: @grey6;
45 45 padding: 10px 0 10px 0;
46 46 height: auto;
47 47 width: 100%;
48 48
49 49 .hash {
50 50 float: left;
51 51 padding: 2px 0 0 2px;
52 52 }
53 53
54 54 .date {
55 55 float: left;
56 56 text-transform: uppercase;
57 57 padding: 4px 0px 0px 2px;
58 58 }
59 59
60 60 div {
61 61 margin-left: 4px;
62 62 }
63 63
64 64 div.compare_header {
65 65 min-height: 40px;
66 66 margin: 0;
67 67 padding: 0 @padding;
68 68
69 69 .drop-menu {
70 70 float:left;
71 71 display: block;
72 72 margin:0 0 @padding 0;
73 73 }
74 74
75 75 .compare-label {
76 76 float: left;
77 77 clear: both;
78 78 display: inline-block;
79 79 min-width: 5em;
80 80 margin: 0;
81 81 padding: @button-padding @button-padding @button-padding 0;
82 82 font-weight: @text-semibold-weight;
83 83 font-family: @text-semibold;
84 84 }
85 85
86 86 .compare-buttons {
87 87 float: left;
88 88 margin: 0;
89 89 padding: 0 0 @padding;
90 90
91 91 .btn {
92 92 margin: 0 @padding 0 0;
93 93 }
94 94 }
95 95 }
96 96
97 97 }
98 98
99 99 .parents {
100 100 float: left;
101 101 width: 100px;
102 102 font-weight: 400;
103 103 vertical-align: middle;
104 104 padding: 0px 2px 0px 2px;
105 105 background-color: @grey6;
106 106
107 107 #parent_link {
108 108 margin: 00px 2px;
109 109
110 110 &.double {
111 111 margin: 0px 2px;
112 112 }
113 113
114 114 &.disabled{
115 115 margin-right: @padding;
116 116 }
117 117 }
118 118 }
119 119
120 120 .children {
121 121 float: right;
122 122 width: 100px;
123 123 font-weight: 400;
124 124 vertical-align: middle;
125 125 text-align: right;
126 126 padding: 0px 2px 0px 2px;
127 127 background-color: @grey6;
128 128
129 129 #child_link {
130 130 margin: 0px 2px;
131 131
132 132 &.double {
133 133 margin: 0px 2px;
134 134 }
135 135
136 136 &.disabled{
137 137 margin-right: @padding;
138 138 }
139 139 }
140 140 }
141 141
142 142 .changeset_header {
143 143 height: 16px;
144 144
145 145 & > div{
146 146 margin-right: @padding;
147 147 }
148 148 }
149 149
150 150 .changeset_file {
151 151 text-align: left;
152 152 float: left;
153 153 padding: 0;
154 154
155 155 a{
156 156 display: inline-block;
157 157 margin-right: 0.5em;
158 158 }
159 159
160 160 #selected_mode{
161 161 margin-left: 0;
162 162 }
163 163 }
164 164
165 165 .diff-menu-wrapper {
166 166 float: left;
167 167 }
168 168
169 169 .diff-menu {
170 170 position: absolute;
171 171 background: none repeat scroll 0 0 #FFFFFF;
172 172 border-color: #003367 @grey3 @grey3;
173 173 border-right: 1px solid @grey3;
174 174 border-style: solid solid solid;
175 175 border-width: @border-thickness;
176 176 box-shadow: 2px 8px 4px rgba(0, 0, 0, 0.2);
177 177 margin-top: 5px;
178 178 margin-left: 1px;
179 179 }
180 180
181 181 .diff-actions, .editor-actions {
182 182 float: left;
183 183
184 184 input{
185 185 margin: 0 0.5em 0 0;
186 186 }
187 187 }
188 188
189 189 // END CODE-HEADER STYLES
190 190
191 191 // BEGIN CODE-BODY STYLES
192 192
193 193 .code-body {
194 194 padding: 0;
195 195 background-color: #ffffff;
196 196 position: relative;
197 197 max-width: none;
198 198 box-sizing: border-box;
199 199 // TODO: johbo: Parent has overflow: auto, this forces the child here
200 200 // to have the intended size and to scroll. Should be simplified.
201 201 width: 100%;
202 202 overflow-x: auto;
203 203 }
204 204
205 205 pre.raw {
206 206 background: white;
207 207 color: @grey1;
208 208 }
209 209 // END CODE-BODY STYLES
210 210
211 211 }
212 212
213 213
214 214 table.code-difftable {
215 215 border-collapse: collapse;
216 216 width: 99%;
217 217 border-radius: 0px !important;
218 218
219 219 td {
220 220 padding: 0 !important;
221 221 background: none !important;
222 222 border: 0 !important;
223 223 }
224 224
225 225 .context {
226 226 background: none repeat scroll 0 0 #DDE7EF;
227 227 }
228 228
229 229 .add {
230 230 background: none repeat scroll 0 0 #DDFFDD;
231 231
232 232 ins {
233 233 background: none repeat scroll 0 0 #AAFFAA;
234 234 text-decoration: none;
235 235 }
236 236 }
237 237
238 238 .del {
239 239 background: none repeat scroll 0 0 #FFDDDD;
240 240
241 241 del {
242 242 background: none repeat scroll 0 0 #FFAAAA;
243 243 text-decoration: none;
244 244 }
245 245 }
246 246
247 247 /** LINE NUMBERS **/
248 248 .lineno {
249 249 padding-left: 2px !important;
250 250 padding-right: 2px;
251 251 text-align: right;
252 252 width: 32px;
253 253 -moz-user-select: none;
254 254 -webkit-user-select: none;
255 255 border-right: @border-thickness solid @grey5 !important;
256 256 border-left: 0px solid #CCC !important;
257 257 border-top: 0px solid #CCC !important;
258 258 border-bottom: none !important;
259 259
260 260 a {
261 261 &:extend(pre);
262 262 text-align: right;
263 263 padding-right: 2px;
264 264 cursor: pointer;
265 265 display: block;
266 266 width: 32px;
267 267 }
268 268 }
269 269
270 270 .context {
271 271 cursor: auto;
272 272 &:extend(pre);
273 273 }
274 274
275 275 .lineno-inline {
276 276 background: none repeat scroll 0 0 #FFF !important;
277 277 padding-left: 2px;
278 278 padding-right: 2px;
279 279 text-align: right;
280 280 width: 30px;
281 281 -moz-user-select: none;
282 282 -webkit-user-select: none;
283 283 }
284 284
285 285 /** CODE **/
286 286 .code {
287 287 display: block;
288 288 width: 100%;
289 289
290 290 td {
291 291 margin: 0;
292 292 padding: 0;
293 293 }
294 294
295 295 pre {
296 296 margin: 0;
297 297 padding: 0;
298 298 margin-left: .5em;
299 299 }
300 300 }
301 301 }
302 302
303 303
304 304 // Comments
305 305 .comment-selected-hl {
306 306 border-left: 6px solid @comment-highlight-color !important;
307 307 padding-left: 3px !important;
308 308 margin-left: -7px !important;
309 309 }
310 310
311 311 div.comment:target,
312 312 div.comment-outdated:target {
313 313 .comment-selected-hl;
314 314 }
315 315
316 316 //TODO: anderson: can't get an absolute number out of anything, so had to put the
317 317 //current values that might change. But to make it clear I put as a calculation
318 318 @comment-max-width: 1065px;
319 319 @pr-extra-margin: 34px;
320 320 @pr-border-spacing: 4px;
321 321 @pr-comment-width: @comment-max-width - @pr-extra-margin - @pr-border-spacing;
322 322
323 323 // Pull Request
324 324 .cs_files .code-difftable {
325 325 border: @border-thickness solid @grey5; //borders only on PRs
326 326
327 327 .comment-inline-form,
328 328 div.comment {
329 329 width: @pr-comment-width;
330 330 }
331 331 }
332 332
333 333 // Changeset
334 334 .code-difftable {
335 335 .comment-inline-form,
336 336 div.comment {
337 337 width: @comment-max-width;
338 338 }
339 339 }
340 340
341 341 //Style page
342 342 @style-extra-margin: @sidebar-width + (@sidebarpadding * 3) + @padding;
343 343 #style-page .code-difftable{
344 344 .comment-inline-form,
345 345 div.comment {
346 346 width: @comment-max-width - @style-extra-margin;
347 347 }
348 348 }
349 349
350 350 #context-bar > h2 {
351 351 font-size: 20px;
352 352 }
353 353
354 354 #context-bar > h2> a {
355 355 font-size: 20px;
356 356 }
357 357 // end of defaults
358 358
359 359 .file_diff_buttons {
360 360 padding: 0 0 @padding;
361 361
362 362 .drop-menu {
363 363 float: left;
364 364 margin: 0 @padding 0 0;
365 365 }
366 366 .btn {
367 367 margin: 0 @padding 0 0;
368 368 }
369 369 }
370 370
371 371 .code-body.textarea.editor {
372 372 max-width: none;
373 373 padding: 15px;
374 374 }
375 375
376 376 td.injected_diff{
377 377 max-width: 1178px;
378 378 overflow-x: auto;
379 379 overflow-y: hidden;
380 380
381 381 div.diff-container,
382 382 div.diffblock{
383 383 max-width: 100%;
384 384 }
385 385
386 386 div.code-body {
387 387 max-width: 1124px;
388 388 overflow-x: auto;
389 389 overflow-y: hidden;
390 390 padding: 0;
391 391 }
392 392 div.diffblock {
393 393 border: none;
394 394 }
395 395
396 396 &.inline-form {
397 397 width: 99%
398 398 }
399 399 }
400 400
401 401
402 402 table.code-difftable {
403 403 width: 100%;
404 404 }
405 405
406 406 /** PYGMENTS COLORING **/
407 407 div.codeblock {
408 408
409 409 // TODO: johbo: Added interim to get rid of the margin around
410 410 // Select2 widgets. This needs further cleanup.
411 411 overflow: auto;
412 412 padding: 0px;
413 413 border: @border-thickness solid @grey6;
414 414 .border-radius(@border-radius);
415 415
416 416 #remove_gist {
417 417 float: right;
418 418 }
419 419
420 420 .gist_url {
421 421 padding: 0px 0px 35px 0px;
422 422 }
423 423
424 424 .gist-desc {
425 425 clear: both;
426 426 margin: 0 0 10px 0;
427 427 code {
428 428 white-space: pre-line;
429 429 line-height: inherit
430 430 }
431 431 }
432 432
433 433 .author {
434 434 clear: both;
435 435 vertical-align: middle;
436 436 font-weight: @text-bold-weight;
437 437 font-family: @text-bold;
438 438 }
439 439
440 440 .btn-mini {
441 441 float: left;
442 442 margin: 0 5px 0 0;
443 443 }
444 444
445 445 .code-header {
446 446 padding: @padding;
447 447 border-bottom: @border-thickness solid @grey5;
448 448
449 449 .rc-user {
450 450 min-width: 0;
451 451 margin-right: .5em;
452 452 }
453 453
454 454 .stats {
455 455 clear: both;
456 456 margin: 0 0 @padding 0;
457 457 padding: 0;
458 458 .left {
459 459 float: left;
460 460 clear: left;
461 461 max-width: 75%;
462 462 margin: 0 0 @padding 0;
463 463
464 464 &.item {
465 465 margin-right: @padding;
466 466 &.last { border-right: none; }
467 467 }
468 468 }
469 469 .buttons { float: right; }
470 470 .author {
471 471 height: 25px; margin-left: 15px; font-weight: bold;
472 472 }
473 473 }
474 474
475 475 .commit {
476 476 margin: 5px 0 0 26px;
477 477 font-weight: normal;
478 478 white-space: pre-wrap;
479 479 }
480 480 }
481 481
482 482 .message {
483 483 position: relative;
484 484 margin: @padding;
485 485
486 486 .codeblock-label {
487 487 margin: 0 0 1em 0;
488 488 }
489 489 }
490 490
491 491 .code-body {
492 492 padding: 0.8em 1em;
493 493 background-color: #ffffff;
494 494 min-width: 100%;
495 495 box-sizing: border-box;
496 496 // TODO: johbo: Parent has overflow: auto, this forces the child here
497 497 // to have the intended size and to scroll. Should be simplified.
498 498 width: 100%;
499 499 overflow-x: auto;
500 500
501 501 img.rendered-binary {
502 502 height: auto;
503 503 width: auto;
504 504 }
505 505
506 506 .markdown-block {
507 507 padding: 1em 0;
508 508 }
509 509 }
510 510
511 511 .codeblock-header {
512 512 background: @grey7;
513 513 height: 36px;
514 514 }
515 515
516 516 .path {
517 517 border-bottom: 1px solid @grey6;
518 518 padding: .65em 1em;
519 519 height: 18px;
520 520 }
521 521 }
522 522
523 523 .code-highlighttable,
524 524 div.codeblock {
525 525
526 526 &.readme {
527 527 background-color: white;
528 528 }
529 529
530 530 .markdown-block table {
531 531 border-collapse: collapse;
532 532
533 533 th,
534 534 td {
535 535 padding: .5em;
536 536 border: @border-thickness solid @border-default-color;
537 537 }
538 538 }
539 539
540 540 table {
541 541 border: 0px;
542 542 margin: 0;
543 543 letter-spacing: normal;
544 544
545 545
546 546 td {
547 547 border: 0px;
548 548 vertical-align: top;
549 549 }
550 550 }
551 551 }
552 552
553 553 div.codeblock .code-header .search-path { padding: 0 0 0 10px; }
554 554 div.search-code-body {
555 555 background-color: #ffffff; padding: 5px 0 5px 10px;
556 556 pre {
557 557 .match { background-color: #faffa6;}
558 558 .break { display: block; width: 100%; background-color: #DDE7EF; color: #747474; }
559 559 }
560 560 .code-highlighttable {
561 561 border-collapse: collapse;
562 562
563 563 tr:hover {
564 564 background: #fafafa;
565 565 }
566 566 td.code {
567 567 padding-left: 10px;
568 568 }
569 569 td.line {
570 570 border-right: 1px solid #ccc !important;
571 571 padding-right: 10px;
572 572 text-align: right;
573 573 font-family: @text-monospace;
574 574 span {
575 575 white-space: pre-wrap;
576 576 color: #666666;
577 577 }
578 578 }
579 579 }
580 580 }
581 581
582 582 div.annotatediv { margin-left: 2px; margin-right: 4px; }
583 583 .code-highlight {
584 584 margin: 0; padding: 0; border-left: @border-thickness solid @grey5;
585 585 pre, .linenodiv pre { padding: 0 5px; margin: 0; }
586 586 pre div:target {background-color: @comment-highlight-color !important;}
587 587 }
588 588
589 589 .linenos a { text-decoration: none; }
590 590
591 591 .CodeMirror-selected { background: @rchighlightblue; }
592 592 .CodeMirror-focused .CodeMirror-selected { background: @rchighlightblue; }
593 593 .CodeMirror ::selection { background: @rchighlightblue; }
594 594 .CodeMirror ::-moz-selection { background: @rchighlightblue; }
595 595
596 596 .code { display: block; border:0px !important; }
597 597
598 598 .code-highlight, /* TODO: dan: merge codehilite into code-highlight */
599 599 .codehilite {
600 600 /*ElasticMatch is custom RhodeCode TAG*/
601 601
602 602 .c-ElasticMatch {
603 603 background-color: #faffa6;
604 604 padding: 0.2em;
605 605 }
606 606 }
607 607
608 608 /* This can be generated with `pygmentize -S default -f html` */
609 609 .code-highlight,
610 610 .codehilite {
611 611 /*ElasticMatch is custom RhodeCode TAG*/
612 612 .c-ElasticMatch { background-color: #faffa6; padding: 0.2em;}
613 613 .hll { background-color: #ffffcc }
614 614 .c { color: #408080; font-style: italic } /* Comment */
615 615 .err, .codehilite .err { border: none } /* Error */
616 616 .k { color: #008000; font-weight: bold } /* Keyword */
617 617 .o { color: #666666 } /* Operator */
618 618 .ch { color: #408080; font-style: italic } /* Comment.Hashbang */
619 619 .cm { color: #408080; font-style: italic } /* Comment.Multiline */
620 620 .cp { color: #BC7A00 } /* Comment.Preproc */
621 621 .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
622 622 .c1 { color: #408080; font-style: italic } /* Comment.Single */
623 623 .cs { color: #408080; font-style: italic } /* Comment.Special */
624 624 .gd { color: #A00000 } /* Generic.Deleted */
625 625 .ge { font-style: italic } /* Generic.Emph */
626 626 .gr { color: #FF0000 } /* Generic.Error */
627 627 .gh { color: #000080; font-weight: bold } /* Generic.Heading */
628 628 .gi { color: #00A000 } /* Generic.Inserted */
629 629 .go { color: #888888 } /* Generic.Output */
630 630 .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
631 631 .gs { font-weight: bold } /* Generic.Strong */
632 632 .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
633 633 .gt { color: #0044DD } /* Generic.Traceback */
634 634 .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
635 635 .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
636 636 .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
637 637 .kp { color: #008000 } /* Keyword.Pseudo */
638 638 .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
639 639 .kt { color: #B00040 } /* Keyword.Type */
640 640 .m { color: #666666 } /* Literal.Number */
641 641 .s { color: #BA2121 } /* Literal.String */
642 642 .na { color: #7D9029 } /* Name.Attribute */
643 643 .nb { color: #008000 } /* Name.Builtin */
644 644 .nc { color: #0000FF; font-weight: bold } /* Name.Class */
645 645 .no { color: #880000 } /* Name.Constant */
646 646 .nd { color: #AA22FF } /* Name.Decorator */
647 647 .ni { color: #999999; font-weight: bold } /* Name.Entity */
648 648 .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
649 649 .nf { color: #0000FF } /* Name.Function */
650 650 .nl { color: #A0A000 } /* Name.Label */
651 651 .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
652 652 .nt { color: #008000; font-weight: bold } /* Name.Tag */
653 653 .nv { color: #19177C } /* Name.Variable */
654 654 .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
655 655 .w { color: #bbbbbb } /* Text.Whitespace */
656 656 .mb { color: #666666 } /* Literal.Number.Bin */
657 657 .mf { color: #666666 } /* Literal.Number.Float */
658 658 .mh { color: #666666 } /* Literal.Number.Hex */
659 659 .mi { color: #666666 } /* Literal.Number.Integer */
660 660 .mo { color: #666666 } /* Literal.Number.Oct */
661 661 .sa { color: #BA2121 } /* Literal.String.Affix */
662 662 .sb { color: #BA2121 } /* Literal.String.Backtick */
663 663 .sc { color: #BA2121 } /* Literal.String.Char */
664 664 .dl { color: #BA2121 } /* Literal.String.Delimiter */
665 665 .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
666 666 .s2 { color: #BA2121 } /* Literal.String.Double */
667 667 .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
668 668 .sh { color: #BA2121 } /* Literal.String.Heredoc */
669 669 .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
670 670 .sx { color: #008000 } /* Literal.String.Other */
671 671 .sr { color: #BB6688 } /* Literal.String.Regex */
672 672 .s1 { color: #BA2121 } /* Literal.String.Single */
673 673 .ss { color: #19177C } /* Literal.String.Symbol */
674 674 .bp { color: #008000 } /* Name.Builtin.Pseudo */
675 675 .fm { color: #0000FF } /* Name.Function.Magic */
676 676 .vc { color: #19177C } /* Name.Variable.Class */
677 677 .vg { color: #19177C } /* Name.Variable.Global */
678 678 .vi { color: #19177C } /* Name.Variable.Instance */
679 679 .vm { color: #19177C } /* Name.Variable.Magic */
680 680 .il { color: #666666 } /* Literal.Number.Integer.Long */
681 681
682 682 }
683 683
684 684 /* customized pre blocks for markdown/rst */
685 685 pre.literal-block, .codehilite pre{
686 686 padding: @padding;
687 687 border: 1px solid @grey6;
688 688 .border-radius(@border-radius);
689 689 background-color: @grey7;
690 690 }
691 691
692 692
693 693 /* START NEW CODE BLOCK CSS */
694 694
695 695 @cb-line-height: 18px;
696 696 @cb-line-code-padding: 10px;
697 697 @cb-text-padding: 5px;
698 698
699 699 @pill-padding: 2px 7px;
700 700 @pill-padding-small: 2px 2px 1px 2px;
701 701
702 702 input.filediff-collapse-state {
703 703 display: none;
704 704
705 705 &:checked + .filediff { /* file diff is collapsed */
706 706 .cb {
707 707 display: none
708 708 }
709 709 .filediff-collapse-indicator {
710 710 float: left;
711 711 cursor: pointer;
712 712 margin: 1px -5px;
713 713 }
714 714 .filediff-collapse-indicator:before {
715 715 content: '\f105';
716 716 }
717 717
718 718 .filediff-menu {
719 719 display: none;
720 720 }
721 721
722 722 }
723 723
724 724 &+ .filediff { /* file diff is expanded */
725 725
726 726 .filediff-collapse-indicator {
727 727 float: left;
728 728 cursor: pointer;
729 729 margin: 1px -5px;
730 730 }
731 731 .filediff-collapse-indicator:before {
732 732 content: '\f107';
733 733 }
734 734
735 735 .filediff-menu {
736 736 display: block;
737 737 }
738 738
739 739 margin: 10px 0;
740 740 &:nth-child(2) {
741 741 margin: 0;
742 742 }
743 743 }
744 744 }
745 745
746 746 .filediffs .anchor {
747 747 display: block;
748 748 height: 40px;
749 749 margin-top: -40px;
750 750 visibility: hidden;
751 751 }
752 752
753 753 .filediffs .anchor:nth-of-type(1) {
754 754 display: block;
755 755 height: 80px;
756 756 margin-top: -80px;
757 757 visibility: hidden;
758 758 }
759 759
760 760 .cs_files {
761 761 clear: both;
762 762 }
763 763
764 764 #diff-file-sticky{
765 765 will-change: min-height;
766 766 height: 80px;
767 767 }
768 768
769 769 .sidebar__inner{
770 770 transform: translate(0, 0); /* For browsers don't support translate3d. */
771 771 transform: translate3d(0, 0, 0);
772 772 will-change: position, transform;
773 773 height: 65px;
774 774 background-color: #fff;
775 775 padding: 5px 0px;
776 776 }
777 777
778 778 .sidebar__bar {
779 779 padding: 5px 0px 0px 0px
780 780 }
781 781
782 782 .fpath-placeholder {
783 783 clear: both;
784 784 visibility: hidden
785 785 }
786 786
787 787 .is-affixed {
788 788
789 789 .sidebar__inner {
790 790 z-index: 30;
791 791 }
792 792
793 793 .sidebar_inner_shadow {
794 794 position: fixed;
795 795 top: 75px;
796 796 right: -100%;
797 797 left: -100%;
798 798 z-index: 30;
799 799 display: block;
800 800 height: 5px;
801 801 content: "";
802 802 background: linear-gradient(rgba(0, 0, 0, 0.075), rgba(0, 0, 0, 0.001)) repeat-x 0 0;
803 803 border-top: 1px solid rgba(0, 0, 0, 0.15);
804 804 }
805 805
806 806 .fpath-placeholder {
807 807 visibility: visible !important;
808 808 }
809 809 }
810 810
811 811 .diffset-menu {
812 812
813 813 }
814 814
815 815 #todo-box {
816 816 clear:both;
817 817 display: none;
818 818 text-align: right
819 819 }
820 820
821 821 .diffset {
822 822 margin: 0px auto;
823 823 .diffset-heading {
824 824 border: 1px solid @grey5;
825 825 margin-bottom: -1px;
826 826 // margin-top: 20px;
827 827 h2 {
828 828 margin: 0;
829 829 line-height: 38px;
830 830 padding-left: 10px;
831 831 }
832 832 .btn {
833 833 margin: 0;
834 834 }
835 835 background: @grey6;
836 836 display: block;
837 837 padding: 5px;
838 838 }
839 839 .diffset-heading-warning {
840 840 background: @alert3-inner;
841 841 border: 1px solid @alert3;
842 842 }
843 843 &.diffset-comments-disabled {
844 844 .cb-comment-box-opener, .comment-inline-form, .cb-comment-add-button {
845 845 display: none !important;
846 846 }
847 847 }
848 848 }
849 849
850 850 .filelist {
851 851 .pill {
852 852 display: block;
853 853 float: left;
854 854 padding: @pill-padding-small;
855 855 }
856 856 }
857 857
858 858 .pill {
859 859 display: block;
860 860 float: left;
861 861 padding: @pill-padding;
862 862 }
863 863
864 864 .pill-group {
865 865 .pill {
866 866 opacity: .8;
867 867 margin-right: 3px;
868 868 font-size: 12px;
869 869 font-weight: normal;
870 870 min-width: 30px;
871 871 text-align: center;
872 872
873 873 &:first-child {
874 874 border-radius: @border-radius 0 0 @border-radius;
875 875 }
876 876 &:last-child {
877 877 border-radius: 0 @border-radius @border-radius 0;
878 878 }
879 879 &:only-child {
880 880 border-radius: @border-radius;
881 881 margin-right: 0;
882 882 }
883 883 }
884 884 }
885 885
886 886 /* Main comments*/
887 887 #comments {
888 888 .comment-selected {
889 889 border-left: 6px solid @comment-highlight-color;
890 890 padding-left: 3px;
891 891 margin-left: -9px;
892 892 }
893 893 }
894 894
895 895 .filediff {
896 896 border: 1px solid @grey5;
897 897
898 898 /* START OVERRIDES */
899 899 .code-highlight {
900 900 border: none; // TODO: remove this border from the global
901 901 // .code-highlight, it doesn't belong there
902 902 }
903 903 label {
904 904 margin: 0; // TODO: remove this margin definition from global label
905 905 // it doesn't belong there - if margin on labels
906 906 // are needed for a form they should be defined
907 907 // in the form's class
908 908 }
909 909 /* END OVERRIDES */
910 910
911 911 * {
912 912 box-sizing: border-box;
913 913 }
914 914
915 915 .on-hover-icon {
916 916 visibility: hidden;
917 917 }
918 918
919 919 .filediff-anchor {
920 920 visibility: hidden;
921 921 }
922 922 &:hover {
923 923 .filediff-anchor {
924 924 visibility: visible;
925 925 }
926 926 .on-hover-icon {
927 927 visibility: visible;
928 928 }
929 929 }
930 930
931 931 .filediff-heading {
932 932 cursor: pointer;
933 933 display: block;
934 934 padding: 10px 10px;
935 935 }
936 936 .filediff-heading:after {
937 937 content: "";
938 938 display: table;
939 939 clear: both;
940 940 }
941 941 .filediff-heading:hover {
942 942 background: #e1e9f4 !important;
943 943 }
944 944
945 945 .filediff-menu {
946 946 text-align: right;
947 947 padding: 5px 5px 5px 0px;
948 948 background: @grey7;
949 949
950 950 &> a,
951 951 &> span {
952 952 padding: 1px;
953 953 }
954 954 }
955 955
956 956 .filediff-collapse-button, .filediff-expand-button {
957 957 cursor: pointer;
958 958 }
959 959 .filediff-collapse-button {
960 960 display: inline;
961 961 }
962 962 .filediff-expand-button {
963 963 display: none;
964 964 }
965 965 .filediff-collapsed .filediff-collapse-button {
966 966 display: none;
967 967 }
968 968 .filediff-collapsed .filediff-expand-button {
969 969 display: inline;
970 970 }
971 971
972 972 /**** COMMENTS ****/
973 973
974 974 .filediff-menu {
975 975 .show-comment-button {
976 976 display: none;
977 977 }
978 978 }
979 979 &.hide-comments {
980 980 .inline-comments {
981 981 display: none;
982 982 }
983 983 .filediff-menu {
984 984 .show-comment-button {
985 985 display: inline;
986 986 }
987 987 .hide-comment-button {
988 988 display: none;
989 989 }
990 990 }
991 991 }
992 992
993 993 .hide-line-comments {
994 994 .inline-comments {
995 995 display: none;
996 996 }
997 997 }
998 998
999 999 /**** END COMMENTS ****/
1000 1000
1001 1001 }
1002 1002
1003 1003
1004 1004 .op-added {
1005 1005 color: @alert1;
1006 1006 }
1007 1007
1008 1008 .op-deleted {
1009 1009 color: @alert2;
1010 1010 }
1011 1011
1012 1012 .filediff, .filelist {
1013 1013
1014 1014 .pill {
1015 1015 &[op="name"] {
1016 1016 background: none;
1017 1017 opacity: 1;
1018 1018 color: white;
1019 1019 }
1020 1020 &[op="limited"] {
1021 1021 background: @grey2;
1022 1022 color: white;
1023 1023 }
1024 1024 &[op="binary"] {
1025 1025 background: @color7;
1026 1026 color: white;
1027 1027 }
1028 1028 &[op="modified"] {
1029 1029 background: @alert1;
1030 1030 color: white;
1031 1031 }
1032 1032 &[op="renamed"] {
1033 1033 background: @color4;
1034 1034 color: white;
1035 1035 }
1036 1036 &[op="copied"] {
1037 1037 background: @color4;
1038 1038 color: white;
1039 1039 }
1040 1040 &[op="mode"] {
1041 1041 background: @grey3;
1042 1042 color: white;
1043 1043 }
1044 1044 &[op="symlink"] {
1045 1045 background: @color8;
1046 1046 color: white;
1047 1047 }
1048 1048
1049 1049 &[op="added"] { /* added lines */
1050 1050 background: @alert1;
1051 1051 color: white;
1052 1052 }
1053 1053 &[op="deleted"] { /* deleted lines */
1054 1054 background: @alert2;
1055 1055 color: white;
1056 1056 }
1057 1057
1058 1058 &[op="created"] { /* created file */
1059 1059 background: @alert1;
1060 1060 color: white;
1061 1061 }
1062 1062 &[op="removed"] { /* deleted file */
1063 1063 background: @color5;
1064 1064 color: white;
1065 1065 }
1066 &[op="comments"] { /* comments on file */
1067 background: @grey4;
1068 color: white;
1069 }
1066 1070 }
1067 1071 }
1068 1072
1069 1073
1070 1074 .filediff-outdated {
1071 1075 padding: 8px 0;
1072 1076
1073 1077 .filediff-heading {
1074 1078 opacity: .5;
1075 1079 }
1076 1080 }
1077 1081
1078 1082 table.cb {
1079 1083 width: 100%;
1080 1084 border-collapse: collapse;
1081 1085
1082 1086 .cb-text {
1083 1087 padding: @cb-text-padding;
1084 1088 }
1085 1089 .cb-hunk {
1086 1090 padding: @cb-text-padding;
1087 1091 }
1088 1092 .cb-expand {
1089 1093 display: none;
1090 1094 }
1091 1095 .cb-collapse {
1092 1096 display: inline;
1093 1097 }
1094 1098 &.cb-collapsed {
1095 1099 .cb-line {
1096 1100 display: none;
1097 1101 }
1098 1102 .cb-expand {
1099 1103 display: inline;
1100 1104 }
1101 1105 .cb-collapse {
1102 1106 display: none;
1103 1107 }
1104 1108 .cb-hunk {
1105 1109 display: none;
1106 1110 }
1107 1111 }
1108 1112
1109 1113 /* intentionally general selector since .cb-line-selected must override it
1110 1114 and they both use !important since the td itself may have a random color
1111 1115 generated by annotation blocks. TLDR: if you change it, make sure
1112 1116 annotated block selection and line selection in file view still work */
1113 1117 .cb-line-fresh .cb-content {
1114 1118 background: white !important;
1115 1119 }
1116 1120 .cb-warning {
1117 1121 background: #fff4dd;
1118 1122 }
1119 1123
1120 1124 &.cb-diff-sideside {
1121 1125 td {
1122 1126 &.cb-content {
1123 1127 width: 50%;
1124 1128 }
1125 1129 }
1126 1130 }
1127 1131
1128 1132 tr {
1129 1133 &.cb-annotate {
1130 1134 border-top: 1px solid #eee;
1131 1135 }
1132 1136
1133 1137 &.cb-comment-info {
1134 1138 border-top: 1px solid #eee;
1135 1139 color: rgba(0, 0, 0, 0.3);
1136 1140 background: #edf2f9;
1137 1141
1138 1142 td {
1139 1143
1140 1144 }
1141 1145 }
1142 1146
1143 1147 &.cb-hunk {
1144 1148 font-family: @text-monospace;
1145 1149 color: rgba(0, 0, 0, 0.3);
1146 1150
1147 1151 td {
1148 1152 &:first-child {
1149 1153 background: #edf2f9;
1150 1154 }
1151 1155 &:last-child {
1152 1156 background: #f4f7fb;
1153 1157 }
1154 1158 }
1155 1159 }
1156 1160 }
1157 1161
1158 1162
1159 1163 td {
1160 1164 vertical-align: top;
1161 1165 padding: 0;
1162 1166
1163 1167 &.cb-content {
1164 1168 font-size: 12.35px;
1165 1169
1166 1170 &.cb-line-selected .cb-code {
1167 1171 background: @comment-highlight-color !important;
1168 1172 }
1169 1173
1170 1174 span.cb-code {
1171 1175 line-height: @cb-line-height;
1172 1176 padding-left: @cb-line-code-padding;
1173 1177 padding-right: @cb-line-code-padding;
1174 1178 display: block;
1175 1179 white-space: pre-wrap;
1176 1180 font-family: @text-monospace;
1177 1181 word-break: break-all;
1178 1182 .nonl {
1179 1183 color: @color5;
1180 1184 }
1181 1185 .cb-action {
1182 1186 &:before {
1183 1187 content: " ";
1184 1188 }
1185 1189 &.cb-deletion:before {
1186 1190 content: "- ";
1187 1191 }
1188 1192 &.cb-addition:before {
1189 1193 content: "+ ";
1190 1194 }
1191 1195 }
1192 1196 }
1193 1197
1194 1198 &> button.cb-comment-box-opener {
1195 1199
1196 1200 padding: 2px 2px 1px 3px;
1197 1201 margin-left: -6px;
1198 1202 margin-top: -1px;
1199 1203
1200 1204 border-radius: @border-radius;
1201 1205 position: absolute;
1202 1206 display: none;
1203 1207 }
1204 1208 .cb-comment {
1205 1209 margin-top: 10px;
1206 1210 white-space: normal;
1207 1211 }
1208 1212 }
1209 1213 &:hover {
1210 1214 button.cb-comment-box-opener {
1211 1215 display: block;
1212 1216 }
1213 1217 &+ td button.cb-comment-box-opener {
1214 1218 display: block
1215 1219 }
1216 1220 }
1217 1221
1218 1222 &.cb-data {
1219 1223 text-align: right;
1220 1224 width: 30px;
1221 1225 font-family: @text-monospace;
1222 1226
1223 1227 .icon-comment {
1224 1228 cursor: pointer;
1225 1229 }
1226 1230 &.cb-line-selected {
1227 1231 background: @comment-highlight-color !important;
1228 1232 }
1229 1233 &.cb-line-selected > div {
1230 1234 display: block;
1231 1235 background: @comment-highlight-color !important;
1232 1236 line-height: @cb-line-height;
1233 1237 color: rgba(0, 0, 0, 0.3);
1234 1238 }
1235 1239 }
1236 1240
1237 1241 &.cb-lineno {
1238 1242 padding: 0;
1239 1243 width: 50px;
1240 1244 color: rgba(0, 0, 0, 0.3);
1241 1245 text-align: right;
1242 1246 border-right: 1px solid #eee;
1243 1247 font-family: @text-monospace;
1244 1248 -webkit-user-select: none;
1245 1249 -moz-user-select: none;
1246 1250 user-select: none;
1247 1251
1248 1252 a::before {
1249 1253 content: attr(data-line-no);
1250 1254 }
1251 1255 &.cb-line-selected {
1252 1256 background: @comment-highlight-color !important;
1253 1257 }
1254 1258
1255 1259 a {
1256 1260 display: block;
1257 1261 padding-right: @cb-line-code-padding;
1258 1262 padding-left: @cb-line-code-padding;
1259 1263 line-height: @cb-line-height;
1260 1264 color: rgba(0, 0, 0, 0.3);
1261 1265 }
1262 1266 }
1263 1267
1264 1268 &.cb-empty {
1265 1269 background: @grey7;
1266 1270 }
1267 1271
1268 1272 ins {
1269 1273 color: black;
1270 1274 background: #a6f3a6;
1271 1275 text-decoration: none;
1272 1276 }
1273 1277 del {
1274 1278 color: black;
1275 1279 background: #f8cbcb;
1276 1280 text-decoration: none;
1277 1281 }
1278 1282 &.cb-addition {
1279 1283 background: #ecffec;
1280 1284
1281 1285 &.blob-lineno {
1282 1286 background: #ddffdd;
1283 1287 }
1284 1288 }
1285 1289 &.cb-deletion {
1286 1290 background: #ffecec;
1287 1291
1288 1292 &.blob-lineno {
1289 1293 background: #ffdddd;
1290 1294 }
1291 1295 }
1292 1296 &.cb-annotate-message-spacer {
1293 1297 width:8px;
1294 1298 padding: 1px 0px 0px 3px;
1295 1299 }
1296 1300 &.cb-annotate-info {
1297 1301 width: 320px;
1298 1302 min-width: 320px;
1299 1303 max-width: 320px;
1300 1304 padding: 5px 2px;
1301 1305 font-size: 13px;
1302 1306
1303 1307 .cb-annotate-message {
1304 1308 padding: 2px 0px 0px 0px;
1305 1309 white-space: pre-line;
1306 1310 overflow: hidden;
1307 1311 }
1308 1312 .rc-user {
1309 1313 float: none;
1310 1314 padding: 0 6px 0 17px;
1311 1315 min-width: unset;
1312 1316 min-height: unset;
1313 1317 }
1314 1318 }
1315 1319
1316 1320 &.cb-annotate-revision {
1317 1321 cursor: pointer;
1318 1322 text-align: right;
1319 1323 padding: 1px 3px 0px 3px;
1320 1324 }
1321 1325 }
1322 1326 }
@@ -1,634 +1,635 b''
1 1 // comments.less
2 2 // For use in RhodeCode applications;
3 3 // see style guide documentation for guidelines.
4 4
5 5
6 6 // Comments
7 7 @comment-outdated-opacity: 0.6;
8 8
9 9 .comments {
10 10 width: 100%;
11 11 }
12 12
13 13 .comments-heading {
14 14 margin-bottom: -1px;
15 15 background: @grey6;
16 16 display: block;
17 17 padding: 10px 0px;
18 18 font-size: 18px
19 19 }
20 20
21 21 #comment-tr-show {
22 22 padding: 5px 0;
23 23 }
24 24
25 25 tr.inline-comments div {
26 26 max-width: 100%;
27 27
28 28 p {
29 29 white-space: normal;
30 30 }
31 31
32 32 code, pre, .code, dd {
33 33 overflow-x: auto;
34 34 width: 1062px;
35 35 }
36 36
37 37 dd {
38 38 width: auto;
39 39 }
40 40 }
41 41
42 42 #injected_page_comments {
43 43 .comment-previous-link,
44 44 .comment-next-link,
45 45 .comment-links-divider {
46 46 display: none;
47 47 }
48 48 }
49 49
50 50 .add-comment {
51 51 margin-bottom: 10px;
52 52 }
53 53 .hide-comment-button .add-comment {
54 54 display: none;
55 55 }
56 56
57 57 .comment-bubble {
58 58 color: @grey4;
59 59 margin-top: 4px;
60 60 margin-right: 30px;
61 61 visibility: hidden;
62 62 }
63 63
64 64 .comment-label {
65 65 float: left;
66 66
67 67 padding: 0.4em 0.4em;
68 margin: 3px 5px 0px -10px;
68 margin: 2px 4px 0px 0px;
69 69 display: inline-block;
70 70 min-height: 0;
71 71
72 72 text-align: center;
73 73 font-size: 10px;
74 74 line-height: .8em;
75 75
76 76 font-family: @text-italic;
77 77 font-style: italic;
78 78 background: #fff none;
79 color: @grey4;
79 color: @grey3;
80 80 border: 1px solid @grey4;
81 81 white-space: nowrap;
82 82
83 83 text-transform: uppercase;
84 min-width: 40px;
84 min-width: 50px;
85 border-radius: 4px;
85 86
86 87 &.todo {
87 88 color: @color5;
88 89 font-style: italic;
89 90 font-weight: @text-bold-italic-weight;
90 91 font-family: @text-bold-italic;
91 92 }
92 93
93 94 .resolve {
94 95 cursor: pointer;
95 96 text-decoration: underline;
96 97 }
97 98
98 99 .resolved {
99 100 text-decoration: line-through;
100 101 color: @color1;
101 102 }
102 103 .resolved a {
103 104 text-decoration: line-through;
104 105 color: @color1;
105 106 }
106 107 .resolve-text {
107 108 color: @color1;
108 109 margin: 2px 8px;
109 110 font-family: @text-italic;
110 111 font-style: italic;
111 112 }
112 113 }
113 114
114 115 .has-spacer-after {
115 116 &:after {
116 117 content: ' | ';
117 118 color: @grey5;
118 119 }
119 120 }
120 121
121 122 .has-spacer-before {
122 123 &:before {
123 124 content: ' | ';
124 125 color: @grey5;
125 126 }
126 127 }
127 128
128 129 .comment {
129 130
130 131 &.comment-general {
131 132 border: 1px solid @grey5;
132 133 padding: 5px 5px 5px 5px;
133 134 }
134 135
135 136 margin: @padding 0;
136 137 padding: 4px 0 0 0;
137 138 line-height: 1em;
138 139
139 140 .rc-user {
140 141 min-width: 0;
141 142 margin: 0px .5em 0 0;
142 143
143 144 .user {
144 145 display: inline;
145 146 }
146 147 }
147 148
148 149 .meta {
149 150 position: relative;
150 151 width: 100%;
151 152 border-bottom: 1px solid @grey5;
152 153 margin: -5px 0px;
153 154 line-height: 24px;
154 155
155 156 &:hover .permalink {
156 157 visibility: visible;
157 158 color: @rcblue;
158 159 }
159 160 }
160 161
161 162 .author,
162 163 .date {
163 164 display: inline;
164 165
165 166 &:after {
166 167 content: ' | ';
167 168 color: @grey5;
168 169 }
169 170 }
170 171
171 172 .author-general img {
172 173 top: 3px;
173 174 }
174 175 .author-inline img {
175 176 top: 3px;
176 177 }
177 178
178 179 .status-change,
179 180 .permalink,
180 181 .changeset-status-lbl {
181 182 display: inline;
182 183 }
183 184
184 185 .permalink {
185 186 visibility: hidden;
186 187 }
187 188
188 189 .comment-links-divider {
189 190 display: inline;
190 191 }
191 192
192 193 .comment-links-block {
193 194 float:right;
194 195 text-align: right;
195 196 min-width: 85px;
196 197
197 198 [class^="icon-"]:before,
198 199 [class*=" icon-"]:before {
199 200 margin-left: 0;
200 201 margin-right: 0;
201 202 }
202 203 }
203 204
204 205 .comment-previous-link {
205 206 display: inline-block;
206 207
207 208 .arrow_comment_link{
208 209 cursor: pointer;
209 210 i {
210 211 font-size:10px;
211 212 }
212 213 }
213 214 .arrow_comment_link.disabled {
214 215 cursor: default;
215 216 color: @grey5;
216 217 }
217 218 }
218 219
219 220 .comment-next-link {
220 221 display: inline-block;
221 222
222 223 .arrow_comment_link{
223 224 cursor: pointer;
224 225 i {
225 226 font-size:10px;
226 227 }
227 228 }
228 229 .arrow_comment_link.disabled {
229 230 cursor: default;
230 231 color: @grey5;
231 232 }
232 233 }
233 234
234 235 .delete-comment {
235 236 display: inline-block;
236 237 color: @rcblue;
237 238
238 239 &:hover {
239 240 cursor: pointer;
240 241 }
241 242 }
242 243
243 244 .text {
244 245 clear: both;
245 246 .border-radius(@border-radius);
246 247 .box-sizing(border-box);
247 248
248 249 .markdown-block p,
249 250 .rst-block p {
250 251 margin: .5em 0 !important;
251 252 // TODO: lisa: This is needed because of other rst !important rules :[
252 253 }
253 254 }
254 255
255 256 .pr-version {
256 257 display: inline-block;
257 258 }
258 259 .pr-version-inline {
259 260 display: inline-block;
260 261 }
261 262 .pr-version-num {
262 263 font-size: 10px;
263 264 }
264 265 }
265 266
266 267 @comment-padding: 5px;
267 268
268 269 .general-comments {
269 270 .comment-outdated {
270 271 opacity: @comment-outdated-opacity;
271 272 }
272 273 }
273 274
274 275 .inline-comments {
275 276 border-radius: @border-radius;
276 277 .comment {
277 278 margin: 0;
278 279 border-radius: @border-radius;
279 280 }
280 281 .comment-outdated {
281 282 opacity: @comment-outdated-opacity;
282 283 }
283 284
284 285 .comment-inline {
285 286 background: white;
286 287 padding: @comment-padding @comment-padding;
287 288 border: @comment-padding solid @grey6;
288 289
289 290 .text {
290 291 border: none;
291 292 }
292 293 .meta {
293 294 border-bottom: 1px solid @grey6;
294 295 margin: -5px 0px;
295 296 line-height: 24px;
296 297 }
297 298 }
298 299 .comment-selected {
299 300 border-left: 6px solid @comment-highlight-color;
300 301 }
301 302 .comment-inline-form {
302 303 padding: @comment-padding;
303 304 display: none;
304 305 }
305 306 .cb-comment-add-button {
306 307 margin: @comment-padding;
307 308 }
308 309 /* hide add comment button when form is open */
309 310 .comment-inline-form-open ~ .cb-comment-add-button {
310 311 display: none;
311 312 }
312 313 .comment-inline-form-open {
313 314 display: block;
314 315 }
315 316 /* hide add comment button when form but no comments */
316 317 .comment-inline-form:first-child + .cb-comment-add-button {
317 318 display: none;
318 319 }
319 320 /* hide add comment button when no comments or form */
320 321 .cb-comment-add-button:first-child {
321 322 display: none;
322 323 }
323 324 /* hide add comment button when only comment is being deleted */
324 325 .comment-deleting:first-child + .cb-comment-add-button {
325 326 display: none;
326 327 }
327 328 }
328 329
329 330
330 331 .show-outdated-comments {
331 332 display: inline;
332 333 color: @rcblue;
333 334 }
334 335
335 336 // Comment Form
336 337 div.comment-form {
337 338 margin-top: 20px;
338 339 }
339 340
340 341 .comment-form strong {
341 342 display: block;
342 343 margin-bottom: 15px;
343 344 }
344 345
345 346 .comment-form textarea {
346 347 width: 100%;
347 348 height: 100px;
348 349 font-family: @text-monospace;
349 350 }
350 351
351 352 form.comment-form {
352 353 margin-top: 10px;
353 354 margin-left: 10px;
354 355 }
355 356
356 357 .comment-inline-form .comment-block-ta,
357 358 .comment-form .comment-block-ta,
358 359 .comment-form .preview-box {
359 360 .border-radius(@border-radius);
360 361 .box-sizing(border-box);
361 362 background-color: white;
362 363 }
363 364
364 365 .comment-form-submit {
365 366 margin-top: 5px;
366 367 margin-left: 525px;
367 368 }
368 369
369 370 .file-comments {
370 371 display: none;
371 372 }
372 373
373 374 .comment-form .preview-box.unloaded,
374 375 .comment-inline-form .preview-box.unloaded {
375 376 height: 50px;
376 377 text-align: center;
377 378 padding: 20px;
378 379 background-color: white;
379 380 }
380 381
381 382 .comment-footer {
382 383 position: relative;
383 384 width: 100%;
384 385 min-height: 42px;
385 386
386 387 .status_box,
387 388 .cancel-button {
388 389 float: left;
389 390 display: inline-block;
390 391 }
391 392
392 393 .status_box {
393 394 margin-left: 10px;
394 395 }
395 396
396 397 .action-buttons {
397 398 float: left;
398 399 display: inline-block;
399 400 }
400 401
401 402 .action-buttons-extra {
402 403 display: inline-block;
403 404 }
404 405 }
405 406
406 407 .comment-form {
407 408
408 409 .comment {
409 410 margin-left: 10px;
410 411 }
411 412
412 413 .comment-help {
413 414 color: @grey4;
414 415 padding: 5px 0 5px 0;
415 416 }
416 417
417 418 .comment-title {
418 419 padding: 5px 0 5px 0;
419 420 }
420 421
421 422 .comment-button {
422 423 display: inline-block;
423 424 }
424 425
425 426 .comment-button-input {
426 427 margin-right: 0;
427 428 }
428 429
429 430 .comment-footer {
430 431 margin-bottom: 50px;
431 432 margin-top: 10px;
432 433 }
433 434 }
434 435
435 436
436 437 .comment-form-login {
437 438 .comment-help {
438 439 padding: 0.7em; //same as the button
439 440 }
440 441
441 442 div.clearfix {
442 443 clear: both;
443 444 width: 100%;
444 445 display: block;
445 446 }
446 447 }
447 448
448 449 .comment-version-select {
449 450 margin: 0px;
450 451 border-radius: inherit;
451 452 border-color: @grey6;
452 453 height: 20px;
453 454 }
454 455
455 456 .comment-type {
456 457 margin: 0px;
457 458 border-radius: inherit;
458 459 border-color: @grey6;
459 460 }
460 461
461 462 .preview-box {
462 463 min-height: 105px;
463 464 margin-bottom: 15px;
464 465 background-color: white;
465 466 .border-radius(@border-radius);
466 467 .box-sizing(border-box);
467 468 }
468 469
469 470 .add-another-button {
470 471 margin-left: 10px;
471 472 margin-top: 10px;
472 473 margin-bottom: 10px;
473 474 }
474 475
475 476 .comment .buttons {
476 477 float: right;
477 478 margin: -1px 0px 0px 0px;
478 479 }
479 480
480 481 // Inline Comment Form
481 482 .injected_diff .comment-inline-form,
482 483 .comment-inline-form {
483 484 background-color: white;
484 485 margin-top: 10px;
485 486 margin-bottom: 20px;
486 487 }
487 488
488 489 .inline-form {
489 490 padding: 10px 7px;
490 491 }
491 492
492 493 .inline-form div {
493 494 max-width: 100%;
494 495 }
495 496
496 497 .overlay {
497 498 display: none;
498 499 position: absolute;
499 500 width: 100%;
500 501 text-align: center;
501 502 vertical-align: middle;
502 503 font-size: 16px;
503 504 background: none repeat scroll 0 0 white;
504 505
505 506 &.submitting {
506 507 display: block;
507 508 opacity: 0.5;
508 509 z-index: 100;
509 510 }
510 511 }
511 512 .comment-inline-form .overlay.submitting .overlay-text {
512 513 margin-top: 5%;
513 514 }
514 515
515 516 .comment-inline-form .clearfix,
516 517 .comment-form .clearfix {
517 518 .border-radius(@border-radius);
518 519 margin: 0px;
519 520 }
520 521
521 522 .comment-inline-form .comment-footer {
522 523 margin: 10px 0px 0px 0px;
523 524 }
524 525
525 526 .hide-inline-form-button {
526 527 margin-left: 5px;
527 528 }
528 529 .comment-button .hide-inline-form {
529 530 background: white;
530 531 }
531 532
532 533 .comment-area {
533 534 padding: 6px 8px;
534 535 border: 1px solid @grey5;
535 536 .border-radius(@border-radius);
536 537
537 538 .resolve-action {
538 539 padding: 1px 0px 0px 6px;
539 540 }
540 541
541 542 }
542 543
543 544 comment-area-text {
544 545 color: @grey3;
545 546 }
546 547
547 548 .comment-area-header {
548 549 height: 35px;
549 550 }
550 551
551 552 .comment-area-header .nav-links {
552 553 display: flex;
553 554 flex-flow: row wrap;
554 555 -webkit-flex-flow: row wrap;
555 556 width: 100%;
556 557 }
557 558
558 559 .comment-area-footer {
559 560 min-height: 30px;
560 561 }
561 562
562 563 .comment-footer .toolbar {
563 564
564 565 }
565 566
566 567 .comment-attachment-uploader {
567 568 border: 1px dashed white;
568 569 border-radius: @border-radius;
569 570 margin-top: -10px;
570 571 line-height: 30px;
571 572 &.dz-drag-hover {
572 573 border-color: @grey3;
573 574 }
574 575
575 576 .dz-error-message {
576 577 padding-top: 0;
577 578 }
578 579 }
579 580
580 581 .comment-attachment-text {
581 582 clear: both;
582 583 font-size: 11px;
583 584 color: #8F8F8F;
584 585 width: 100%;
585 586 .pick-attachment {
586 587 color: #8F8F8F;
587 588 }
588 589 .pick-attachment:hover {
589 590 color: @rcblue;
590 591 }
591 592 }
592 593
593 594 .nav-links {
594 595 padding: 0;
595 596 margin: 0;
596 597 list-style: none;
597 598 height: auto;
598 599 border-bottom: 1px solid @grey5;
599 600 }
600 601 .nav-links li {
601 602 display: inline-block;
602 603 list-style-type: none;
603 604 }
604 605
605 606 .nav-links li a.disabled {
606 607 cursor: not-allowed;
607 608 }
608 609
609 610 .nav-links li.active a {
610 611 border-bottom: 2px solid @rcblue;
611 612 color: #000;
612 613 font-weight: 600;
613 614 }
614 615 .nav-links li a {
615 616 display: inline-block;
616 617 padding: 0px 10px 5px 10px;
617 618 margin-bottom: -1px;
618 619 font-size: 14px;
619 620 line-height: 28px;
620 621 color: #8f8f8f;
621 622 border-bottom: 2px solid transparent;
622 623 }
623 624
624 625 .toolbar-text {
625 626 float: right;
626 627 font-size: 11px;
627 628 color: @grey4;
628 629 text-align: right;
629 630
630 631 a {
631 632 color: @grey4;
632 633 }
633 634 }
634 635
@@ -1,481 +1,491 b''
1 1 ## -*- coding: utf-8 -*-
2 2 ## usage:
3 3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
4 4 ## ${comment.comment_block(comment)}
5 5 ##
6 6
7 7 <%!
8 8 from rhodecode.lib import html_filters
9 9 %>
10 10
11 11 <%namespace name="base" file="/base/base.mako"/>
12 12 <%def name="comment_block(comment, inline=False, active_pattern_entries=None)">
13 13 <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %>
14 14 <% latest_ver = len(getattr(c, 'versions', [])) %>
15 15 % if inline:
16 16 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
17 17 % else:
18 18 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
19 19 % endif
20 20
21 21 <div class="comment
22 22 ${'comment-inline' if inline else 'comment-general'}
23 23 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
24 24 id="comment-${comment.comment_id}"
25 25 line="${comment.line_no}"
26 26 data-comment-id="${comment.comment_id}"
27 27 data-comment-type="${comment.comment_type}"
28 28 data-comment-renderer="${comment.renderer}"
29 29 data-comment-text="${comment.text | html_filters.base64,n}"
30 30 data-comment-line-no="${comment.line_no}"
31 31 data-comment-inline=${h.json.dumps(inline)}
32 32 style="${'display: none;' if outdated_at_ver else ''}">
33 33
34 34 <div class="meta">
35 35 <div class="comment-type-label">
36 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}" title="line: ${comment.line_no}">
36 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
37
38 ## TODO COMMENT
37 39 % if comment.comment_type == 'todo':
38 40 % if comment.resolved:
39 41 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
42 <i class="icon-flag-filled"></i>
40 43 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
41 44 </div>
42 45 % else:
43 46 <div class="resolved tooltip" style="display: none">
44 47 <span>${comment.comment_type}</span>
45 48 </div>
46 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
49 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to create resolution comment.')}">
50 <i class="icon-flag-filled"></i>
47 51 ${comment.comment_type}
48 52 </div>
49 53 % endif
54 ## NOTE COMMENT
50 55 % else:
56 ## RESOLVED NOTE
51 57 % if comment.resolved_comment:
52 fix
53 <a href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.json.dumps(comment.resolved_comment.outdated)})">
54 <span style="text-decoration: line-through">#${comment.resolved_comment.comment_id}</span>
55 </a>
58 <div class="tooltip" title="${_('This comment resolves TODO #{}').format(comment.resolved_comment.comment_id)}">
59 fix
60 <a href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.json.dumps(comment.resolved_comment.outdated)})">
61 <span style="text-decoration: line-through">#${comment.resolved_comment.comment_id}</span>
62 </a>
63 </div>
64 ## STATUS CHANGE NOTE
65 % elif not comment.is_inline and comment.status_change:
66 <%
67 if comment.pull_request:
68 status_change_title = 'Status of review for pull request !{}'.format(comment.pull_request.pull_request_id)
69 else:
70 status_change_title = 'Status of review for commit {}'.format(h.short_id(comment.commit_id))
71 %>
72
73 <i class="icon-circle review-status-${comment.status_change[0].status}"></i>
74 <div class="changeset-status-lbl tooltip" title="${status_change_title}">
75 ${comment.status_change[0].status_lbl}
76 </div>
56 77 % else:
57 ${comment.comment_type or 'note'}
78 <div>
79 <i class="icon-comment"></i>
80 ${(comment.comment_type or 'note')}
81 </div>
58 82 % endif
59 83 % endif
84
60 85 </div>
61 86 </div>
62 87
88 % if 0 and comment.status_change:
89 <div class="pull-left">
90 <span class="tag authortag tooltip" title="${_('Status from pull request.')}">
91 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
92 ${'!{}'.format(comment.pull_request.pull_request_id)}
93 </a>
94 </span>
95 </div>
96 % endif
97
63 98 <div class="author ${'author-inline' if inline else 'author-general'}">
64 99 ${base.gravatar_with_user(comment.author.email, 16, tooltip=True)}
100 </div>
65 101
66 % if comment.pull_request and comment.pull_request.author.user_id == comment.author.user_id:
67 <span class="tag authortag tooltip" title="${_('Pull request author')}">
68 ${_('author')}
69 </span>
70 % endif
71
72 </div>
73 102 <div class="date">
74 103 ${h.age_component(comment.modified_at, time_is_local=True)}
75 104 </div>
105
106 % if comment.pull_request and comment.pull_request.author.user_id == comment.author.user_id:
107 <span class="tag authortag tooltip" title="${_('Pull request author')}">
108 ${_('author')}
109 </span>
110 % endif
111
76 112 <%
77 113 comment_version_selector = 'comment_versions_{}'.format(comment.comment_id)
78 114 %>
79 115
80 116 % if comment.history:
81 117 <div class="date">
82 118
83 119 <input id="${comment_version_selector}" name="${comment_version_selector}"
84 120 type="hidden"
85 121 data-last-version="${comment.history[-1].version}">
86 122
87 123 <script type="text/javascript">
88 124
89 125 var preLoadVersionData = [
90 126 % for comment_history in comment.history:
91 127 {
92 128 id: ${comment_history.comment_history_id},
93 129 text: 'v${comment_history.version}',
94 130 action: function () {
95 131 Rhodecode.comments.showVersion(
96 132 "${comment.comment_id}",
97 133 "${comment_history.comment_history_id}"
98 134 )
99 135 },
100 136 comment_version: "${comment_history.version}",
101 137 comment_author_username: "${comment_history.author.username}",
102 138 comment_author_gravatar: "${h.gravatar_url(comment_history.author.email, 16)}",
103 139 comment_created_on: '${h.age_component(comment_history.created_on, time_is_local=True)}',
104 140 },
105 141 % endfor
106 142 ]
107 143 initVersionSelector("#${comment_version_selector}", {results: preLoadVersionData});
108 144
109 145 </script>
110 146
111 147 </div>
112 148 % else:
113 149 <div class="date" style="display: none">
114 150 <input id="${comment_version_selector}" name="${comment_version_selector}"
115 151 type="hidden"
116 152 data-last-version="0">
117 153 </div>
118 154 %endif
119 % if inline:
120 <span></span>
121 % else:
122 <div class="status-change">
123 % if comment.pull_request:
124 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
125 % if comment.status_change:
126 ${_('pull request !{}').format(comment.pull_request.pull_request_id)}:
127 % else:
128 ${_('pull request !{}').format(comment.pull_request.pull_request_id)}
129 % endif
130 </a>
131 % else:
132 % if comment.status_change:
133 ${_('Status change on commit')}:
134 % endif
135 % endif
136 </div>
137 % endif
138
139 % if comment.status_change:
140 <i class="icon-circle review-status-${comment.status_change[0].status}"></i>
141 <div title="${_('Commit status')}" class="changeset-status-lbl">
142 ${comment.status_change[0].status_lbl}
143 </div>
144 % endif
145 155
146 156 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
147 157
148 158 <div class="comment-links-block">
149 159
150 160 % if inline:
151 161 <a class="pr-version-inline" href="${request.current_route_path(_query=dict(version=comment.pull_request_version_id), _anchor='comment-{}'.format(comment.comment_id))}">
152 162 % if outdated_at_ver:
153 <code class="pr-version-num" title="${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
163 <code class="tooltip pr-version-num" title="${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
154 164 outdated ${'v{}'.format(pr_index_ver)} |
155 165 </code>
156 166 % elif pr_index_ver:
157 <code class="pr-version-num" title="${_('Comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
167 <code class="tooltip pr-version-num" title="${_('Comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
158 168 ${'v{}'.format(pr_index_ver)} |
159 169 </code>
160 170 % endif
161 171 </a>
162 172 % else:
163 % if comment.pull_request_version_id and pr_index_ver:
173 % if pr_index_ver:
164 174
165 175 % if comment.outdated:
166 176 <a class="pr-version"
167 177 href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}"
168 178 >
169 179 ${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}
170 180 </a> |
171 181 % else:
172 <a class="pr-version"
182 <a class="tooltip pr-version"
173 183 title="${_('Comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}"
174 184 href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}"
175 185 >
176 186 <code class="pr-version-num">
177 187 ${'v{}'.format(pr_index_ver)}
178 188 </code>
179 189 </a> |
180 190 % endif
181 191
182 192 % endif
183 193 % endif
184 194
185 195 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
186 196 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
187 197 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
188 198 ## permissions to delete
189 199 %if comment.immutable is False and (c.is_super_admin or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id):
190 200 <a onclick="return Rhodecode.comments.editComment(this);"
191 201 class="edit-comment">${_('Edit')}</a>
192 202 | <a onclick="return Rhodecode.comments.deleteComment(this);"
193 203 class="delete-comment">${_('Delete')}</a>
194 204 %else:
195 205 <a class="tooltip edit-comment link-disabled" disabled="disabled" title="${_('Action unavailable')}">${_('Edit')}</a>
196 206 | <a class="tooltip edit-comment link-disabled" disabled="disabled" title="${_('Action unavailable')}">${_('Delete')}</a>
197 207 %endif
198 208 %else:
199 209 <a class="tooltip edit-comment link-disabled" disabled="disabled" title="${_('Action unavailable')}">${_('Edit')}</a>
200 210 | <a class="tooltip edit-comment link-disabled" disabled="disabled" title="${_('Action unavailable')}">${_('Delete')}</a>
201 211 %endif
202 212
203 213 % if outdated_at_ver:
204 214 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="tooltip prev-comment" title="${_('Jump to the previous outdated comment')}"> <i class="icon-angle-left"></i> </a>
205 215 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="tooltip next-comment" title="${_('Jump to the next outdated comment')}"> <i class="icon-angle-right"></i></a>
206 216 % else:
207 217 | <a onclick="return Rhodecode.comments.prevComment(this);" class="tooltip prev-comment" title="${_('Jump to the previous comment')}"> <i class="icon-angle-left"></i></a>
208 218 | <a onclick="return Rhodecode.comments.nextComment(this);" class="tooltip next-comment" title="${_('Jump to the next comment')}"> <i class="icon-angle-right"></i></a>
209 219 % endif
210 220
211 221 </div>
212 222 </div>
213 223 <div class="text">
214 224 ${h.render(comment.text, renderer=comment.renderer, mentions=True, repo_name=getattr(c, 'repo_name', None), active_pattern_entries=active_pattern_entries)}
215 225 </div>
216 226
217 227 </div>
218 228 </%def>
219 229
220 230 ## generate main comments
221 231 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
222 232 <%
223 233 active_pattern_entries = h.get_active_pattern_entries(getattr(c, 'repo_name', None))
224 234 %>
225 235
226 236 <div class="general-comments" id="comments">
227 237 %for comment in comments:
228 238 <div id="comment-tr-${comment.comment_id}">
229 239 ## only render comments that are not from pull request, or from
230 240 ## pull request and a status change
231 241 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
232 242 ${comment_block(comment, active_pattern_entries=active_pattern_entries)}
233 243 %endif
234 244 </div>
235 245 %endfor
236 246 ## to anchor ajax comments
237 247 <div id="injected_page_comments"></div>
238 248 </div>
239 249 </%def>
240 250
241 251
242 252 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
243 253
244 254 <div class="comments">
245 255 <%
246 256 if is_pull_request:
247 257 placeholder = _('Leave a comment on this Pull Request.')
248 258 elif is_compare:
249 259 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
250 260 else:
251 261 placeholder = _('Leave a comment on this Commit.')
252 262 %>
253 263
254 264 % if c.rhodecode_user.username != h.DEFAULT_USER:
255 265 <div class="js-template" id="cb-comment-general-form-template">
256 266 ## template generated for injection
257 267 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
258 268 </div>
259 269
260 270 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
261 271 ## inject form here
262 272 </div>
263 273 <script type="text/javascript">
264 274 var lineNo = 'general';
265 275 var resolvesCommentId = null;
266 276 var generalCommentForm = Rhodecode.comments.createGeneralComment(
267 277 lineNo, "${placeholder}", resolvesCommentId);
268 278
269 279 // set custom success callback on rangeCommit
270 280 % if is_compare:
271 281 generalCommentForm.setHandleFormSubmit(function(o) {
272 282 var self = generalCommentForm;
273 283
274 284 var text = self.cm.getValue();
275 285 var status = self.getCommentStatus();
276 286 var commentType = self.getCommentType();
277 287
278 288 if (text === "" && !status) {
279 289 return;
280 290 }
281 291
282 292 // we can pick which commits we want to make the comment by
283 293 // selecting them via click on preview pane, this will alter the hidden inputs
284 294 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
285 295
286 296 var commitIds = [];
287 297 $('#changeset_compare_view_content .compare_select').each(function(el) {
288 298 var commitId = this.id.replace('row-', '');
289 299 if ($(this).hasClass('hl') || !cherryPicked) {
290 300 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
291 301 commitIds.push(commitId);
292 302 } else {
293 303 $("input[data-commit-id='{0}']".format(commitId)).val('')
294 304 }
295 305 });
296 306
297 307 self.setActionButtonsDisabled(true);
298 308 self.cm.setOption("readOnly", true);
299 309 var postData = {
300 310 'text': text,
301 311 'changeset_status': status,
302 312 'comment_type': commentType,
303 313 'commit_ids': commitIds,
304 314 'csrf_token': CSRF_TOKEN
305 315 };
306 316
307 317 var submitSuccessCallback = function(o) {
308 318 location.reload(true);
309 319 };
310 320 var submitFailCallback = function(){
311 321 self.resetCommentFormState(text)
312 322 };
313 323 self.submitAjaxPOST(
314 324 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
315 325 });
316 326 % endif
317 327
318 328 </script>
319 329 % else:
320 330 ## form state when not logged in
321 331 <div class="comment-form ac">
322 332
323 333 <div class="comment-area">
324 334 <div class="comment-area-header">
325 335 <ul class="nav-links clearfix">
326 336 <li class="active">
327 337 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
328 338 </li>
329 339 <li class="">
330 340 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
331 341 </li>
332 342 </ul>
333 343 </div>
334 344
335 345 <div class="comment-area-write" style="display: block;">
336 346 <div id="edit-container">
337 347 <div style="padding: 40px 0">
338 348 ${_('You need to be logged in to leave comments.')}
339 349 <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
340 350 </div>
341 351 </div>
342 352 <div id="preview-container" class="clearfix" style="display: none;">
343 353 <div id="preview-box" class="preview-box"></div>
344 354 </div>
345 355 </div>
346 356
347 357 <div class="comment-area-footer">
348 358 <div class="toolbar">
349 359 <div class="toolbar-text">
350 360 </div>
351 361 </div>
352 362 </div>
353 363 </div>
354 364
355 365 <div class="comment-footer">
356 366 </div>
357 367
358 368 </div>
359 369 % endif
360 370
361 371 <script type="text/javascript">
362 372 bindToggleButtons();
363 373 </script>
364 374 </div>
365 375 </%def>
366 376
367 377
368 378 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
369 379
370 380 ## comment injected based on assumption that user is logged in
371 381 <form ${('id="{}"'.format(form_id) if form_id else '') |n} action="#" method="GET">
372 382
373 383 <div class="comment-area">
374 384 <div class="comment-area-header">
375 385 <div class="pull-left">
376 386 <ul class="nav-links clearfix">
377 387 <li class="active">
378 388 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
379 389 </li>
380 390 <li class="">
381 391 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
382 392 </li>
383 393 </ul>
384 394 </div>
385 395 <div class="pull-right">
386 396 <span class="comment-area-text">${_('Mark as')}:</span>
387 397 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
388 398 % for val in c.visual.comment_types:
389 399 <option value="${val}">${val.upper()}</option>
390 400 % endfor
391 401 </select>
392 402 </div>
393 403 </div>
394 404
395 405 <div class="comment-area-write" style="display: block;">
396 406 <div id="edit-container_${lineno_id}">
397 407 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
398 408 </div>
399 409 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
400 410 <div id="preview-box_${lineno_id}" class="preview-box"></div>
401 411 </div>
402 412 </div>
403 413
404 414 <div class="comment-area-footer comment-attachment-uploader">
405 415 <div class="toolbar">
406 416
407 417 <div class="comment-attachment-text">
408 418 <div class="dropzone-text">
409 419 ${_("Drag'n Drop files here or")} <span class="link pick-attachment">${_('Choose your files')}</span>.<br>
410 420 </div>
411 421 <div class="dropzone-upload" style="display:none">
412 422 <i class="icon-spin animate-spin"></i> ${_('uploading...')}
413 423 </div>
414 424 </div>
415 425
416 426 ## comments dropzone template, empty on purpose
417 427 <div style="display: none" class="comment-attachment-uploader-template">
418 428 <div class="dz-file-preview" style="margin: 0">
419 429 <div class="dz-error-message"></div>
420 430 </div>
421 431 </div>
422 432
423 433 </div>
424 434 </div>
425 435 </div>
426 436
427 437 <div class="comment-footer">
428 438
429 439 ## inject extra inputs into the form
430 440 % if form_extras and isinstance(form_extras, (list, tuple)):
431 441 <div id="comment_form_extras">
432 442 % for form_ex_el in form_extras:
433 443 ${form_ex_el|n}
434 444 % endfor
435 445 </div>
436 446 % endif
437 447
438 448 <div class="action-buttons">
439 449 % if form_type != 'inline':
440 450 <div class="action-buttons-extra"></div>
441 451 % endif
442 452
443 453 <input class="btn btn-success comment-button-input" id="save_${lineno_id}" name="save" type="submit" value="${_('Comment')}">
444 454
445 455 ## inline for has a file, and line-number together with cancel hide button.
446 456 % if form_type == 'inline':
447 457 <input type="hidden" name="f_path" value="{0}">
448 458 <input type="hidden" name="line" value="${lineno_id}">
449 459 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
450 460 ${_('Cancel')}
451 461 </button>
452 462 % endif
453 463 </div>
454 464
455 465 % if review_statuses:
456 466 <div class="status_box">
457 467 <select id="change_status_${lineno_id}" name="changeset_status">
458 468 <option></option> ## Placeholder
459 469 % for status, lbl in review_statuses:
460 470 <option value="${status}" data-status="${status}">${lbl}</option>
461 471 %if is_pull_request and change_status and status in ('approved', 'rejected'):
462 472 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
463 473 %endif
464 474 % endfor
465 475 </select>
466 476 </div>
467 477 % endif
468 478
469 479 <div class="toolbar-text">
470 480 <% renderer_url = '<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper()) %>
471 481 ${_('Comments parsed using {} syntax.').format(renderer_url)|n} <br/>
472 482 <span class="tooltip" title="${_('Use @username inside this text to send notification to this RhodeCode user')}">@mention</span>
473 483 ${_('and')}
474 484 <span class="tooltip" title="${_('Start typing with / for certain actions to be triggered via text box.')}">`/` autocomplete</span>
475 485 ${_('actions supported.')}
476 486 </div>
477 487 </div>
478 488
479 489 </form>
480 490
481 491 </%def> No newline at end of file
@@ -1,1215 +1,1218 b''
1 1 <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/>
2 2
3 3 <%def name="diff_line_anchor(commit, filename, line, type)"><%
4 4 return '%s_%s_%i' % (h.md5_safe(commit+filename), type, line)
5 5 %></%def>
6 6
7 7 <%def name="action_class(action)">
8 8 <%
9 9 return {
10 10 '-': 'cb-deletion',
11 11 '+': 'cb-addition',
12 12 ' ': 'cb-context',
13 13 }.get(action, 'cb-empty')
14 14 %>
15 15 </%def>
16 16
17 17 <%def name="op_class(op_id)">
18 18 <%
19 19 return {
20 20 DEL_FILENODE: 'deletion', # file deleted
21 21 BIN_FILENODE: 'warning' # binary diff hidden
22 22 }.get(op_id, 'addition')
23 23 %>
24 24 </%def>
25 25
26 26
27 27
28 28 <%def name="render_diffset(diffset, commit=None,
29 29
30 30 # collapse all file diff entries when there are more than this amount of files in the diff
31 31 collapse_when_files_over=20,
32 32
33 33 # collapse lines in the diff when more than this amount of lines changed in the file diff
34 34 lines_changed_limit=500,
35 35
36 36 # add a ruler at to the output
37 37 ruler_at_chars=0,
38 38
39 39 # show inline comments
40 40 use_comments=False,
41 41
42 42 # disable new comments
43 43 disable_new_comments=False,
44 44
45 45 # special file-comments that were deleted in previous versions
46 46 # it's used for showing outdated comments for deleted files in a PR
47 47 deleted_files_comments=None,
48 48
49 49 # for cache purpose
50 50 inline_comments=None,
51 51
52 52 # additional menu for PRs
53 53 pull_request_menu=None,
54 54
55 55 # show/hide todo next to comments
56 56 show_todos=True,
57 57
58 58 )">
59 59
60 60 <%
61 61 diffset_container_id = h.md5(diffset.target_ref)
62 62 collapse_all = len(diffset.files) > collapse_when_files_over
63 63 active_pattern_entries = h.get_active_pattern_entries(getattr(c, 'repo_name', None))
64 64 %>
65 65
66 66 %if use_comments:
67 67
68 68 ## Template for injecting comments
69 69 <div id="cb-comments-inline-container-template" class="js-template">
70 70 ${inline_comments_container([])}
71 71 </div>
72 72
73 73 <div class="js-template" id="cb-comment-inline-form-template">
74 74 <div class="comment-inline-form ac">
75 75
76 76 %if c.rhodecode_user.username != h.DEFAULT_USER:
77 77 ## render template for inline comments
78 78 ${commentblock.comment_form(form_type='inline')}
79 79 %else:
80 80 ${h.form('', class_='inline-form comment-form-login', method='get')}
81 81 <div class="pull-left">
82 82 <div class="comment-help pull-right">
83 83 ${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
84 84 </div>
85 85 </div>
86 86 <div class="comment-button pull-right">
87 87 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
88 88 ${_('Cancel')}
89 89 </button>
90 90 </div>
91 91 <div class="clearfix"></div>
92 92 ${h.end_form()}
93 93 %endif
94 94 </div>
95 95 </div>
96 96
97 97 %endif
98 98
99 99 %if c.user_session_attrs["diffmode"] == 'sideside':
100 100 <style>
101 101 .wrapper {
102 102 max-width: 1600px !important;
103 103 }
104 104 </style>
105 105 %endif
106 106
107 107 %if ruler_at_chars:
108 108 <style>
109 109 .diff table.cb .cb-content:after {
110 110 content: "";
111 111 border-left: 1px solid blue;
112 112 position: absolute;
113 113 top: 0;
114 114 height: 18px;
115 115 opacity: .2;
116 116 z-index: 10;
117 117 //## +5 to account for diff action (+/-)
118 118 left: ${ruler_at_chars + 5}ch;
119 119 </style>
120 120 %endif
121 121
122 122 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
123 123
124 124 <div style="height: 20px; line-height: 20px">
125 125 ## expand/collapse action
126 126 <div class="pull-left">
127 127 <a class="${'collapsed' if collapse_all else ''}" href="#expand-files" onclick="toggleExpand(this, '${diffset_container_id}'); return false">
128 128 % if collapse_all:
129 129 <i class="icon-plus-squared-alt icon-no-margin"></i>${_('Expand all files')}
130 130 % else:
131 131 <i class="icon-minus-squared-alt icon-no-margin"></i>${_('Collapse all files')}
132 132 % endif
133 133 </a>
134 134
135 135 </div>
136 136
137 137 ## todos
138 138 % if show_todos and getattr(c, 'at_version', None):
139 139 <div class="pull-right">
140 140 <i class="icon-flag-filled" style="color: #949494">TODOs:</i>
141 141 ${_('not available in this view')}
142 142 </div>
143 143 % elif show_todos:
144 144 <div class="pull-right">
145 145 <div class="comments-number" style="padding-left: 10px">
146 146 % if hasattr(c, 'unresolved_comments') and hasattr(c, 'resolved_comments'):
147 147 <i class="icon-flag-filled" style="color: #949494">TODOs:</i>
148 148 % if c.unresolved_comments:
149 149 <a href="#show-todos" onclick="$('#todo-box').toggle(); return false">
150 150 ${_('{} unresolved').format(len(c.unresolved_comments))}
151 151 </a>
152 152 % else:
153 153 ${_('0 unresolved')}
154 154 % endif
155 155
156 156 ${_('{} Resolved').format(len(c.resolved_comments))}
157 157 % endif
158 158 </div>
159 159 </div>
160 160 % endif
161 161
162 162 ## comments
163 163 <div class="pull-right">
164 164 <div class="comments-number" style="padding-left: 10px">
165 165 % if hasattr(c, 'comments') and hasattr(c, 'inline_cnt'):
166 166 <i class="icon-comment" style="color: #949494">COMMENTS:</i>
167 167 % if c.comments:
168 168 <a href="#comments">${_ungettext("{} General", "{} General", len(c.comments)).format(len(c.comments))}</a>,
169 169 % else:
170 170 ${_('0 General')}
171 171 % endif
172 172
173 173 % if c.inline_cnt:
174 174 <a href="#" onclick="return Rhodecode.comments.nextComment();"
175 175 id="inline-comments-counter">${_ungettext("{} Inline", "{} Inline", c.inline_cnt).format(c.inline_cnt)}
176 176 </a>
177 177 % else:
178 178 ${_('0 Inline')}
179 179 % endif
180 180 % endif
181 181
182 182 % if pull_request_menu:
183 183 <%
184 184 outdated_comm_count_ver = pull_request_menu['outdated_comm_count_ver']
185 185 %>
186 186
187 187 % if outdated_comm_count_ver:
188 188 <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">
189 189 (${_("{} Outdated").format(outdated_comm_count_ver)})
190 190 </a>
191 191 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated')}</a>
192 192 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated')}</a>
193 193 % else:
194 194 (${_("{} Outdated").format(outdated_comm_count_ver)})
195 195 % endif
196 196
197 197 % endif
198 198
199 199 </div>
200 200 </div>
201 201
202 202 </div>
203 203
204 204 % if diffset.limited_diff:
205 205 <div class="diffset-heading ${(diffset.limited_diff and 'diffset-heading-warning' or '')}">
206 206 <h2 class="clearinner">
207 207 ${_('The requested changes are too big and content was truncated.')}
208 208 <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
209 209 </h2>
210 210 </div>
211 211 ## commit range header for each individual diff
212 212 % elif commit and hasattr(c, 'commit_ranges') and len(c.commit_ranges) > 1:
213 213 <div class="diffset-heading ${(diffset.limited_diff and 'diffset-heading-warning' or '')}">
214 214 <div class="clearinner">
215 215 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=diffset.repo_name,commit_id=commit.raw_id)}">${('r%s:%s' % (commit.idx,h.short_id(commit.raw_id)))}</a>
216 216 </div>
217 217 </div>
218 218 % endif
219 219
220 220 <div id="todo-box">
221 221 % if hasattr(c, 'unresolved_comments') and c.unresolved_comments:
222 222 % for co in c.unresolved_comments:
223 223 <a class="permalink" href="#comment-${co.comment_id}"
224 224 onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))">
225 225 <i class="icon-flag-filled-red"></i>
226 226 ${co.comment_id}</a>${('' if loop.last else ',')}
227 227 % endfor
228 228 % endif
229 229 </div>
230 230 %if diffset.has_hidden_changes:
231 231 <p class="empty_data">${_('Some changes may be hidden')}</p>
232 232 %elif not diffset.files:
233 233 <p class="empty_data">${_('No files')}</p>
234 234 %endif
235 235
236 236 <div class="filediffs">
237 237
238 238 ## initial value could be marked as False later on
239 239 <% over_lines_changed_limit = False %>
240 240 %for i, filediff in enumerate(diffset.files):
241 241
242 242 <%
243 243 lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
244 244 over_lines_changed_limit = lines_changed > lines_changed_limit
245 245 %>
246 246 ## anchor with support of sticky header
247 247 <div class="anchor" id="a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></div>
248 248
249 249 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state collapse-${diffset_container_id}" id="filediff-collapse-${id(filediff)}" type="checkbox" onchange="updateSticky();">
250 250 <div
251 251 class="filediff"
252 252 data-f-path="${filediff.patch['filename']}"
253 253 data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}"
254 254 >
255 255 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
256 256 <%
257 257 file_comments = (get_inline_comments(inline_comments, filediff.patch['filename']) or {}).values()
258 258 total_file_comments = [_c for _c in h.itertools.chain.from_iterable(file_comments) if not _c.outdated]
259 259 %>
260 260 <div class="filediff-collapse-indicator icon-"></div>
261 261 <span class="pill-group pull-right" >
262 <span class="pill"><i class="icon-comment"></i> ${len(total_file_comments)}</span>
262 <span class="pill" op="comments">
263
264 <i class="icon-comment"></i> ${len(total_file_comments)}
265 </span>
263 266 </span>
264 267 ${diff_ops(filediff)}
265 268
266 269 </label>
267 270
268 271 ${diff_menu(filediff, use_comments=use_comments)}
269 272 <table data-f-path="${filediff.patch['filename']}" data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}" class="code-visible-block cb cb-diff-${c.user_session_attrs["diffmode"]} code-highlight ${(over_lines_changed_limit and 'cb-collapsed' or '')}">
270 273
271 274 ## new/deleted/empty content case
272 275 % if not filediff.hunks:
273 276 ## Comment container, on "fakes" hunk that contains all data to render comments
274 277 ${render_hunk_lines(filediff, c.user_session_attrs["diffmode"], filediff.hunk_ops, use_comments=use_comments, inline_comments=inline_comments, active_pattern_entries=active_pattern_entries)}
275 278 % endif
276 279
277 280 %if filediff.limited_diff:
278 281 <tr class="cb-warning cb-collapser">
279 282 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
280 283 ${_('The requested commit or file is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
281 284 </td>
282 285 </tr>
283 286 %else:
284 287 %if over_lines_changed_limit:
285 288 <tr class="cb-warning cb-collapser">
286 289 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
287 290 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
288 291 <a href="#" class="cb-expand"
289 292 onclick="$(this).closest('table').removeClass('cb-collapsed'); updateSticky(); return false;">${_('Show them')}
290 293 </a>
291 294 <a href="#" class="cb-collapse"
292 295 onclick="$(this).closest('table').addClass('cb-collapsed'); updateSticky(); return false;">${_('Hide them')}
293 296 </a>
294 297 </td>
295 298 </tr>
296 299 %endif
297 300 %endif
298 301
299 302 % for hunk in filediff.hunks:
300 303 <tr class="cb-hunk">
301 304 <td ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=3' or '')}>
302 305 ## TODO: dan: add ajax loading of more context here
303 306 ## <a href="#">
304 307 <i class="icon-more"></i>
305 308 ## </a>
306 309 </td>
307 310 <td ${(c.user_session_attrs["diffmode"] == 'sideside' and 'colspan=5' or '')}>
308 311 @@
309 312 -${hunk.source_start},${hunk.source_length}
310 313 +${hunk.target_start},${hunk.target_length}
311 314 ${hunk.section_header}
312 315 </td>
313 316 </tr>
314 317 ${render_hunk_lines(filediff, c.user_session_attrs["diffmode"], hunk, use_comments=use_comments, inline_comments=inline_comments, active_pattern_entries=active_pattern_entries)}
315 318 % endfor
316 319
317 320 <% unmatched_comments = (inline_comments or {}).get(filediff.patch['filename'], {}) %>
318 321
319 322 ## outdated comments that do not fit into currently displayed lines
320 323 % for lineno, comments in unmatched_comments.items():
321 324
322 325 %if c.user_session_attrs["diffmode"] == 'unified':
323 326 % if loop.index == 0:
324 327 <tr class="cb-hunk">
325 328 <td colspan="3"></td>
326 329 <td>
327 330 <div>
328 331 ${_('Unmatched/outdated inline comments below')}
329 332 </div>
330 333 </td>
331 334 </tr>
332 335 % endif
333 336 <tr class="cb-line">
334 337 <td class="cb-data cb-context"></td>
335 338 <td class="cb-lineno cb-context"></td>
336 339 <td class="cb-lineno cb-context"></td>
337 340 <td class="cb-content cb-context">
338 341 ${inline_comments_container(comments, active_pattern_entries=active_pattern_entries)}
339 342 </td>
340 343 </tr>
341 344 %elif c.user_session_attrs["diffmode"] == 'sideside':
342 345 % if loop.index == 0:
343 346 <tr class="cb-comment-info">
344 347 <td colspan="2"></td>
345 348 <td class="cb-line">
346 349 <div>
347 350 ${_('Unmatched/outdated inline comments below')}
348 351 </div>
349 352 </td>
350 353 <td colspan="2"></td>
351 354 <td class="cb-line">
352 355 <div>
353 356 ${_('Unmatched/outdated comments below')}
354 357 </div>
355 358 </td>
356 359 </tr>
357 360 % endif
358 361 <tr class="cb-line">
359 362 <td class="cb-data cb-context"></td>
360 363 <td class="cb-lineno cb-context"></td>
361 364 <td class="cb-content cb-context">
362 365 % if lineno.startswith('o'):
363 366 ${inline_comments_container(comments, active_pattern_entries=active_pattern_entries)}
364 367 % endif
365 368 </td>
366 369
367 370 <td class="cb-data cb-context"></td>
368 371 <td class="cb-lineno cb-context"></td>
369 372 <td class="cb-content cb-context">
370 373 % if lineno.startswith('n'):
371 374 ${inline_comments_container(comments, active_pattern_entries=active_pattern_entries)}
372 375 % endif
373 376 </td>
374 377 </tr>
375 378 %endif
376 379
377 380 % endfor
378 381
379 382 </table>
380 383 </div>
381 384 %endfor
382 385
383 386 ## outdated comments that are made for a file that has been deleted
384 387 % for filename, comments_dict in (deleted_files_comments or {}).items():
385 388
386 389 <%
387 390 display_state = 'display: none'
388 391 open_comments_in_file = [x for x in comments_dict['comments'] if x.outdated is False]
389 392 if open_comments_in_file:
390 393 display_state = ''
391 394 fid = str(id(filename))
392 395 %>
393 396 <div class="filediffs filediff-outdated" style="${display_state}">
394 397 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state collapse-${diffset_container_id}" id="filediff-collapse-${id(filename)}" type="checkbox" onchange="updateSticky();">
395 398 <div class="filediff" data-f-path="${filename}" id="a_${h.FID(fid, filename)}">
396 399 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
397 400 <div class="filediff-collapse-indicator icon-"></div>
398 401
399 402 <span class="pill">
400 403 ## file was deleted
401 404 ${filename}
402 405 </span>
403 406 <span class="pill-group pull-left" >
404 407 ## file op, doesn't need translation
405 408 <span class="pill" op="removed">unresolved comments</span>
406 409 </span>
407 410 <a class="pill filediff-anchor" href="#a_${h.FID(fid, filename)}"></a>
408 411 <span class="pill-group pull-right">
409 412 <span class="pill" op="deleted">
410 413 % if comments_dict['stats'] >0:
411 414 -${comments_dict['stats']}
412 415 % else:
413 416 ${comments_dict['stats']}
414 417 % endif
415 418 </span>
416 419 </span>
417 420 </label>
418 421
419 422 <table class="cb cb-diff-${c.user_session_attrs["diffmode"]} code-highlight ${(over_lines_changed_limit and 'cb-collapsed' or '')}">
420 423 <tr>
421 424 % if c.user_session_attrs["diffmode"] == 'unified':
422 425 <td></td>
423 426 %endif
424 427
425 428 <td></td>
426 429 <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=5')}>
427 430 <strong>${_('This file was removed from diff during updates to this pull-request.')}</strong><br/>
428 431 ${_('There are still outdated/unresolved comments attached to it.')}
429 432 </td>
430 433 </tr>
431 434 %if c.user_session_attrs["diffmode"] == 'unified':
432 435 <tr class="cb-line">
433 436 <td class="cb-data cb-context"></td>
434 437 <td class="cb-lineno cb-context"></td>
435 438 <td class="cb-lineno cb-context"></td>
436 439 <td class="cb-content cb-context">
437 440 ${inline_comments_container(comments_dict['comments'], active_pattern_entries=active_pattern_entries)}
438 441 </td>
439 442 </tr>
440 443 %elif c.user_session_attrs["diffmode"] == 'sideside':
441 444 <tr class="cb-line">
442 445 <td class="cb-data cb-context"></td>
443 446 <td class="cb-lineno cb-context"></td>
444 447 <td class="cb-content cb-context"></td>
445 448
446 449 <td class="cb-data cb-context"></td>
447 450 <td class="cb-lineno cb-context"></td>
448 451 <td class="cb-content cb-context">
449 452 ${inline_comments_container(comments_dict['comments'], active_pattern_entries=active_pattern_entries)}
450 453 </td>
451 454 </tr>
452 455 %endif
453 456 </table>
454 457 </div>
455 458 </div>
456 459 % endfor
457 460
458 461 </div>
459 462 </div>
460 463 </%def>
461 464
462 465 <%def name="diff_ops(filediff)">
463 466 <%
464 467 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
465 468 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
466 469 %>
467 470 <span class="pill">
468 471 <i class="icon-file-text"></i>
469 472 %if filediff.source_file_path and filediff.target_file_path:
470 473 %if filediff.source_file_path != filediff.target_file_path:
471 474 ## file was renamed, or copied
472 475 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
473 476 ${filediff.target_file_path}<del>${filediff.source_file_path}</del>
474 477 <% final_path = filediff.target_file_path %>
475 478 %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
476 479 ${filediff.target_file_path}${filediff.source_file_path}
477 480 <% final_path = filediff.target_file_path %>
478 481 %endif
479 482 %else:
480 483 ## file was modified
481 484 ${filediff.source_file_path}
482 485 <% final_path = filediff.source_file_path %>
483 486 %endif
484 487 %else:
485 488 %if filediff.source_file_path:
486 489 ## file was deleted
487 490 ${filediff.source_file_path}
488 491 <% final_path = filediff.source_file_path %>
489 492 %else:
490 493 ## file was added
491 494 ${filediff.target_file_path}
492 495 <% final_path = filediff.target_file_path %>
493 496 %endif
494 497 %endif
495 498 <i style="color: #aaa" class="on-hover-icon icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy file path')}" onclick="return false;"></i>
496 499 </span>
497 500 ## anchor link
498 501 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></a>
499 502
500 503 <span class="pill-group pull-right">
501 504
502 505 ## ops pills
503 506 %if filediff.limited_diff:
504 507 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
505 508 %endif
506 509
507 510 %if NEW_FILENODE in filediff.patch['stats']['ops']:
508 511 <span class="pill" op="created">created</span>
509 512 %if filediff['target_mode'].startswith('120'):
510 513 <span class="pill" op="symlink">symlink</span>
511 514 %else:
512 515 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
513 516 %endif
514 517 %endif
515 518
516 519 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
517 520 <span class="pill" op="renamed">renamed</span>
518 521 %endif
519 522
520 523 %if COPIED_FILENODE in filediff.patch['stats']['ops']:
521 524 <span class="pill" op="copied">copied</span>
522 525 %endif
523 526
524 527 %if DEL_FILENODE in filediff.patch['stats']['ops']:
525 528 <span class="pill" op="removed">removed</span>
526 529 %endif
527 530
528 531 %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
529 532 <span class="pill" op="mode">
530 533 ${nice_mode(filediff['source_mode'])}${nice_mode(filediff['target_mode'])}
531 534 </span>
532 535 %endif
533 536
534 537 %if BIN_FILENODE in filediff.patch['stats']['ops']:
535 538 <span class="pill" op="binary">binary</span>
536 539 %if MOD_FILENODE in filediff.patch['stats']['ops']:
537 540 <span class="pill" op="modified">modified</span>
538 541 %endif
539 542 %endif
540 543
541 544 <span class="pill" op="added">${('+' if filediff.patch['stats']['added'] else '')}${filediff.patch['stats']['added']}</span>
542 545 <span class="pill" op="deleted">${((h.safe_int(filediff.patch['stats']['deleted']) or 0) * -1)}</span>
543 546
544 547 </span>
545 548
546 549 </%def>
547 550
548 551 <%def name="nice_mode(filemode)">
549 552 ${(filemode.startswith('100') and filemode[3:] or filemode)}
550 553 </%def>
551 554
552 555 <%def name="diff_menu(filediff, use_comments=False)">
553 556 <div class="filediff-menu">
554 557
555 558 %if filediff.diffset.source_ref:
556 559
557 560 ## FILE BEFORE CHANGES
558 561 %if filediff.operation in ['D', 'M']:
559 562 <a
560 563 class="tooltip"
561 564 href="${h.route_path('repo_files',repo_name=filediff.diffset.target_repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
562 565 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
563 566 >
564 567 ${_('Show file before')}
565 568 </a> |
566 569 %else:
567 570 <span
568 571 class="tooltip"
569 572 title="${h.tooltip(_('File not present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
570 573 >
571 574 ${_('Show file before')}
572 575 </span> |
573 576 %endif
574 577
575 578 ## FILE AFTER CHANGES
576 579 %if filediff.operation in ['A', 'M']:
577 580 <a
578 581 class="tooltip"
579 582 href="${h.route_path('repo_files',repo_name=filediff.diffset.source_repo_name,commit_id=filediff.diffset.target_ref,f_path=filediff.target_file_path)}"
580 583 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
581 584 >
582 585 ${_('Show file after')}
583 586 </a>
584 587 %else:
585 588 <span
586 589 class="tooltip"
587 590 title="${h.tooltip(_('File not present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
588 591 >
589 592 ${_('Show file after')}
590 593 </span>
591 594 %endif
592 595
593 596 % if use_comments:
594 597 |
595 598 <a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
596 599 <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
597 600 </a>
598 601 % endif
599 602
600 603 %endif
601 604
602 605 </div>
603 606 </%def>
604 607
605 608
606 609 <%def name="inline_comments_container(comments, active_pattern_entries=None)">
607 610
608 611 <div class="inline-comments">
609 612 %for comment in comments:
610 613 ${commentblock.comment_block(comment, inline=True, active_pattern_entries=active_pattern_entries)}
611 614 %endfor
612 615 % if comments and comments[-1].outdated:
613 616 <span class="btn btn-secondary cb-comment-add-button comment-outdated}" style="display: none;}">
614 617 ${_('Add another comment')}
615 618 </span>
616 619 % else:
617 620 <span onclick="return Rhodecode.comments.createComment(this)" class="btn btn-secondary cb-comment-add-button">
618 621 ${_('Add another comment')}
619 622 </span>
620 623 % endif
621 624
622 625 </div>
623 626 </%def>
624 627
625 628 <%!
626 629
627 630 def get_inline_comments(comments, filename):
628 631 if hasattr(filename, 'unicode_path'):
629 632 filename = filename.unicode_path
630 633
631 634 if not isinstance(filename, (unicode, str)):
632 635 return None
633 636
634 637 if comments and filename in comments:
635 638 return comments[filename]
636 639
637 640 return None
638 641
639 642 def get_comments_for(diff_type, comments, filename, line_version, line_number):
640 643 if hasattr(filename, 'unicode_path'):
641 644 filename = filename.unicode_path
642 645
643 646 if not isinstance(filename, (unicode, str)):
644 647 return None
645 648
646 649 file_comments = get_inline_comments(comments, filename)
647 650 if file_comments is None:
648 651 return None
649 652
650 653 line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12
651 654 if line_key in file_comments:
652 655 data = file_comments.pop(line_key)
653 656 return data
654 657 %>
655 658
656 659 <%def name="render_hunk_lines_sideside(filediff, hunk, use_comments=False, inline_comments=None, active_pattern_entries=None)">
657 660 %for i, line in enumerate(hunk.sideside):
658 661 <%
659 662 old_line_anchor, new_line_anchor = None, None
660 663
661 664 if line.original.lineno:
662 665 old_line_anchor = diff_line_anchor(filediff.raw_id, hunk.source_file_path, line.original.lineno, 'o')
663 666 if line.modified.lineno:
664 667 new_line_anchor = diff_line_anchor(filediff.raw_id, hunk.target_file_path, line.modified.lineno, 'n')
665 668 %>
666 669
667 670 <tr class="cb-line">
668 671 <td class="cb-data ${action_class(line.original.action)}"
669 672 data-line-no="${line.original.lineno}"
670 673 >
671 674 <div>
672 675
673 676 <% line_old_comments = None %>
674 677 %if line.original.get_comment_args:
675 678 <% line_old_comments = get_comments_for('side-by-side', inline_comments, *line.original.get_comment_args) %>
676 679 %endif
677 680 %if line_old_comments:
678 681 <% has_outdated = any([x.outdated for x in line_old_comments]) %>
679 682 % if has_outdated:
680 683 <i class="tooltip" title="${_('comments including outdated, click to show them')}:${len(line_old_comments)}" class="icon-comment-toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
681 684 % else:
682 685 <i class="tooltip" title="${_('comments')}: ${len(line_old_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
683 686 % endif
684 687 %endif
685 688 </div>
686 689 </td>
687 690 <td class="cb-lineno ${action_class(line.original.action)}"
688 691 data-line-no="${line.original.lineno}"
689 692 %if old_line_anchor:
690 693 id="${old_line_anchor}"
691 694 %endif
692 695 >
693 696 %if line.original.lineno:
694 697 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
695 698 %endif
696 699 </td>
697 700 <td class="cb-content ${action_class(line.original.action)}"
698 701 data-line-no="o${line.original.lineno}"
699 702 >
700 703 %if use_comments and line.original.lineno:
701 704 ${render_add_comment_button()}
702 705 %endif
703 706 <span class="cb-code"><span class="cb-action ${action_class(line.original.action)}"></span>${line.original.content or '' | n}</span>
704 707
705 708 %if use_comments and line.original.lineno and line_old_comments:
706 709 ${inline_comments_container(line_old_comments, active_pattern_entries=active_pattern_entries)}
707 710 %endif
708 711
709 712 </td>
710 713 <td class="cb-data ${action_class(line.modified.action)}"
711 714 data-line-no="${line.modified.lineno}"
712 715 >
713 716 <div>
714 717
715 718 %if line.modified.get_comment_args:
716 719 <% line_new_comments = get_comments_for('side-by-side', inline_comments, *line.modified.get_comment_args) %>
717 720 %else:
718 721 <% line_new_comments = None%>
719 722 %endif
720 723 %if line_new_comments:
721 724 <% has_outdated = any([x.outdated for x in line_new_comments]) %>
722 725 % if has_outdated:
723 726 <i class="tooltip" title="${_('comments including outdated, click to show them')}:${len(line_new_comments)}" class="icon-comment-toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
724 727 % else:
725 728 <i class="tooltip" title="${_('comments')}: ${len(line_new_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
726 729 % endif
727 730 %endif
728 731 </div>
729 732 </td>
730 733 <td class="cb-lineno ${action_class(line.modified.action)}"
731 734 data-line-no="${line.modified.lineno}"
732 735 %if new_line_anchor:
733 736 id="${new_line_anchor}"
734 737 %endif
735 738 >
736 739 %if line.modified.lineno:
737 740 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
738 741 %endif
739 742 </td>
740 743 <td class="cb-content ${action_class(line.modified.action)}"
741 744 data-line-no="n${line.modified.lineno}"
742 745 >
743 746 %if use_comments and line.modified.lineno:
744 747 ${render_add_comment_button()}
745 748 %endif
746 749 <span class="cb-code"><span class="cb-action ${action_class(line.modified.action)}"></span>${line.modified.content or '' | n}</span>
747 750 %if use_comments and line.modified.lineno and line_new_comments:
748 751 ${inline_comments_container(line_new_comments, active_pattern_entries=active_pattern_entries)}
749 752 %endif
750 753 </td>
751 754 </tr>
752 755 %endfor
753 756 </%def>
754 757
755 758
756 759 <%def name="render_hunk_lines_unified(filediff, hunk, use_comments=False, inline_comments=None, active_pattern_entries=None)">
757 760 %for old_line_no, new_line_no, action, content, comments_args in hunk.unified:
758 761
759 762 <%
760 763 old_line_anchor, new_line_anchor = None, None
761 764 if old_line_no:
762 765 old_line_anchor = diff_line_anchor(filediff.raw_id, hunk.source_file_path, old_line_no, 'o')
763 766 if new_line_no:
764 767 new_line_anchor = diff_line_anchor(filediff.raw_id, hunk.target_file_path, new_line_no, 'n')
765 768 %>
766 769 <tr class="cb-line">
767 770 <td class="cb-data ${action_class(action)}">
768 771 <div>
769 772
770 773 %if comments_args:
771 774 <% comments = get_comments_for('unified', inline_comments, *comments_args) %>
772 775 %else:
773 776 <% comments = None %>
774 777 %endif
775 778
776 779 % if comments:
777 780 <% has_outdated = any([x.outdated for x in comments]) %>
778 781 % if has_outdated:
779 782 <i class="tooltip" title="${_('comments including outdated, click to show them')}:${len(comments)}" class="icon-comment-toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
780 783 % else:
781 784 <i class="tooltip" title="${_('comments')}: ${len(comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
782 785 % endif
783 786 % endif
784 787 </div>
785 788 </td>
786 789 <td class="cb-lineno ${action_class(action)}"
787 790 data-line-no="${old_line_no}"
788 791 %if old_line_anchor:
789 792 id="${old_line_anchor}"
790 793 %endif
791 794 >
792 795 %if old_line_anchor:
793 796 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
794 797 %endif
795 798 </td>
796 799 <td class="cb-lineno ${action_class(action)}"
797 800 data-line-no="${new_line_no}"
798 801 %if new_line_anchor:
799 802 id="${new_line_anchor}"
800 803 %endif
801 804 >
802 805 %if new_line_anchor:
803 806 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
804 807 %endif
805 808 </td>
806 809 <td class="cb-content ${action_class(action)}"
807 810 data-line-no="${(new_line_no and 'n' or 'o')}${(new_line_no or old_line_no)}"
808 811 >
809 812 %if use_comments:
810 813 ${render_add_comment_button()}
811 814 %endif
812 815 <span class="cb-code"><span class="cb-action ${action_class(action)}"></span> ${content or '' | n}</span>
813 816 %if use_comments and comments:
814 817 ${inline_comments_container(comments, active_pattern_entries=active_pattern_entries)}
815 818 %endif
816 819 </td>
817 820 </tr>
818 821 %endfor
819 822 </%def>
820 823
821 824
822 825 <%def name="render_hunk_lines(filediff, diff_mode, hunk, use_comments, inline_comments, active_pattern_entries)">
823 826 % if diff_mode == 'unified':
824 827 ${render_hunk_lines_unified(filediff, hunk, use_comments=use_comments, inline_comments=inline_comments, active_pattern_entries=active_pattern_entries)}
825 828 % elif diff_mode == 'sideside':
826 829 ${render_hunk_lines_sideside(filediff, hunk, use_comments=use_comments, inline_comments=inline_comments, active_pattern_entries=active_pattern_entries)}
827 830 % else:
828 831 <tr class="cb-line">
829 832 <td>unknown diff mode</td>
830 833 </tr>
831 834 % endif
832 835 </%def>file changes
833 836
834 837
835 838 <%def name="render_add_comment_button()">
836 839 <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
837 840 <span><i class="icon-comment"></i></span>
838 841 </button>
839 842 </%def>
840 843
841 844 <%def name="render_diffset_menu(diffset, range_diff_on=None)">
842 845 <% diffset_container_id = h.md5(diffset.target_ref) %>
843 846
844 847 <div id="diff-file-sticky" class="diffset-menu clearinner">
845 848 ## auto adjustable
846 849 <div class="sidebar__inner">
847 850 <div class="sidebar__bar">
848 851 <div class="pull-right">
849 852 <div class="btn-group">
850 853 <a class="btn tooltip toggle-wide-diff" href="#toggle-wide-diff" onclick="toggleWideDiff(this); return false" title="${h.tooltip(_('Toggle wide diff'))}">
851 854 <i class="icon-wide-mode"></i>
852 855 </a>
853 856 </div>
854 857 <div class="btn-group">
855 858
856 859 <a
857 860 class="btn ${(c.user_session_attrs["diffmode"] == 'sideside' and 'btn-active')} tooltip"
858 861 title="${h.tooltip(_('View diff as side by side'))}"
859 862 href="${h.current_route_path(request, diffmode='sideside')}">
860 863 <span>${_('Side by Side')}</span>
861 864 </a>
862 865
863 866 <a
864 867 class="btn ${(c.user_session_attrs["diffmode"] == 'unified' and 'btn-active')} tooltip"
865 868 title="${h.tooltip(_('View diff as unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
866 869 <span>${_('Unified')}</span>
867 870 </a>
868 871
869 872 % if range_diff_on is True:
870 873 <a
871 874 title="${_('Turn off: Show the diff as commit range')}"
872 875 class="btn btn-primary"
873 876 href="${h.current_route_path(request, **{"range-diff":"0"})}">
874 877 <span>${_('Range Diff')}</span>
875 878 </a>
876 879 % elif range_diff_on is False:
877 880 <a
878 881 title="${_('Show the diff as commit range')}"
879 882 class="btn"
880 883 href="${h.current_route_path(request, **{"range-diff":"1"})}">
881 884 <span>${_('Range Diff')}</span>
882 885 </a>
883 886 % endif
884 887 </div>
885 888 <div class="btn-group">
886 889
887 890 <div class="pull-left">
888 891 ${h.hidden('diff_menu_{}'.format(diffset_container_id))}
889 892 </div>
890 893
891 894 </div>
892 895 </div>
893 896 <div class="pull-left">
894 897 <div class="btn-group">
895 898 <div class="pull-left">
896 899 ${h.hidden('file_filter_{}'.format(diffset_container_id))}
897 900 </div>
898 901
899 902 </div>
900 903 </div>
901 904 </div>
902 905 <div class="fpath-placeholder">
903 906 <i class="icon-file-text"></i>
904 907 <strong class="fpath-placeholder-text">
905 908 Context file:
906 909 </strong>
907 910 </div>
908 911 <div class="sidebar_inner_shadow"></div>
909 912 </div>
910 913 </div>
911 914
912 915 % if diffset:
913 916 %if diffset.limited_diff:
914 917 <% file_placeholder = _ungettext('%(num)s file changed', '%(num)s files changed', diffset.changed_files) % {'num': diffset.changed_files} %>
915 918 %else:
916 919 <% file_placeholder = h.literal(_ungettext('%(num)s file changed: <span class="op-added">%(linesadd)s inserted</span>, <span class="op-deleted">%(linesdel)s deleted</span>', '%(num)s files changed: <span class="op-added">%(linesadd)s inserted</span>, <span class="op-deleted">%(linesdel)s deleted</span>',
917 920 diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}) %>
918 921
919 922 %endif
920 923 ## case on range-diff placeholder needs to be updated
921 924 % if range_diff_on is True:
922 925 <% file_placeholder = _('Disabled on range diff') %>
923 926 % endif
924 927
925 928 <script type="text/javascript">
926 929 var feedFilesOptions = function (query, initialData) {
927 930 var data = {results: []};
928 931 var isQuery = typeof query.term !== 'undefined';
929 932
930 933 var section = _gettext('Changed files');
931 934 var filteredData = [];
932 935
933 936 //filter results
934 937 $.each(initialData.results, function (idx, value) {
935 938
936 939 if (!isQuery || query.term.length === 0 || value.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
937 940 filteredData.push({
938 941 'id': this.id,
939 942 'text': this.text,
940 943 "ops": this.ops,
941 944 })
942 945 }
943 946
944 947 });
945 948
946 949 data.results = filteredData;
947 950
948 951 query.callback(data);
949 952 };
950 953
951 954 var selectionFormatter = function(data, escapeMarkup) {
952 955 var container = '<div class="filelist" style="padding-right:100px">{0}</div>';
953 956 var tmpl = '<div><strong>{0}</strong></div>'.format(escapeMarkup(data['text']));
954 957 var pill = '<div class="pill-group" style="position: absolute; top:7px; right: 0">' +
955 958 '<span class="pill" op="added">{0}</span>' +
956 959 '<span class="pill" op="deleted">{1}</span>' +
957 960 '</div>'
958 961 ;
959 962 var added = data['ops']['added'];
960 963 if (added === 0) {
961 964 // don't show +0
962 965 added = 0;
963 966 } else {
964 967 added = '+' + added;
965 968 }
966 969
967 970 var deleted = -1*data['ops']['deleted'];
968 971
969 972 tmpl += pill.format(added, deleted);
970 973 return container.format(tmpl);
971 974 };
972 975 var formatFileResult = function(result, container, query, escapeMarkup) {
973 976 return selectionFormatter(result, escapeMarkup);
974 977 };
975 978
976 979 var formatSelection = function (data, container) {
977 980 return '${file_placeholder}'
978 981 };
979 982
980 983 if (window.preloadFileFilterData === undefined) {
981 984 window.preloadFileFilterData = {}
982 985 }
983 986
984 987 preloadFileFilterData["${diffset_container_id}"] = {
985 988 results: [
986 989 % for filediff in diffset.files:
987 990 {id:"a_${h.FID(filediff.raw_id, filediff.patch['filename'])}",
988 991 text:"${filediff.patch['filename']}",
989 992 ops:${h.json.dumps(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
990 993 % endfor
991 994 ]
992 995 };
993 996
994 997 var diffFileFilterId = "#file_filter_" + "${diffset_container_id}";
995 998 var diffFileFilter = $(diffFileFilterId).select2({
996 999 'dropdownAutoWidth': true,
997 1000 'width': 'auto',
998 1001
999 1002 containerCssClass: "drop-menu",
1000 1003 dropdownCssClass: "drop-menu-dropdown",
1001 1004 data: preloadFileFilterData["${diffset_container_id}"],
1002 1005 query: function(query) {
1003 1006 feedFilesOptions(query, preloadFileFilterData["${diffset_container_id}"]);
1004 1007 },
1005 1008 initSelection: function(element, callback) {
1006 1009 callback({'init': true});
1007 1010 },
1008 1011 formatResult: formatFileResult,
1009 1012 formatSelection: formatSelection
1010 1013 });
1011 1014
1012 1015 % if range_diff_on is True:
1013 1016 diffFileFilter.select2("enable", false);
1014 1017 % endif
1015 1018
1016 1019 $(diffFileFilterId).on('select2-selecting', function (e) {
1017 1020 var idSelector = e.choice.id;
1018 1021
1019 1022 // expand the container if we quick-select the field
1020 1023 $('#'+idSelector).next().prop('checked', false);
1021 1024 // hide the mast as we later do preventDefault()
1022 1025 $("#select2-drop-mask").click();
1023 1026
1024 1027 window.location.hash = '#'+idSelector;
1025 1028 updateSticky();
1026 1029
1027 1030 e.preventDefault();
1028 1031 });
1029 1032
1030 1033 </script>
1031 1034 % endif
1032 1035
1033 1036 <script type="text/javascript">
1034 1037 $(document).ready(function () {
1035 1038
1036 1039 var contextPrefix = _gettext('Context file: ');
1037 1040 ## sticky sidebar
1038 1041 var sidebarElement = document.getElementById('diff-file-sticky');
1039 1042 sidebar = new StickySidebar(sidebarElement, {
1040 1043 topSpacing: 0,
1041 1044 bottomSpacing: 0,
1042 1045 innerWrapperSelector: '.sidebar__inner'
1043 1046 });
1044 1047 sidebarElement.addEventListener('affixed.static.stickySidebar', function () {
1045 1048 // reset our file so it's not holding new value
1046 1049 $('.fpath-placeholder-text').html(contextPrefix + ' - ')
1047 1050 });
1048 1051
1049 1052 updateSticky = function () {
1050 1053 sidebar.updateSticky();
1051 1054 Waypoint.refreshAll();
1052 1055 };
1053 1056
1054 1057 var animateText = function (fPath, anchorId) {
1055 1058 fPath = Select2.util.escapeMarkup(fPath);
1056 1059 $('.fpath-placeholder-text').html(contextPrefix + '<a href="#a_' + anchorId + '">' + fPath + '</a>')
1057 1060 };
1058 1061
1059 1062 ## dynamic file waypoints
1060 1063 var setFPathInfo = function(fPath, anchorId){
1061 1064 animateText(fPath, anchorId)
1062 1065 };
1063 1066
1064 1067 var codeBlock = $('.filediff');
1065 1068
1066 1069 // forward waypoint
1067 1070 codeBlock.waypoint(
1068 1071 function(direction) {
1069 1072 if (direction === "down"){
1070 1073 setFPathInfo($(this.element).data('fPath'), $(this.element).data('anchorId'))
1071 1074 }
1072 1075 }, {
1073 1076 offset: function () {
1074 1077 return 70;
1075 1078 },
1076 1079 context: '.fpath-placeholder'
1077 1080 }
1078 1081 );
1079 1082
1080 1083 // backward waypoint
1081 1084 codeBlock.waypoint(
1082 1085 function(direction) {
1083 1086 if (direction === "up"){
1084 1087 setFPathInfo($(this.element).data('fPath'), $(this.element).data('anchorId'))
1085 1088 }
1086 1089 }, {
1087 1090 offset: function () {
1088 1091 return -this.element.clientHeight + 90;
1089 1092 },
1090 1093 context: '.fpath-placeholder'
1091 1094 }
1092 1095 );
1093 1096
1094 1097 toggleWideDiff = function (el) {
1095 1098 updateSticky();
1096 1099 var wide = Rhodecode.comments.toggleWideMode(this);
1097 1100 storeUserSessionAttr('rc_user_session_attr.wide_diff_mode', wide);
1098 1101 if (wide === true) {
1099 1102 $(el).addClass('btn-active');
1100 1103 } else {
1101 1104 $(el).removeClass('btn-active');
1102 1105 }
1103 1106 return null;
1104 1107 };
1105 1108
1106 1109 var preloadDiffMenuData = {
1107 1110 results: [
1108 1111
1109 1112 ## Whitespace change
1110 1113 % if request.GET.get('ignorews', '') == '1':
1111 1114 {
1112 1115 id: 2,
1113 1116 text: _gettext('Show whitespace changes'),
1114 1117 action: function () {},
1115 1118 url: "${h.current_route_path(request, ignorews=0)|n}"
1116 1119 },
1117 1120 % else:
1118 1121 {
1119 1122 id: 2,
1120 1123 text: _gettext('Hide whitespace changes'),
1121 1124 action: function () {},
1122 1125 url: "${h.current_route_path(request, ignorews=1)|n}"
1123 1126 },
1124 1127 % endif
1125 1128
1126 1129 ## FULL CONTEXT
1127 1130 % if request.GET.get('fullcontext', '') == '1':
1128 1131 {
1129 1132 id: 3,
1130 1133 text: _gettext('Hide full context diff'),
1131 1134 action: function () {},
1132 1135 url: "${h.current_route_path(request, fullcontext=0)|n}"
1133 1136 },
1134 1137 % else:
1135 1138 {
1136 1139 id: 3,
1137 1140 text: _gettext('Show full context diff'),
1138 1141 action: function () {},
1139 1142 url: "${h.current_route_path(request, fullcontext=1)|n}"
1140 1143 },
1141 1144 % endif
1142 1145
1143 1146 ]
1144 1147 };
1145 1148
1146 1149 var diffMenuId = "#diff_menu_" + "${diffset_container_id}";
1147 1150 $(diffMenuId).select2({
1148 1151 minimumResultsForSearch: -1,
1149 1152 containerCssClass: "drop-menu-no-width",
1150 1153 dropdownCssClass: "drop-menu-dropdown",
1151 1154 dropdownAutoWidth: true,
1152 1155 data: preloadDiffMenuData,
1153 1156 placeholder: "${_('...')}",
1154 1157 });
1155 1158 $(diffMenuId).on('select2-selecting', function (e) {
1156 1159 e.choice.action();
1157 1160 if (e.choice.url !== null) {
1158 1161 window.location = e.choice.url
1159 1162 }
1160 1163 });
1161 1164 toggleExpand = function (el, diffsetEl) {
1162 1165 var el = $(el);
1163 1166 if (el.hasClass('collapsed')) {
1164 1167 $('.filediff-collapse-state.collapse-{0}'.format(diffsetEl)).prop('checked', false);
1165 1168 el.removeClass('collapsed');
1166 1169 el.html(
1167 1170 '<i class="icon-minus-squared-alt icon-no-margin"></i>' +
1168 1171 _gettext('Collapse all files'));
1169 1172 }
1170 1173 else {
1171 1174 $('.filediff-collapse-state.collapse-{0}'.format(diffsetEl)).prop('checked', true);
1172 1175 el.addClass('collapsed');
1173 1176 el.html(
1174 1177 '<i class="icon-plus-squared-alt icon-no-margin"></i>' +
1175 1178 _gettext('Expand all files'));
1176 1179 }
1177 1180 updateSticky()
1178 1181 };
1179 1182
1180 1183 toggleCommitExpand = function (el) {
1181 1184 var $el = $(el);
1182 1185 var commits = $el.data('toggleCommitsCnt');
1183 1186 var collapseMsg = _ngettext('Collapse {0} commit', 'Collapse {0} commits', commits).format(commits);
1184 1187 var expandMsg = _ngettext('Expand {0} commit', 'Expand {0} commits', commits).format(commits);
1185 1188
1186 1189 if ($el.hasClass('collapsed')) {
1187 1190 $('.compare_select').show();
1188 1191 $('.compare_select_hidden').hide();
1189 1192
1190 1193 $el.removeClass('collapsed');
1191 1194 $el.html(
1192 1195 '<i class="icon-minus-squared-alt icon-no-margin"></i>' +
1193 1196 collapseMsg);
1194 1197 }
1195 1198 else {
1196 1199 $('.compare_select').hide();
1197 1200 $('.compare_select_hidden').show();
1198 1201 $el.addClass('collapsed');
1199 1202 $el.html(
1200 1203 '<i class="icon-plus-squared-alt icon-no-margin"></i>' +
1201 1204 expandMsg);
1202 1205 }
1203 1206 updateSticky();
1204 1207 };
1205 1208
1206 1209 // get stored diff mode and pre-enable it
1207 1210 if (templateContext.session_attrs.wide_diff_mode === "true") {
1208 1211 Rhodecode.comments.toggleWideMode(null);
1209 1212 $('.toggle-wide-diff').addClass('btn-active');
1210 1213 updateSticky();
1211 1214 }
1212 1215 });
1213 1216 </script>
1214 1217
1215 1218 </%def>
General Comments 0
You need to be logged in to leave comments. Login now