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