##// END OF EJS Templates
ui: added secondary action instead of two buttons on files page....
dan -
r4449:5be9b639 default
parent child Browse files
Show More
@@ -1,527 +1,527 b''
1
1
2
2
3 //BUTTONS
3 //BUTTONS
4 button,
4 button,
5 .btn,
5 .btn,
6 input[type="button"] {
6 input[type="button"] {
7 -webkit-appearance: none;
7 -webkit-appearance: none;
8 display: inline-block;
8 display: inline-block;
9 margin: 0 @padding/3 0 0;
9 margin: 0 @padding/3 0 0;
10 padding: @button-padding;
10 padding: @button-padding;
11 text-align: center;
11 text-align: center;
12 font-size: @basefontsize;
12 font-size: @basefontsize;
13 line-height: 1em;
13 line-height: 1em;
14 font-family: @text-light;
14 font-family: @text-light;
15 text-decoration: none;
15 text-decoration: none;
16 text-shadow: none;
16 text-shadow: none;
17 color: @grey2;
17 color: @grey2;
18 background-color: white;
18 background-color: white;
19 background-image: none;
19 background-image: none;
20 border: none;
20 border: none;
21 .border ( @border-thickness-buttons, @grey5 );
21 .border ( @border-thickness-buttons, @grey5 );
22 .border-radius (@border-radius);
22 .border-radius (@border-radius);
23 cursor: pointer;
23 cursor: pointer;
24 white-space: nowrap;
24 white-space: nowrap;
25 -webkit-transition: background .3s,color .3s;
25 -webkit-transition: background .3s,color .3s;
26 -moz-transition: background .3s,color .3s;
26 -moz-transition: background .3s,color .3s;
27 -o-transition: background .3s,color .3s;
27 -o-transition: background .3s,color .3s;
28 transition: background .3s,color .3s;
28 transition: background .3s,color .3s;
29 box-shadow: @button-shadow;
29 box-shadow: @button-shadow;
30 -webkit-box-shadow: @button-shadow;
30 -webkit-box-shadow: @button-shadow;
31
31
32
32
33
33
34 a {
34 a {
35 display: block;
35 display: block;
36 margin: 0;
36 margin: 0;
37 padding: 0;
37 padding: 0;
38 color: inherit;
38 color: inherit;
39 text-decoration: none;
39 text-decoration: none;
40
40
41 &:hover {
41 &:hover {
42 text-decoration: none;
42 text-decoration: none;
43 }
43 }
44 }
44 }
45
45
46 &:focus,
46 &:focus,
47 &:active {
47 &:active {
48 outline:none;
48 outline:none;
49 }
49 }
50
50
51 &:hover {
51 &:hover {
52 color: @rcdarkblue;
52 color: @rcdarkblue;
53 background-color: @grey6;
53 background-color: @grey6;
54
54
55 }
55 }
56
56
57 &.btn-active {
57 &.btn-active {
58 color: @rcdarkblue;
58 color: @rcdarkblue;
59 background-color: @grey6;
59 background-color: @grey6;
60 }
60 }
61
61
62 .icon-remove {
62 .icon-remove {
63 display: none;
63 display: none;
64 }
64 }
65
65
66 //disabled buttons
66 //disabled buttons
67 //last; overrides any other styles
67 //last; overrides any other styles
68 &:disabled {
68 &:disabled {
69 opacity: .7;
69 opacity: .7;
70 cursor: auto;
70 cursor: auto;
71 background-color: white;
71 background-color: white;
72 color: @grey4;
72 color: @grey4;
73 text-shadow: none;
73 text-shadow: none;
74 }
74 }
75
75
76 &.no-margin {
76 &.no-margin {
77 margin: 0 0 0 0;
77 margin: 0 0 0 0;
78 }
78 }
79
79
80
80
81
81
82 }
82 }
83
83
84
84
85 .btn-default {
85 .btn-default {
86 border: @border-thickness solid @grey5;
86 border: @border-thickness solid @grey5;
87 background-image: none;
87 background-image: none;
88 color: @grey2;
88 color: @grey2;
89
89
90 a {
90 a {
91 color: @grey2;
91 color: @grey2;
92 }
92 }
93
93
94 &:hover,
94 &:hover,
95 &.active {
95 &.active {
96 color: @rcdarkblue;
96 color: @rcdarkblue;
97 background-color: @white;
97 background-color: @white;
98 .border ( @border-thickness, @grey4 );
98 .border ( @border-thickness, @grey4 );
99
99
100 a {
100 a {
101 color: @grey2;
101 color: @grey2;
102 }
102 }
103 }
103 }
104 &:disabled {
104 &:disabled {
105 .border ( @border-thickness-buttons, @grey5 );
105 .border ( @border-thickness-buttons, @grey5 );
106 background-color: transparent;
106 background-color: transparent;
107 }
107 }
108 &.btn-active {
108 &.btn-active {
109 color: @rcdarkblue;
109 color: @rcdarkblue;
110 background-color: @white;
110 background-color: @white;
111 .border ( @border-thickness, @rcdarkblue );
111 .border ( @border-thickness, @rcdarkblue );
112 }
112 }
113 }
113 }
114
114
115 .btn-primary,
115 .btn-primary,
116 .btn-small, /* TODO: anderson: remove .btn-small to not mix with the new btn-sm */
116 .btn-small, /* TODO: anderson: remove .btn-small to not mix with the new btn-sm */
117 .btn-success {
117 .btn-success {
118 .border ( @border-thickness, @rcblue );
118 .border ( @border-thickness, @rcblue );
119 background-color: @rcblue;
119 background-color: @rcblue;
120 color: white;
120 color: white;
121
121
122 a {
122 a {
123 color: white;
123 color: white;
124 }
124 }
125
125
126 &:hover,
126 &:hover,
127 &.active {
127 &.active {
128 .border ( @border-thickness, @rcdarkblue );
128 .border ( @border-thickness, @rcdarkblue );
129 color: white;
129 color: white;
130 background-color: @rcdarkblue;
130 background-color: @rcdarkblue;
131
131
132 a {
132 a {
133 color: white;
133 color: white;
134 }
134 }
135 }
135 }
136 &:disabled {
136 &:disabled {
137 background-color: @rcblue;
137 background-color: @rcblue;
138 }
138 }
139 }
139 }
140
140
141 .btn-secondary {
141 .btn-secondary {
142 &:extend(.btn-default);
142 &:extend(.btn-default);
143
143
144 background-color: white;
144 background-color: white;
145
145
146 &:focus {
146 &:focus {
147 outline: 0;
147 outline: 0;
148 }
148 }
149
149
150 &:hover {
150 &:hover {
151 &:extend(.btn-default:hover);
151 &:extend(.btn-default:hover);
152 }
152 }
153
153
154 &.btn-link {
154 &.btn-link {
155 &:extend(.btn-link);
155 &:extend(.btn-link);
156 color: @rcblue;
156 color: @rcblue;
157 }
157 }
158
158
159 &:disabled {
159 &:disabled {
160 color: @rcblue;
160 color: @rcblue;
161 background-color: white;
161 background-color: white;
162 }
162 }
163 }
163 }
164
164
165 .btn-warning,
165 .btn-warning,
166 .btn-danger,
166 .btn-danger,
167 .revoke_perm,
167 .revoke_perm,
168 .btn-x,
168 .btn-x,
169 .form .action_button.btn-x {
169 .form .action_button.btn-x {
170 .border ( @border-thickness, @alert2 );
170 .border ( @border-thickness, @alert2 );
171 background-color: white;
171 background-color: white;
172 color: @alert2;
172 color: @alert2;
173
173
174 a {
174 a {
175 color: @alert2;
175 color: @alert2;
176 }
176 }
177
177
178 &:hover,
178 &:hover,
179 &.active {
179 &.active {
180 .border ( @border-thickness, @alert2 );
180 .border ( @border-thickness, @alert2 );
181 color: white;
181 color: white;
182 background-color: @alert2;
182 background-color: @alert2;
183
183
184 a {
184 a {
185 color: white;
185 color: white;
186 }
186 }
187 }
187 }
188
188
189 i {
189 i {
190 display:none;
190 display:none;
191 }
191 }
192
192
193 &:disabled {
193 &:disabled {
194 background-color: white;
194 background-color: white;
195 color: @alert2;
195 color: @alert2;
196 }
196 }
197 }
197 }
198
198
199 .btn-approved-status {
199 .btn-approved-status {
200 .border ( @border-thickness, @alert1 );
200 .border ( @border-thickness, @alert1 );
201 background-color: white;
201 background-color: white;
202 color: @alert1;
202 color: @alert1;
203
203
204 }
204 }
205
205
206 .btn-rejected-status {
206 .btn-rejected-status {
207 .border ( @border-thickness, @alert2 );
207 .border ( @border-thickness, @alert2 );
208 background-color: white;
208 background-color: white;
209 color: @alert2;
209 color: @alert2;
210 }
210 }
211
211
212 .btn-sm,
212 .btn-sm,
213 .btn-mini,
213 .btn-mini,
214 .field-sm .btn {
214 .field-sm .btn {
215 padding: @padding/3;
215 padding: @padding/3;
216 }
216 }
217
217
218 .btn-xs {
218 .btn-xs {
219 padding: @padding/4;
219 padding: @padding/4;
220 }
220 }
221
221
222 .btn-lg {
222 .btn-lg {
223 padding: @padding * 1.2;
223 padding: @padding * 1.2;
224 }
224 }
225
225
226 .btn-group {
226 .btn-group {
227 display: inline-block;
227 display: inline-block;
228 .btn {
228 .btn {
229 float: left;
229 float: left;
230 margin: 0 0 0 0;
230 margin: 0 0 0 0;
231 // first item
231 // first item
232 &:first-of-type:not(:last-of-type) {
232 &:first-of-type:not(:last-of-type) {
233 border-radius: @border-radius 0 0 @border-radius;
233 border-radius: @border-radius 0 0 @border-radius;
234
234
235 }
235 }
236 // middle elements
236 // middle elements
237 &:not(:first-of-type):not(:last-of-type) {
237 &:not(:first-of-type):not(:last-of-type) {
238 border-radius: 0;
238 border-radius: 0;
239 border-left-width: 0;
239 border-left-width: 0;
240 border-right-width: 0;
240 border-right-width: 0;
241 }
241 }
242 // last item
242 // last item
243 &:last-of-type:not(:first-of-type) {
243 &:last-of-type:not(:first-of-type) {
244 border-radius: 0 @border-radius @border-radius 0;
244 border-radius: 0 @border-radius @border-radius 0;
245 }
245 }
246
246
247 &:only-child {
247 &:only-child {
248 border-radius: @border-radius;
248 border-radius: @border-radius;
249 }
249 }
250 }
250 }
251
251
252 }
252 }
253
253
254
254
255 .btn-group-actions {
255 .btn-group-actions {
256 position: relative;
256 position: relative;
257 z-index: 100;
257 z-index: 100;
258
258
259 &:not(.open) .btn-action-switcher-container {
259 &:not(.open) .btn-action-switcher-container {
260 display: none;
260 display: none;
261 }
261 }
262 }
262 }
263
263
264
264
265 .btn-action-switcher-container{
265 .btn-action-switcher-container{
266 position: absolute;
266 position: absolute;
267 top: 30px;
267 top: 100%;
268 left: -82px;
268 right: 0;
269 }
269 }
270
270
271 .btn-action-switcher {
271 .btn-action-switcher {
272 display: block;
272 display: block;
273 position: relative;
273 position: relative;
274 z-index: 300;
274 z-index: 300;
275 min-width: 240px;
275 max-width: 600px;
276 max-width: 500px;
277 margin-top: 4px;
276 margin-top: 4px;
278 margin-bottom: 24px;
277 margin-bottom: 24px;
279 font-size: 14px;
278 font-size: 14px;
280 font-weight: 400;
279 font-weight: 400;
281 padding: 8px 0;
280 padding: 8px 0;
282 background-color: #fff;
281 background-color: #fff;
283 border: 1px solid @grey4;
282 border: 1px solid @grey4;
284 border-radius: 3px;
283 border-radius: 3px;
285 box-shadow: @dropdown-shadow;
284 box-shadow: @dropdown-shadow;
285 overflow: auto;
286
286
287 li {
287 li {
288 display: block;
288 display: block;
289 text-align: left;
289 text-align: left;
290 list-style: none;
290 list-style: none;
291 padding: 5px 10px;
291 padding: 5px 10px;
292 }
292 }
293
293
294 li .action-help-block {
294 li .action-help-block {
295 font-size: 10px;
295 font-size: 10px;
296 line-height: normal;
296 line-height: normal;
297 color: @grey4;
297 color: @grey4;
298 }
298 }
299
299
300 }
300 }
301
301
302 .btn-link {
302 .btn-link {
303 background: transparent;
303 background: transparent;
304 border: none;
304 border: none;
305 padding: 0;
305 padding: 0;
306 color: @rcblue;
306 color: @rcblue;
307
307
308 &:hover {
308 &:hover {
309 background: transparent;
309 background: transparent;
310 border: none;
310 border: none;
311 color: @rcdarkblue;
311 color: @rcdarkblue;
312 }
312 }
313
313
314 //disabled buttons
314 //disabled buttons
315 //last; overrides any other styles
315 //last; overrides any other styles
316 &:disabled {
316 &:disabled {
317 opacity: .7;
317 opacity: .7;
318 cursor: auto;
318 cursor: auto;
319 background-color: white;
319 background-color: white;
320 color: @grey4;
320 color: @grey4;
321 text-shadow: none;
321 text-shadow: none;
322 }
322 }
323
323
324 // TODO: johbo: Check if we can avoid this, indicates that the structure
324 // TODO: johbo: Check if we can avoid this, indicates that the structure
325 // is not yet good.
325 // is not yet good.
326 // lisa: The button CSS reflects the button HTML; both need a cleanup.
326 // lisa: The button CSS reflects the button HTML; both need a cleanup.
327 &.btn-danger {
327 &.btn-danger {
328 color: @alert2;
328 color: @alert2;
329
329
330 &:hover {
330 &:hover {
331 color: darken(@alert2,30%);
331 color: darken(@alert2,30%);
332 }
332 }
333
333
334 &:disabled {
334 &:disabled {
335 color: @alert2;
335 color: @alert2;
336 }
336 }
337 }
337 }
338 }
338 }
339
339
340 .btn-social {
340 .btn-social {
341 &:extend(.btn-default);
341 &:extend(.btn-default);
342 margin: 5px 5px 5px 0px;
342 margin: 5px 5px 5px 0px;
343 min-width: 160px;
343 min-width: 160px;
344 }
344 }
345
345
346 // TODO: johbo: check these exceptions
346 // TODO: johbo: check these exceptions
347
347
348 .links {
348 .links {
349
349
350 .btn + .btn {
350 .btn + .btn {
351 margin-top: @padding;
351 margin-top: @padding;
352 }
352 }
353 }
353 }
354
354
355
355
356 .action_button {
356 .action_button {
357 display:inline;
357 display:inline;
358 margin: 0;
358 margin: 0;
359 padding: 0 1em 0 0;
359 padding: 0 1em 0 0;
360 font-size: inherit;
360 font-size: inherit;
361 color: @rcblue;
361 color: @rcblue;
362 border: none;
362 border: none;
363 border-radius: 0;
363 border-radius: 0;
364 background-color: transparent;
364 background-color: transparent;
365
365
366 &.last-item {
366 &.last-item {
367 border: none;
367 border: none;
368 padding: 0 0 0 0;
368 padding: 0 0 0 0;
369 }
369 }
370
370
371 &:last-child {
371 &:last-child {
372 border: none;
372 border: none;
373 padding: 0 0 0 0;
373 padding: 0 0 0 0;
374 }
374 }
375
375
376 &:hover {
376 &:hover {
377 color: @rcdarkblue;
377 color: @rcdarkblue;
378 background-color: transparent;
378 background-color: transparent;
379 border: none;
379 border: none;
380 }
380 }
381 .noselect
381 .noselect
382 }
382 }
383
383
384 .grid_delete {
384 .grid_delete {
385 .action_button {
385 .action_button {
386 border: none;
386 border: none;
387 }
387 }
388 }
388 }
389
389
390
390
391 // TODO: johbo: Form button tweaks, check if we can use the classes instead
391 // TODO: johbo: Form button tweaks, check if we can use the classes instead
392 input[type="submit"] {
392 input[type="submit"] {
393 &:extend(.btn-primary);
393 &:extend(.btn-primary);
394
394
395 &:focus {
395 &:focus {
396 outline: 0;
396 outline: 0;
397 }
397 }
398
398
399 &:hover {
399 &:hover {
400 &:extend(.btn-primary:hover);
400 &:extend(.btn-primary:hover);
401 }
401 }
402
402
403 &.btn-link {
403 &.btn-link {
404 &:extend(.btn-link);
404 &:extend(.btn-link);
405 color: @rcblue;
405 color: @rcblue;
406
406
407 &:disabled {
407 &:disabled {
408 color: @rcblue;
408 color: @rcblue;
409 background-color: transparent;
409 background-color: transparent;
410 }
410 }
411 }
411 }
412
412
413 &:disabled {
413 &:disabled {
414 .border ( @border-thickness-buttons, @rcblue );
414 .border ( @border-thickness-buttons, @rcblue );
415 background-color: @rcblue;
415 background-color: @rcblue;
416 color: white;
416 color: white;
417 opacity: 0.5;
417 opacity: 0.5;
418 }
418 }
419 }
419 }
420
420
421 input[type="reset"] {
421 input[type="reset"] {
422 &:extend(.btn-default);
422 &:extend(.btn-default);
423
423
424 // TODO: johbo: Check if this tweak can be avoided.
424 // TODO: johbo: Check if this tweak can be avoided.
425 background: transparent;
425 background: transparent;
426
426
427 &:focus {
427 &:focus {
428 outline: 0;
428 outline: 0;
429 }
429 }
430
430
431 &:hover {
431 &:hover {
432 &:extend(.btn-default:hover);
432 &:extend(.btn-default:hover);
433 }
433 }
434
434
435 &.btn-link {
435 &.btn-link {
436 &:extend(.btn-link);
436 &:extend(.btn-link);
437 color: @rcblue;
437 color: @rcblue;
438
438
439 &:disabled {
439 &:disabled {
440 border: none;
440 border: none;
441 }
441 }
442 }
442 }
443
443
444 &:disabled {
444 &:disabled {
445 .border ( @border-thickness-buttons, @rcblue );
445 .border ( @border-thickness-buttons, @rcblue );
446 background-color: white;
446 background-color: white;
447 color: @rcblue;
447 color: @rcblue;
448 }
448 }
449 }
449 }
450
450
451 input[type="submit"],
451 input[type="submit"],
452 input[type="reset"] {
452 input[type="reset"] {
453 &.btn-danger {
453 &.btn-danger {
454 &:extend(.btn-danger);
454 &:extend(.btn-danger);
455
455
456 &:focus {
456 &:focus {
457 outline: 0;
457 outline: 0;
458 }
458 }
459
459
460 &:hover {
460 &:hover {
461 &:extend(.btn-danger:hover);
461 &:extend(.btn-danger:hover);
462 }
462 }
463
463
464 &.btn-link {
464 &.btn-link {
465 &:extend(.btn-link);
465 &:extend(.btn-link);
466 color: @alert2;
466 color: @alert2;
467
467
468 &:hover {
468 &:hover {
469 color: darken(@alert2,30%);
469 color: darken(@alert2,30%);
470 }
470 }
471 }
471 }
472
472
473 &:disabled {
473 &:disabled {
474 color: @alert2;
474 color: @alert2;
475 background-color: white;
475 background-color: white;
476 }
476 }
477 }
477 }
478 &.btn-danger-action {
478 &.btn-danger-action {
479 .border ( @border-thickness, @alert2 );
479 .border ( @border-thickness, @alert2 );
480 background-color: @alert2;
480 background-color: @alert2;
481 color: white;
481 color: white;
482
482
483 a {
483 a {
484 color: white;
484 color: white;
485 }
485 }
486
486
487 &:hover {
487 &:hover {
488 background-color: darken(@alert2,20%);
488 background-color: darken(@alert2,20%);
489 }
489 }
490
490
491 &.active {
491 &.active {
492 .border ( @border-thickness, @alert2 );
492 .border ( @border-thickness, @alert2 );
493 color: white;
493 color: white;
494 background-color: @alert2;
494 background-color: @alert2;
495
495
496 a {
496 a {
497 color: white;
497 color: white;
498 }
498 }
499 }
499 }
500
500
501 &:disabled {
501 &:disabled {
502 background-color: white;
502 background-color: white;
503 color: @alert2;
503 color: @alert2;
504 }
504 }
505 }
505 }
506 }
506 }
507
507
508
508
509 .button-links {
509 .button-links {
510 float: left;
510 float: left;
511 display: inline;
511 display: inline;
512 margin: 0;
512 margin: 0;
513 padding-left: 0;
513 padding-left: 0;
514 list-style: none;
514 list-style: none;
515 text-align: right;
515 text-align: right;
516
516
517 li {
517 li {
518
518
519
519
520 }
520 }
521
521
522 li.active {
522 li.active {
523 background-color: @grey6;
523 background-color: @grey6;
524 .border ( @border-thickness, @grey4 );
524 .border ( @border-thickness, @grey4 );
525 }
525 }
526
526
527 }
527 }
@@ -1,84 +1,100 b''
1
1
2 <div id="codeblock" class="browserblock">
2 <div id="codeblock" class="browserblock">
3 <div class="browser-header">
3 <div class="browser-header">
4 <div class="browser-nav">
4 <div class="browser-nav">
5
5
6 <div class="info_box">
6 <div class="info_box">
7
7
8 <div class="info_box_elem previous">
8 <div class="info_box_elem previous">
9 <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class=" ${('disabled' if c.url_prev == '#' else '')}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a>
9 <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class=" ${('disabled' if c.url_prev == '#' else '')}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a>
10 </div>
10 </div>
11
11
12 ${h.hidden('refs_filter')}
12 ${h.hidden('refs_filter')}
13
13
14 <div class="info_box_elem next">
14 <div class="info_box_elem next">
15 <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class=" ${('disabled' if c.url_next == '#' else '')}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a>
15 <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class=" ${('disabled' if c.url_next == '#' else '')}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a>
16 </div>
16 </div>
17 </div>
17 </div>
18
18
19 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
19 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
20 <div>
20
21 <a class="btn btn-primary new-file" href="${h.route_path('repo_files_upload_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
21 <div class="new-file">
22 <div class="btn-group btn-group-actions">
23 <a class="btn btn-primary no-margin" href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
24 ${_('Add File')}
25 </a>
26
27 <a class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more options')}">
28 <i class="icon-down"></i>
29 </a>
30
31 <div class="btn-action-switcher-container">
32 <ul class="btn-action-switcher" role="menu" style="min-width: 200px">
33 <li>
34 <a class="action_button" href="${h.route_path('repo_files_upload_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
35 <i class="icon-upload"></i>
22 ${_('Upload File')}
36 ${_('Upload File')}
23 </a>
37 </a>
24 <a class="btn btn-primary new-file" href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
38 </li>
25 ${_('Add File')}
39 </ul>
26 </a>
27 </div>
40 </div>
41 </div>
42 </div>
43
28 % endif
44 % endif
29
45
30 % if c.enable_downloads:
46 % if c.enable_downloads:
31 <% at_path = '{}'.format(request.GET.get('at') or c.commit.raw_id[:6]) %>
47 <% at_path = '{}'.format(request.GET.get('at') or c.commit.raw_id[:6]) %>
32 <div class="btn btn-default new-file">
48 <div class="btn btn-default new-file">
33 % if c.f_path == '/':
49 % if c.f_path == '/':
34 <a href="${h.route_path('repo_archivefile',repo_name=c.repo_name, fname='{}.zip'.format(c.commit.raw_id))}">
50 <a href="${h.route_path('repo_archivefile',repo_name=c.repo_name, fname='{}.zip'.format(c.commit.raw_id))}">
35 ${_('Download full tree ZIP')}
51 ${_('Download full tree ZIP')}
36 </a>
52 </a>
37 % else:
53 % else:
38 <a href="${h.route_path('repo_archivefile',repo_name=c.repo_name, fname='{}.zip'.format(c.commit.raw_id), _query={'at_path':c.f_path})}">
54 <a href="${h.route_path('repo_archivefile',repo_name=c.repo_name, fname='{}.zip'.format(c.commit.raw_id), _query={'at_path':c.f_path})}">
39 ${_('Download this tree ZIP')}
55 ${_('Download this tree ZIP')}
40 </a>
56 </a>
41 % endif
57 % endif
42 </div>
58 </div>
43 % endif
59 % endif
44
60
45 <div class="files-quick-filter">
61 <div class="files-quick-filter">
46 <ul class="files-filter-box">
62 <ul class="files-filter-box">
47 <li class="files-filter-box-path">
63 <li class="files-filter-box-path">
48 <i class="icon-search"></i>
64 <i class="icon-search"></i>
49 </li>
65 </li>
50 <li class="files-filter-box-input">
66 <li class="files-filter-box-input">
51 <input onkeydown="NodeFilter.initFilter(event)" class="init" type="text" placeholder="Quick filter" name="filter" size="25" id="node_filter" autocomplete="off">
67 <input onkeydown="NodeFilter.initFilter(event)" class="init" type="text" placeholder="Quick filter" name="filter" size="25" id="node_filter" autocomplete="off">
52 </li>
68 </li>
53 </ul>
69 </ul>
54 </div>
70 </div>
55 </div>
71 </div>
56
72
57 </div>
73 </div>
58
74
59 ## file tree is computed from caches, and filled in
75 ## file tree is computed from caches, and filled in
60 <div id="file-tree">
76 <div id="file-tree">
61 ${c.file_tree |n}
77 ${c.file_tree |n}
62 </div>
78 </div>
63
79
64 %if c.readme_data:
80 %if c.readme_data:
65 <div id="readme" class="anchor">
81 <div id="readme" class="anchor">
66 <div class="box">
82 <div class="box">
67 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
83 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
68 <div>
84 <div>
69 <i class="icon-file-text"></i>
85 <i class="icon-file-text"></i>
70 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
86 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
71 ${c.readme_file}
87 ${c.readme_file}
72 </a>
88 </a>
73 </div>
89 </div>
74 </div>
90 </div>
75 <div class="readme codeblock">
91 <div class="readme codeblock">
76 <div class="readme_box">
92 <div class="readme_box">
77 ${c.readme_data|n}
93 ${c.readme_data|n}
78 </div>
94 </div>
79 </div>
95 </div>
80 </div>
96 </div>
81 </div>
97 </div>
82 %endif
98 %endif
83
99
84 </div>
100 </div>
@@ -1,211 +1,211 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('{} Files Upload').format(c.repo_name)}
4 ${_('{} Files Upload').format(c.repo_name)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()"></%def>
14 <%def name="breadcrumbs_links()"></%def>
15
15
16 <%def name="menu_bar_subnav()">
16 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='files')}
17 ${self.repo_menu(active='files')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21
21
22 <div class="box">
22 <div class="box">
23 ## Template for uploads
23 ## Template for uploads
24 <div style="display: none" id="tpl-dropzone">
24 <div style="display: none" id="tpl-dropzone">
25 <div class="dz-preview dz-file-preview">
25 <div class="dz-preview dz-file-preview">
26 <div class="dz-details">
26 <div class="dz-details">
27
27
28 <div class="dz-filename">
28 <div class="dz-filename">
29 <span data-dz-name></span>
29 <span data-dz-name></span>
30 </div>
30 </div>
31 <div class="dz-filename-size">
31 <div class="dz-filename-size">
32 <span class="dz-size" data-dz-size></span>
32 <span class="dz-size" data-dz-size></span>
33
33
34 </div>
34 </div>
35
35
36 <div class="dz-sending" style="display: none">${_('Uploading...')}</div>
36 <div class="dz-sending" style="display: none">${_('Uploading...')}</div>
37 <div class="dz-response" style="display: none">
37 <div class="dz-response" style="display: none">
38 ${_('Uploaded')} 100%
38 ${_('Uploaded')} 100%
39 </div>
39 </div>
40
40
41 </div>
41 </div>
42 <div class="dz-progress">
42 <div class="dz-progress">
43 <span class="dz-upload" data-dz-uploadprogress></span>
43 <span class="dz-upload" data-dz-uploadprogress></span>
44 </div>
44 </div>
45
45
46 <div class="dz-error-message">
46 <div class="dz-error-message">
47 </div>
47 </div>
48 </div>
48 </div>
49 </div>
49 </div>
50
50
51 <div class="edit-file-title">
51 <div class="edit-file-title">
52 <span class="title-heading">${_('Upload new file')} @ <code>${h.show_id(c.commit)}</code></span>
52 <span class="title-heading">${_('Upload new file')} @ <code>${h.show_id(c.commit)}</code></span>
53 % if c.commit.branch:
53 % if c.commit.branch:
54 <span class="tag branchtag">
54 <span class="tag branchtag">
55 <i class="icon-branch"></i> ${c.commit.branch}
55 <i class="icon-branch"></i> ${c.commit.branch}
56 </span>
56 </span>
57 % endif
57 % endif
58 </div>
58 </div>
59
59
60 <% form_url = h.route_path('repo_files_upload_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path) %>
60 <% form_url = h.route_path('repo_files_upload_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path) %>
61 ##${h.secure_form(form_url, id='eform', enctype="multipart/form-data", request=request)}
61 ##${h.secure_form(form_url, id='eform', enctype="multipart/form-data", request=request)}
62 <div class="edit-file-fieldset">
62 <div class="edit-file-fieldset">
63 <div class="path-items">
63 <div class="path-items">
64 <ul>
64 <ul class="tooltip" title="Repository path to store uploaded files. To change it, navigate to different path and click upload from there.">
65 <li class="breadcrumb-path">
65 <li class="breadcrumb-path">
66 <div>
66 <div>
67 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
67 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
68 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a> ${('/' if c.f_path else '')}
68 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a>${('/' if c.f_path else '')}
69 </div>
69 </div>
70 </li>
70 </li>
71 <li class="location-path">
71 <li class="location-path">
72
72
73 </li>
73 </li>
74 </ul>
74 </ul>
75 </div>
75 </div>
76
76
77 </div>
77 </div>
78
78
79 <div class="upload-form table">
79 <div class="upload-form table">
80 <div>
80 <div>
81
81
82 <div class="dropzone-wrapper" id="file-uploader">
82 <div class="dropzone-wrapper" id="file-uploader" style="border: none; padding: 40px 0">
83 <div class="dropzone-pure">
83 <div class="dropzone-pure">
84 <div class="dz-message">
84 <div class="dz-message">
85 <i class="icon-upload" style="font-size:36px"></i></br>
85 <i class="icon-upload" style="font-size:36px"></i></br>
86 ${_("Drag'n Drop files here or")} <span class="link">${_('Choose your files')}</span>.<br>
86 ${_("Drag'n Drop files here or")} <span class="link">${_('Choose your files')}</span>.<br>
87 </div>
87 </div>
88 </div>
88 </div>
89
89
90 </div>
90 </div>
91 </div>
91 </div>
92
92
93 </div>
93 </div>
94
94
95 <div class="upload-form edit-file-fieldset">
95 <div class="upload-form edit-file-fieldset">
96 <div class="fieldset">
96 <div class="fieldset">
97 <div class="message">
97 <div class="message">
98 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
98 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
99 </div>
99 </div>
100 </div>
100 </div>
101 <div class="pull-left">
101 <div class="pull-left">
102 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
102 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
103 </div>
103 </div>
104 </div>
104 </div>
105 ##${h.end_form()}
105 ##${h.end_form()}
106
106
107 <div class="file-upload-transaction-wrapper" style="display: none">
107 <div class="file-upload-transaction-wrapper" style="display: none">
108 <div class="file-upload-transaction">
108 <div class="file-upload-transaction">
109 <h3>${_('Committing...')}</h3>
109 <h3>${_('Committing...')}</h3>
110 <p>${_('Please wait while the files are being uploaded')}</p>
110 <p>${_('Please wait while the files are being uploaded')}</p>
111 <p class="error" style="display: none">
111 <p class="error" style="display: none">
112
112
113 </p>
113 </p>
114 <i class="icon-spin animate-spin"></i>
114 <i class="icon-spin animate-spin"></i>
115 <p></p>
115 <p></p>
116 </div>
116 </div>
117 </div>
117 </div>
118
118
119 </div>
119 </div>
120
120
121 <script type="text/javascript">
121 <script type="text/javascript">
122
122
123 $(document).ready(function () {
123 $(document).ready(function () {
124
124
125 //see: https://www.dropzonejs.com/#configuration
125 //see: https://www.dropzonejs.com/#configuration
126 myDropzone = new Dropzone("div#file-uploader", {
126 myDropzone = new Dropzone("div#file-uploader", {
127 url: "${form_url}",
127 url: "${form_url}",
128 headers: {"X-CSRF-Token": CSRF_TOKEN},
128 headers: {"X-CSRF-Token": CSRF_TOKEN},
129 paramName: function () {
129 paramName: function () {
130 return "files_upload"
130 return "files_upload"
131 }, // The name that will be used to transfer the file
131 }, // The name that will be used to transfer the file
132 parallelUploads: 20,
132 parallelUploads: 20,
133 maxFiles: 20,
133 maxFiles: 20,
134 uploadMultiple: true,
134 uploadMultiple: true,
135 //chunking: true, // use chunking transfer, not supported at the moment
135 //chunking: true, // use chunking transfer, not supported at the moment
136 //maxFilesize: 2, // in MBs
136 //maxFilesize: 2, // in MBs
137 autoProcessQueue: false, // if false queue will not be processed automatically.
137 autoProcessQueue: false, // if false queue will not be processed automatically.
138 createImageThumbnails: false,
138 createImageThumbnails: false,
139 previewTemplate: document.querySelector('#tpl-dropzone').innerHTML,
139 previewTemplate: document.querySelector('#tpl-dropzone').innerHTML,
140 accept: function (file, done) {
140 accept: function (file, done) {
141 done();
141 done();
142 },
142 },
143 init: function () {
143 init: function () {
144 this.on("addedfile", function (file) {
144 this.on("addedfile", function (file) {
145
145
146 });
146 });
147
147
148 this.on("sending", function (file, xhr, formData) {
148 this.on("sending", function (file, xhr, formData) {
149 formData.append("message", $('#commit').val());
149 formData.append("message", $('#commit').val());
150 $(file.previewElement).find('.dz-sending').show();
150 $(file.previewElement).find('.dz-sending').show();
151 });
151 });
152
152
153 this.on("success", function (file, response) {
153 this.on("success", function (file, response) {
154 $(file.previewElement).find('.dz-sending').hide();
154 $(file.previewElement).find('.dz-sending').hide();
155 $(file.previewElement).find('.dz-response').show();
155 $(file.previewElement).find('.dz-response').show();
156
156
157 if (response.error !== null) {
157 if (response.error !== null) {
158 $('.file-upload-transaction-wrapper .error').html('ERROR: {0}'.format(response.error));
158 $('.file-upload-transaction-wrapper .error').html('ERROR: {0}'.format(response.error));
159 $('.file-upload-transaction-wrapper .error').show();
159 $('.file-upload-transaction-wrapper .error').show();
160 $('.file-upload-transaction-wrapper i').hide()
160 $('.file-upload-transaction-wrapper i').hide()
161 }
161 }
162
162
163 var redirect_url = response.redirect_url || '/';
163 var redirect_url = response.redirect_url || '/';
164 window.location = redirect_url
164 window.location = redirect_url
165
165
166 });
166 });
167
167
168 this.on("error", function (file, errorMessage, xhr) {
168 this.on("error", function (file, errorMessage, xhr) {
169 var error = null;
169 var error = null;
170
170
171 if (xhr !== undefined){
171 if (xhr !== undefined){
172 var httpStatus = xhr.status + " " + xhr.statusText;
172 var httpStatus = xhr.status + " " + xhr.statusText;
173 if (xhr !== undefined && xhr.status >= 500) {
173 if (xhr !== undefined && xhr.status >= 500) {
174 error = httpStatus;
174 error = httpStatus;
175 }
175 }
176 }
176 }
177
177
178 if (error === null) {
178 if (error === null) {
179 error = errorMessage.error || errorMessage || httpStatus;
179 error = errorMessage.error || errorMessage || httpStatus;
180 }
180 }
181
181
182 $(file.previewElement).find('.dz-error-message').html('ERROR: {0}'.format(error));
182 $(file.previewElement).find('.dz-error-message').html('ERROR: {0}'.format(error));
183 });
183 });
184 }
184 }
185 });
185 });
186
186
187 $('#commit_btn').on('click', function(e) {
187 $('#commit_btn').on('click', function(e) {
188 e.preventDefault();
188 e.preventDefault();
189 var button = $(this);
189 var button = $(this);
190 if (button.hasClass('clicked')) {
190 if (button.hasClass('clicked')) {
191 button.attr('disabled', true);
191 button.attr('disabled', true);
192 } else {
192 } else {
193 button.addClass('clicked');
193 button.addClass('clicked');
194 }
194 }
195
195
196 var files = myDropzone.getQueuedFiles();
196 var files = myDropzone.getQueuedFiles();
197 if (files.length === 0) {
197 if (files.length === 0) {
198 alert("Missing files");
198 alert("Missing files");
199 e.preventDefault();
199 e.preventDefault();
200 }
200 }
201
201
202 $('.upload-form').hide();
202 $('.upload-form').hide();
203 $('.file-upload-transaction-wrapper').show();
203 $('.file-upload-transaction-wrapper').show();
204 myDropzone.processQueue();
204 myDropzone.processQueue();
205
205
206 });
206 });
207
207
208 });
208 });
209
209
210 </script>
210 </script>
211 </%def>
211 </%def>
@@ -1,921 +1,921 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
3 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)}
6 ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)}
7 %if c.rhodecode_name:
7 %if c.rhodecode_name:
8 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
9 %endif
9 %endif
10 </%def>
10 </%def>
11
11
12 <%def name="breadcrumbs_links()">
12 <%def name="breadcrumbs_links()">
13
13
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
17 ${self.menu_items(active='repositories')}
18 </%def>
18 </%def>
19
19
20 <%def name="menu_bar_subnav()">
20 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='showpullrequest')}
21 ${self.repo_menu(active='showpullrequest')}
22 </%def>
22 </%def>
23
23
24 <%def name="main()">
24 <%def name="main()">
25
25
26 <script type="text/javascript">
26 <script type="text/javascript">
27 // TODO: marcink switch this to pyroutes
27 // TODO: marcink switch this to pyroutes
28 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
28 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
29 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
29 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
30 </script>
30 </script>
31
31
32 <div class="box">
32 <div class="box">
33
33
34 <div class="box pr-summary">
34 <div class="box pr-summary">
35
35
36 <div class="summary-details block-left">
36 <div class="summary-details block-left">
37 <div id="pr-title">
37 <div id="pr-title">
38 % if c.pull_request.is_closed():
38 % if c.pull_request.is_closed():
39 <span class="pr-title-closed-tag tag">${_('Closed')}</span>
39 <span class="pr-title-closed-tag tag">${_('Closed')}</span>
40 % endif
40 % endif
41 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}">
41 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}">
42 </div>
42 </div>
43 <div id="pr-title-edit" class="input" style="display: none;">
43 <div id="pr-title-edit" class="input" style="display: none;">
44 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
44 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
45 </div>
45 </div>
46
46
47 <% summary = lambda n:{False:'summary-short'}.get(n) %>
47 <% summary = lambda n:{False:'summary-short'}.get(n) %>
48 <div class="pr-details-title">
48 <div class="pr-details-title">
49 <div class="pull-left">
49 <div class="pull-left">
50 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a>
50 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a>
51 ${_('Created on')}
51 ${_('Created on')}
52 <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span>
52 <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span>
53 <span class="pr-details-title-author-pref">${_('by')}</span>
53 <span class="pr-details-title-author-pref">${_('by')}</span>
54 </div>
54 </div>
55
55
56 <div class="pull-left">
56 <div class="pull-left">
57 ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)}
57 ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)}
58 </div>
58 </div>
59
59
60 %if c.allowed_to_update:
60 %if c.allowed_to_update:
61 <div class="pull-right">
61 <div class="pull-right">
62 <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div>
62 <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div>
63 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
63 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
64 % if c.allowed_to_delete:
64 % if c.allowed_to_delete:
65 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
65 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
66 <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}"
66 <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}"
67 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
67 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
68 type="submit" value="${_('Delete pull request')}">
68 type="submit" value="${_('Delete pull request')}">
69 ${h.end_form()}
69 ${h.end_form()}
70 % else:
70 % else:
71 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
71 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
72 % endif
72 % endif
73 </div>
73 </div>
74 <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div>
74 <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div>
75 <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div>
75 <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div>
76 </div>
76 </div>
77
77
78 %endif
78 %endif
79 </div>
79 </div>
80
80
81 <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}">
81 <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}">
82 ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)}
82 ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)}
83 </div>
83 </div>
84
84
85 <div id="pr-desc-edit" class="input textarea" style="display: none;">
85 <div id="pr-desc-edit" class="input textarea" style="display: none;">
86 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
86 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
87 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
87 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
88 </div>
88 </div>
89
89
90 <div id="summary" class="fields pr-details-content">
90 <div id="summary" class="fields pr-details-content">
91
91
92 ## review
92 ## review
93 <div class="field">
93 <div class="field">
94 <div class="label-pr-detail">
94 <div class="label-pr-detail">
95 <label>${_('Review status')}:</label>
95 <label>${_('Review status')}:</label>
96 </div>
96 </div>
97 <div class="input">
97 <div class="input">
98 %if c.pull_request_review_status:
98 %if c.pull_request_review_status:
99 <div class="tag status-tag-${c.pull_request_review_status}">
99 <div class="tag status-tag-${c.pull_request_review_status}">
100 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
100 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
101 <span class="changeset-status-lbl">
101 <span class="changeset-status-lbl">
102 %if c.pull_request.is_closed():
102 %if c.pull_request.is_closed():
103 ${_('Closed')},
103 ${_('Closed')},
104 %endif
104 %endif
105
105
106 ${h.commit_status_lbl(c.pull_request_review_status)}
106 ${h.commit_status_lbl(c.pull_request_review_status)}
107
107
108 </span>
108 </span>
109 </div>
109 </div>
110 - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))}
110 - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))}
111 %endif
111 %endif
112 </div>
112 </div>
113 </div>
113 </div>
114
114
115 ## source
115 ## source
116 <div class="field">
116 <div class="field">
117 <div class="label-pr-detail">
117 <div class="label-pr-detail">
118 <label>${_('Commit flow')}:</label>
118 <label>${_('Commit flow')}:</label>
119 </div>
119 </div>
120 <div class="input">
120 <div class="input">
121 <div class="pr-commit-flow">
121 <div class="pr-commit-flow">
122 ## Source
122 ## Source
123 %if c.pull_request.source_ref_parts.type == 'branch':
123 %if c.pull_request.source_ref_parts.type == 'branch':
124 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a>
124 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a>
125 %else:
125 %else:
126 <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code>
126 <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code>
127 %endif
127 %endif
128 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a>
128 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a>
129 &rarr;
129 &rarr;
130 ## Target
130 ## Target
131 %if c.pull_request.target_ref_parts.type == 'branch':
131 %if c.pull_request.target_ref_parts.type == 'branch':
132 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a>
132 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a>
133 %else:
133 %else:
134 <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code>
134 <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code>
135 %endif
135 %endif
136
136
137 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a>
137 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a>
138
138
139 <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'>
139 <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'>
140 <i class="icon-angle-down">more details</i>
140 <i class="icon-angle-down">more details</i>
141 </a>
141 </a>
142
142
143 </div>
143 </div>
144
144
145 <div class="source-details" style="display: none">
145 <div class="source-details" style="display: none">
146
146
147 <ul>
147 <ul>
148
148
149 ## common ancestor
149 ## common ancestor
150 <li>
150 <li>
151 ${_('Common ancestor')}:
151 ${_('Common ancestor')}:
152 % if c.ancestor_commit:
152 % if c.ancestor_commit:
153 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a>
153 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a>
154 % else:
154 % else:
155 ${_('not available')}
155 ${_('not available')}
156 % endif
156 % endif
157 </li>
157 </li>
158
158
159 ## pull url
159 ## pull url
160 <li>
160 <li>
161 %if h.is_hg(c.pull_request.source_repo):
161 %if h.is_hg(c.pull_request.source_repo):
162 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
162 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
163 %elif h.is_git(c.pull_request.source_repo):
163 %elif h.is_git(c.pull_request.source_repo):
164 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
164 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
165 %endif
165 %endif
166
166
167 <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
167 <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
168 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
168 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
169 </li>
169 </li>
170
170
171 ## Shadow repo
171 ## Shadow repo
172 <li>
172 <li>
173 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
173 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
174 %if h.is_hg(c.pull_request.target_repo):
174 %if h.is_hg(c.pull_request.target_repo):
175 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
175 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
176 %elif h.is_git(c.pull_request.target_repo):
176 %elif h.is_git(c.pull_request.target_repo):
177 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
177 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
178 %endif
178 %endif
179
179
180 <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
180 <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
181 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
181 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
182
182
183 % else:
183 % else:
184 <div class="">
184 <div class="">
185 ${_('Shadow repository data not available')}.
185 ${_('Shadow repository data not available')}.
186 </div>
186 </div>
187 % endif
187 % endif
188 </li>
188 </li>
189
189
190 </ul>
190 </ul>
191
191
192 </div>
192 </div>
193
193
194 </div>
194 </div>
195
195
196 </div>
196 </div>
197
197
198 ## versions
198 ## versions
199 <div class="field">
199 <div class="field">
200 <div class="label-pr-detail">
200 <div class="label-pr-detail">
201 <label>${_('Versions')}:</label>
201 <label>${_('Versions')}:</label>
202 </div>
202 </div>
203
203
204 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
204 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
205 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
205 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
206
206
207 <div class="pr-versions">
207 <div class="pr-versions">
208 % if c.show_version_changes:
208 % if c.show_version_changes:
209 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
209 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
210 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
210 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
211 ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))}
211 ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))}
212 <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
212 <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
213 data-toggle-on="${_('show versions')}."
213 data-toggle-on="${_('show versions')}."
214 data-toggle-off="${_('hide versions')}.">
214 data-toggle-off="${_('hide versions')}.">
215 ${_('show versions')}.
215 ${_('show versions')}.
216 </a>
216 </a>
217 <table>
217 <table>
218 ## SHOW ALL VERSIONS OF PR
218 ## SHOW ALL VERSIONS OF PR
219 <% ver_pr = None %>
219 <% ver_pr = None %>
220
220
221 % for data in reversed(list(enumerate(c.versions, 1))):
221 % for data in reversed(list(enumerate(c.versions, 1))):
222 <% ver_pos = data[0] %>
222 <% ver_pos = data[0] %>
223 <% ver = data[1] %>
223 <% ver = data[1] %>
224 <% ver_pr = ver.pull_request_version_id %>
224 <% ver_pr = ver.pull_request_version_id %>
225 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
225 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
226
226
227 <tr class="version-pr" style="display: ${display_row}">
227 <tr class="version-pr" style="display: ${display_row}">
228 <td>
228 <td>
229 <code>
229 <code>
230 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
230 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
231 </code>
231 </code>
232 </td>
232 </td>
233 <td>
233 <td>
234 <input ${('checked="checked"' if c.from_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
234 <input ${('checked="checked"' if c.from_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
235 <input ${('checked="checked"' if c.at_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
235 <input ${('checked="checked"' if c.at_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
236 </td>
236 </td>
237 <td>
237 <td>
238 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
238 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
239 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
239 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
240
240
241 </td>
241 </td>
242 <td>
242 <td>
243 % if c.at_version_num != ver_pr:
243 % if c.at_version_num != ver_pr:
244 <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i>
244 <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i>
245 <code>
245 <code>
246 General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])}
246 General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])}
247 </code>
247 </code>
248 % endif
248 % endif
249 </td>
249 </td>
250 <td>
250 <td>
251 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
251 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
252 </td>
252 </td>
253 <td>
253 <td>
254 <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code>
254 <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code>
255 </td>
255 </td>
256 </tr>
256 </tr>
257 % endfor
257 % endfor
258
258
259 <tr>
259 <tr>
260 <td colspan="6">
260 <td colspan="6">
261 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
261 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
262 data-label-text-locked="${_('select versions to show changes')}"
262 data-label-text-locked="${_('select versions to show changes')}"
263 data-label-text-diff="${_('show changes between versions')}"
263 data-label-text-diff="${_('show changes between versions')}"
264 data-label-text-show="${_('show pull request for this version')}"
264 data-label-text-show="${_('show pull request for this version')}"
265 >
265 >
266 ${_('select versions to show changes')}
266 ${_('select versions to show changes')}
267 </button>
267 </button>
268 </td>
268 </td>
269 </tr>
269 </tr>
270 </table>
270 </table>
271 % else:
271 % else:
272 <div>
272 <div>
273 ${_('Pull request versions not available')}.
273 ${_('Pull request versions not available')}.
274 </div>
274 </div>
275 % endif
275 % endif
276 </div>
276 </div>
277 </div>
277 </div>
278
278
279 </div>
279 </div>
280
280
281 </div>
281 </div>
282
282
283 ## REVIEW RULES
283 ## REVIEW RULES
284 <div id="review_rules" style="display: none" class="reviewers-title block-right">
284 <div id="review_rules" style="display: none" class="reviewers-title block-right">
285 <div class="pr-details-title">
285 <div class="pr-details-title">
286 ${_('Reviewer rules')}
286 ${_('Reviewer rules')}
287 %if c.allowed_to_update:
287 %if c.allowed_to_update:
288 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
288 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
289 %endif
289 %endif
290 </div>
290 </div>
291 <div class="pr-reviewer-rules">
291 <div class="pr-reviewer-rules">
292 ## review rules will be appended here, by default reviewers logic
292 ## review rules will be appended here, by default reviewers logic
293 </div>
293 </div>
294 <input id="review_data" type="hidden" name="review_data" value="">
294 <input id="review_data" type="hidden" name="review_data" value="">
295 </div>
295 </div>
296
296
297 ## REVIEWERS
297 ## REVIEWERS
298 <div class="reviewers-title first-panel block-right">
298 <div class="reviewers-title first-panel block-right">
299 <div class="pr-details-title">
299 <div class="pr-details-title">
300 ${_('Pull request reviewers')}
300 ${_('Pull request reviewers')}
301 %if c.allowed_to_update:
301 %if c.allowed_to_update:
302 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
302 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
303 %endif
303 %endif
304 </div>
304 </div>
305 </div>
305 </div>
306 <div id="reviewers" class="block-right pr-details-content reviewers">
306 <div id="reviewers" class="block-right pr-details-content reviewers">
307
307
308 ## members redering block
308 ## members redering block
309 <input type="hidden" name="__start__" value="review_members:sequence">
309 <input type="hidden" name="__start__" value="review_members:sequence">
310 <ul id="review_members" class="group_members">
310 <ul id="review_members" class="group_members">
311
311
312 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
312 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
313 <script>
313 <script>
314 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
314 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
315 var status = "${(status[0][1].status if status else 'not_reviewed')}";
315 var status = "${(status[0][1].status if status else 'not_reviewed')}";
316 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
316 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
317 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
317 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
318
318
319 var entry = renderTemplate('reviewMemberEntry', {
319 var entry = renderTemplate('reviewMemberEntry', {
320 'member': member,
320 'member': member,
321 'mandatory': member.mandatory,
321 'mandatory': member.mandatory,
322 'reasons': member.reasons,
322 'reasons': member.reasons,
323 'allowed_to_update': allowed_to_update,
323 'allowed_to_update': allowed_to_update,
324 'review_status': status,
324 'review_status': status,
325 'review_status_label': status_lbl,
325 'review_status_label': status_lbl,
326 'user_group': member.user_group,
326 'user_group': member.user_group,
327 'create': false
327 'create': false
328 });
328 });
329 $('#review_members').append(entry)
329 $('#review_members').append(entry)
330 </script>
330 </script>
331
331
332 % endfor
332 % endfor
333
333
334 </ul>
334 </ul>
335
335
336 <input type="hidden" name="__end__" value="review_members:sequence">
336 <input type="hidden" name="__end__" value="review_members:sequence">
337 ## end members redering block
337 ## end members redering block
338
338
339 %if not c.pull_request.is_closed():
339 %if not c.pull_request.is_closed():
340 <div id="add_reviewer" class="ac" style="display: none;">
340 <div id="add_reviewer" class="ac" style="display: none;">
341 %if c.allowed_to_update:
341 %if c.allowed_to_update:
342 % if not c.forbid_adding_reviewers:
342 % if not c.forbid_adding_reviewers:
343 <div id="add_reviewer_input" class="reviewer_ac">
343 <div id="add_reviewer_input" class="reviewer_ac">
344 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
344 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
345 <div id="reviewers_container"></div>
345 <div id="reviewers_container"></div>
346 </div>
346 </div>
347 % endif
347 % endif
348 <div class="pull-right">
348 <div class="pull-right">
349 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
349 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
350 </div>
350 </div>
351 %endif
351 %endif
352 </div>
352 </div>
353 %endif
353 %endif
354 </div>
354 </div>
355
355
356 ## TODOs will be listed here
356 ## TODOs will be listed here
357 <div class="reviewers-title block-right">
357 <div class="reviewers-title block-right">
358 <div class="pr-details-title">
358 <div class="pr-details-title">
359 ## Only show unresolved, that is only what matters
359 ## Only show unresolved, that is only what matters
360 TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))}
360 TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))}
361
361
362 % if not c.at_version:
362 % if not c.at_version:
363 % if c.resolved_comments:
363 % if c.resolved_comments:
364 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return versionController.toggleElement(this, '.unresolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
364 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return versionController.toggleElement(this, '.unresolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
365 % else:
365 % else:
366 <span class="block-right last-item noselect">Show resolved</span>
366 <span class="block-right last-item noselect">Show resolved</span>
367 % endif
367 % endif
368 % endif
368 % endif
369 </div>
369 </div>
370 </div>
370 </div>
371 <div class="block-right pr-details-content reviewers">
371 <div class="block-right pr-details-content reviewers">
372
372
373 <table class="todo-table">
373 <table class="todo-table">
374 <%
374 <%
375 def sorter(entry):
375 def sorter(entry):
376 user_id = entry.author.user_id
376 user_id = entry.author.user_id
377 resolved = '1' if entry.resolved else '0'
377 resolved = '1' if entry.resolved else '0'
378 if user_id == c.rhodecode_user.user_id:
378 if user_id == c.rhodecode_user.user_id:
379 # own comments first
379 # own comments first
380 user_id = 0
380 user_id = 0
381 return '{}_{}_{}'.format(resolved, user_id, str(entry.comment_id).zfill(100))
381 return '{}_{}_{}'.format(resolved, user_id, str(entry.comment_id).zfill(100))
382 %>
382 %>
383
383
384 % if c.at_version:
384 % if c.at_version:
385 <tr>
385 <tr>
386 <td class="unresolved-todo-text">${_('unresolved TODOs unavailable in this view')}.</td>
386 <td class="unresolved-todo-text">${_('unresolved TODOs unavailable in this view')}.</td>
387 </tr>
387 </tr>
388 % else:
388 % else:
389 % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter):
389 % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter):
390 <% resolved = todo_comment.resolved %>
390 <% resolved = todo_comment.resolved %>
391 % if inline:
391 % if inline:
392 <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
392 <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
393 % else:
393 % else:
394 <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %>
394 <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %>
395 % endif
395 % endif
396
396
397 <tr ${('class="unresolved-todo" style="display: none"' if resolved else '') |n}>
397 <tr ${('class="unresolved-todo" style="display: none"' if resolved else '') |n}>
398
398
399 <td class="td-todo-number">
399 <td class="td-todo-number">
400 % if resolved:
400 % if resolved:
401 <a class="permalink todo-resolved tooltip" title="${_('Resolved by comment #{}').format(todo_comment.resolved.comment_id)}" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})">
401 <a class="permalink todo-resolved tooltip" title="${_('Resolved by comment #{}').format(todo_comment.resolved.comment_id)}" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})">
402 <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a>
402 <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a>
403 % else:
403 % else:
404 <a class="permalink" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})">
404 <a class="permalink" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})">
405 <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a>
405 <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a>
406 % endif
406 % endif
407 </td>
407 </td>
408 <td class="td-todo-gravatar">
408 <td class="td-todo-gravatar">
409 ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])}
409 ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])}
410 </td>
410 </td>
411 <td class="todo-comment-text-wrapper">
411 <td class="todo-comment-text-wrapper">
412 <div class="todo-comment-text">
412 <div class="todo-comment-text">
413 <code>${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')}</code>
413 <code>${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')}</code>
414 </div>
414 </div>
415 </td>
415 </td>
416
416
417 </tr>
417 </tr>
418 % endfor
418 % endfor
419
419
420 % if len(c.unresolved_comments) == 0:
420 % if len(c.unresolved_comments) == 0:
421 <tr>
421 <tr>
422 <td class="unresolved-todo-text">${_('No unresolved TODOs')}.</td>
422 <td class="unresolved-todo-text">${_('No unresolved TODOs')}.</td>
423 </tr>
423 </tr>
424 % endif
424 % endif
425
425
426 % endif
426 % endif
427
427
428 </table>
428 </table>
429
429
430 </div>
430 </div>
431 </div>
431 </div>
432
432
433 </div>
433 </div>
434
434
435 <div class="box">
435 <div class="box">
436
436
437 % if c.state_progressing:
437 % if c.state_progressing:
438
438
439 <h2 style="text-align: center">
439 <h2 style="text-align: center">
440 ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span>
440 ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span>
441
441
442 % if c.is_super_admin:
442 % if c.is_super_admin:
443 <br/>
443 <br/>
444 If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state.
444 If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state.
445 % endif
445 % endif
446 </h2>
446 </h2>
447
447
448 % else:
448 % else:
449
449
450 ## Diffs rendered here
450 ## Diffs rendered here
451 <div class="table" >
451 <div class="table" >
452 <div id="changeset_compare_view_content">
452 <div id="changeset_compare_view_content">
453 ##CS
453 ##CS
454 % if c.missing_requirements:
454 % if c.missing_requirements:
455 <div class="box">
455 <div class="box">
456 <div class="alert alert-warning">
456 <div class="alert alert-warning">
457 <div>
457 <div>
458 <strong>${_('Missing requirements:')}</strong>
458 <strong>${_('Missing requirements:')}</strong>
459 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
459 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
460 </div>
460 </div>
461 </div>
461 </div>
462 </div>
462 </div>
463 % elif c.missing_commits:
463 % elif c.missing_commits:
464 <div class="box">
464 <div class="box">
465 <div class="alert alert-warning">
465 <div class="alert alert-warning">
466 <div>
466 <div>
467 <strong>${_('Missing commits')}:</strong>
467 <strong>${_('Missing commits')}:</strong>
468 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
468 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
469 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
469 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
470 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
470 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
471 </div>
471 </div>
472 </div>
472 </div>
473 </div>
473 </div>
474 % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed():
474 % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed():
475 <div class="box">
475 <div class="box">
476 <div class="alert alert-info">
476 <div class="alert alert-info">
477 <div>
477 <div>
478 <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong>
478 <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong>
479 </div>
479 </div>
480 </div>
480 </div>
481 </div>
481 </div>
482 % endif
482 % endif
483
483
484 <div class="compare_view_commits_title">
484 <div class="compare_view_commits_title">
485 % if not c.compare_mode:
485 % if not c.compare_mode:
486
486
487 % if c.at_version_pos:
487 % if c.at_version_pos:
488 <h4>
488 <h4>
489 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
489 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
490 </h4>
490 </h4>
491 % endif
491 % endif
492
492
493 <div class="pull-left">
493 <div class="pull-left">
494 <div class="btn-group">
494 <div class="btn-group">
495 <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} >
495 <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} >
496 % if c.collapse_all_commits:
496 % if c.collapse_all_commits:
497 <i class="icon-plus-squared-alt icon-no-margin"></i>
497 <i class="icon-plus-squared-alt icon-no-margin"></i>
498 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
498 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
499 % else:
499 % else:
500 <i class="icon-minus-squared-alt icon-no-margin"></i>
500 <i class="icon-minus-squared-alt icon-no-margin"></i>
501 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
501 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
502 % endif
502 % endif
503 </a>
503 </a>
504 </div>
504 </div>
505 </div>
505 </div>
506
506
507 <div class="pull-right">
507 <div class="pull-right">
508 % if c.allowed_to_update and not c.pull_request.is_closed():
508 % if c.allowed_to_update and not c.pull_request.is_closed():
509
509
510 <div class="btn-group btn-group-actions">
510 <div class="btn-group btn-group-actions">
511 <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false">
511 <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false">
512 ${_('Update commits')}
512 ${_('Update commits')}
513 </a>
513 </a>
514
514
515 <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}">
515 <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}">
516 <i class="icon-down"></i>
516 <i class="icon-down"></i>
517 </a>
517 </a>
518
518
519 <div class="btn-action-switcher-container" id="update-commits-switcher">
519 <div class="btn-action-switcher-container" id="update-commits-switcher">
520 <ul class="btn-action-switcher" role="menu">
520 <ul class="btn-action-switcher" role="menu" style="min-width: 300px;">
521 <li>
521 <li>
522 <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false">
522 <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false">
523 ${_('Force update commits')}
523 ${_('Force update commits')}
524 </a>
524 </a>
525 <div class="action-help-block">
525 <div class="action-help-block">
526 ${_('Update commits and force refresh this pull request.')}
526 ${_('Update commits and force refresh this pull request.')}
527 </div>
527 </div>
528 </li>
528 </li>
529 </ul>
529 </ul>
530 </div>
530 </div>
531 </div>
531 </div>
532
532
533 % else:
533 % else:
534 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
534 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
535 % endif
535 % endif
536
536
537 </div>
537 </div>
538 % endif
538 % endif
539 </div>
539 </div>
540
540
541 % if not c.missing_commits:
541 % if not c.missing_commits:
542 % if c.compare_mode:
542 % if c.compare_mode:
543 % if c.at_version:
543 % if c.at_version:
544 <h4>
544 <h4>
545 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
545 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
546 </h4>
546 </h4>
547
547
548 <div class="subtitle-compare">
548 <div class="subtitle-compare">
549 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
549 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
550 </div>
550 </div>
551
551
552 <div class="container">
552 <div class="container">
553 <table class="rctable compare_view_commits">
553 <table class="rctable compare_view_commits">
554 <tr>
554 <tr>
555 <th></th>
555 <th></th>
556 <th>${_('Time')}</th>
556 <th>${_('Time')}</th>
557 <th>${_('Author')}</th>
557 <th>${_('Author')}</th>
558 <th>${_('Commit')}</th>
558 <th>${_('Commit')}</th>
559 <th></th>
559 <th></th>
560 <th>${_('Description')}</th>
560 <th>${_('Description')}</th>
561 </tr>
561 </tr>
562
562
563 % for c_type, commit in c.commit_changes:
563 % for c_type, commit in c.commit_changes:
564 % if c_type in ['a', 'r']:
564 % if c_type in ['a', 'r']:
565 <%
565 <%
566 if c_type == 'a':
566 if c_type == 'a':
567 cc_title = _('Commit added in displayed changes')
567 cc_title = _('Commit added in displayed changes')
568 elif c_type == 'r':
568 elif c_type == 'r':
569 cc_title = _('Commit removed in displayed changes')
569 cc_title = _('Commit removed in displayed changes')
570 else:
570 else:
571 cc_title = ''
571 cc_title = ''
572 %>
572 %>
573 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
573 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
574 <td>
574 <td>
575 <div class="commit-change-indicator color-${c_type}-border">
575 <div class="commit-change-indicator color-${c_type}-border">
576 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
576 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
577 ${c_type.upper()}
577 ${c_type.upper()}
578 </div>
578 </div>
579 </div>
579 </div>
580 </td>
580 </td>
581 <td class="td-time">
581 <td class="td-time">
582 ${h.age_component(commit.date)}
582 ${h.age_component(commit.date)}
583 </td>
583 </td>
584 <td class="td-user">
584 <td class="td-user">
585 ${base.gravatar_with_user(commit.author, 16, tooltip=True)}
585 ${base.gravatar_with_user(commit.author, 16, tooltip=True)}
586 </td>
586 </td>
587 <td class="td-hash">
587 <td class="td-hash">
588 <code>
588 <code>
589 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
589 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
590 r${commit.idx}:${h.short_id(commit.raw_id)}
590 r${commit.idx}:${h.short_id(commit.raw_id)}
591 </a>
591 </a>
592 ${h.hidden('revisions', commit.raw_id)}
592 ${h.hidden('revisions', commit.raw_id)}
593 </code>
593 </code>
594 </td>
594 </td>
595 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
595 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
596 <i class="icon-expand-linked"></i>
596 <i class="icon-expand-linked"></i>
597 </td>
597 </td>
598 <td class="mid td-description">
598 <td class="mid td-description">
599 <div class="log-container truncate-wrap">
599 <div class="log-container truncate-wrap">
600 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
600 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
601 </div>
601 </div>
602 </td>
602 </td>
603 </tr>
603 </tr>
604 % endif
604 % endif
605 % endfor
605 % endfor
606 </table>
606 </table>
607 </div>
607 </div>
608
608
609 % endif
609 % endif
610
610
611 % else:
611 % else:
612 <%include file="/compare/compare_commits.mako" />
612 <%include file="/compare/compare_commits.mako" />
613 % endif
613 % endif
614
614
615 <div class="cs_files">
615 <div class="cs_files">
616 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
616 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
617 % if c.at_version:
617 % if c.at_version:
618 <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['display']) %>
618 <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['display']) %>
619 <% c.comments = c.comment_versions[c.at_version_num]['display'] %>
619 <% c.comments = c.comment_versions[c.at_version_num]['display'] %>
620 % else:
620 % else:
621 <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['until']) %>
621 <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['until']) %>
622 <% c.comments = c.comment_versions[c.at_version_num]['until'] %>
622 <% c.comments = c.comment_versions[c.at_version_num]['until'] %>
623 % endif
623 % endif
624
624
625 <%
625 <%
626 pr_menu_data = {
626 pr_menu_data = {
627 'outdated_comm_count_ver': outdated_comm_count_ver,
627 'outdated_comm_count_ver': outdated_comm_count_ver,
628 'pull_request': c.pull_request
628 'pull_request': c.pull_request
629 }
629 }
630 %>
630 %>
631
631
632 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on, pull_request_menu=pr_menu_data)}
632 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on, pull_request_menu=pr_menu_data)}
633
633
634 % if c.range_diff_on:
634 % if c.range_diff_on:
635 % for commit in c.commit_ranges:
635 % for commit in c.commit_ranges:
636 ${cbdiffs.render_diffset(
636 ${cbdiffs.render_diffset(
637 c.changes[commit.raw_id],
637 c.changes[commit.raw_id],
638 commit=commit, use_comments=True,
638 commit=commit, use_comments=True,
639 collapse_when_files_over=5,
639 collapse_when_files_over=5,
640 disable_new_comments=True,
640 disable_new_comments=True,
641 deleted_files_comments=c.deleted_files_comments,
641 deleted_files_comments=c.deleted_files_comments,
642 inline_comments=c.inline_comments,
642 inline_comments=c.inline_comments,
643 pull_request_menu=pr_menu_data, show_todos=False)}
643 pull_request_menu=pr_menu_data, show_todos=False)}
644 % endfor
644 % endfor
645 % else:
645 % else:
646 ${cbdiffs.render_diffset(
646 ${cbdiffs.render_diffset(
647 c.diffset, use_comments=True,
647 c.diffset, use_comments=True,
648 collapse_when_files_over=30,
648 collapse_when_files_over=30,
649 disable_new_comments=not c.allowed_to_comment,
649 disable_new_comments=not c.allowed_to_comment,
650 deleted_files_comments=c.deleted_files_comments,
650 deleted_files_comments=c.deleted_files_comments,
651 inline_comments=c.inline_comments,
651 inline_comments=c.inline_comments,
652 pull_request_menu=pr_menu_data, show_todos=False)}
652 pull_request_menu=pr_menu_data, show_todos=False)}
653 % endif
653 % endif
654
654
655 </div>
655 </div>
656 % else:
656 % else:
657 ## skipping commits we need to clear the view for missing commits
657 ## skipping commits we need to clear the view for missing commits
658 <div style="clear:both;"></div>
658 <div style="clear:both;"></div>
659 % endif
659 % endif
660
660
661 </div>
661 </div>
662 </div>
662 </div>
663
663
664 ## template for inline comment form
664 ## template for inline comment form
665 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
665 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
666
666
667 ## comments heading with count
667 ## comments heading with count
668 <div class="comments-heading">
668 <div class="comments-heading">
669 <i class="icon-comment"></i>
669 <i class="icon-comment"></i>
670 ${_('Comments')} ${len(c.comments)}
670 ${_('Comments')} ${len(c.comments)}
671 </div>
671 </div>
672
672
673 ## render general comments
673 ## render general comments
674 <div id="comment-tr-show">
674 <div id="comment-tr-show">
675 % if general_outdated_comm_count_ver:
675 % if general_outdated_comm_count_ver:
676 <div class="info-box">
676 <div class="info-box">
677 % if general_outdated_comm_count_ver == 1:
677 % if general_outdated_comm_count_ver == 1:
678 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
678 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
679 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
679 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
680 % else:
680 % else:
681 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
681 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
682 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
682 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
683 % endif
683 % endif
684 </div>
684 </div>
685 % endif
685 % endif
686 </div>
686 </div>
687
687
688 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
688 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
689
689
690 % if not c.pull_request.is_closed():
690 % if not c.pull_request.is_closed():
691 ## main comment form and it status
691 ## main comment form and it status
692 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
692 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
693 pull_request_id=c.pull_request.pull_request_id),
693 pull_request_id=c.pull_request.pull_request_id),
694 c.pull_request_review_status,
694 c.pull_request_review_status,
695 is_pull_request=True, change_status=c.allowed_to_change_status)}
695 is_pull_request=True, change_status=c.allowed_to_change_status)}
696
696
697 ## merge status, and merge action
697 ## merge status, and merge action
698 <div class="pull-request-merge">
698 <div class="pull-request-merge">
699 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
699 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
700 </div>
700 </div>
701
701
702 %endif
702 %endif
703
703
704 % endif
704 % endif
705 </div>
705 </div>
706
706
707 <script type="text/javascript">
707 <script type="text/javascript">
708
708
709 versionController = new VersionController();
709 versionController = new VersionController();
710 versionController.init();
710 versionController.init();
711
711
712 reviewersController = new ReviewersController();
712 reviewersController = new ReviewersController();
713 commitsController = new CommitsController();
713 commitsController = new CommitsController();
714
714
715 updateController = new UpdatePrController();
715 updateController = new UpdatePrController();
716
716
717 $(function () {
717 $(function () {
718
718
719 // custom code mirror
719 // custom code mirror
720 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
720 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
721
721
722 var PRDetails = {
722 var PRDetails = {
723 editButton: $('#open_edit_pullrequest'),
723 editButton: $('#open_edit_pullrequest'),
724 closeButton: $('#close_edit_pullrequest'),
724 closeButton: $('#close_edit_pullrequest'),
725 deleteButton: $('#delete_pullrequest'),
725 deleteButton: $('#delete_pullrequest'),
726 viewFields: $('#pr-desc, #pr-title'),
726 viewFields: $('#pr-desc, #pr-title'),
727 editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'),
727 editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'),
728
728
729 init: function () {
729 init: function () {
730 var that = this;
730 var that = this;
731 this.editButton.on('click', function (e) {
731 this.editButton.on('click', function (e) {
732 that.edit();
732 that.edit();
733 });
733 });
734 this.closeButton.on('click', function (e) {
734 this.closeButton.on('click', function (e) {
735 that.view();
735 that.view();
736 });
736 });
737 },
737 },
738
738
739 edit: function (event) {
739 edit: function (event) {
740 this.viewFields.hide();
740 this.viewFields.hide();
741 this.editButton.hide();
741 this.editButton.hide();
742 this.deleteButton.hide();
742 this.deleteButton.hide();
743 this.closeButton.show();
743 this.closeButton.show();
744 this.editFields.show();
744 this.editFields.show();
745 codeMirrorInstance.refresh();
745 codeMirrorInstance.refresh();
746 },
746 },
747
747
748 view: function (event) {
748 view: function (event) {
749 this.editButton.show();
749 this.editButton.show();
750 this.deleteButton.show();
750 this.deleteButton.show();
751 this.editFields.hide();
751 this.editFields.hide();
752 this.closeButton.hide();
752 this.closeButton.hide();
753 this.viewFields.show();
753 this.viewFields.show();
754 }
754 }
755 };
755 };
756
756
757 var ReviewersPanel = {
757 var ReviewersPanel = {
758 editButton: $('#open_edit_reviewers'),
758 editButton: $('#open_edit_reviewers'),
759 closeButton: $('#close_edit_reviewers'),
759 closeButton: $('#close_edit_reviewers'),
760 addButton: $('#add_reviewer'),
760 addButton: $('#add_reviewer'),
761 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
761 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
762
762
763 init: function () {
763 init: function () {
764 var self = this;
764 var self = this;
765 this.editButton.on('click', function (e) {
765 this.editButton.on('click', function (e) {
766 self.edit();
766 self.edit();
767 });
767 });
768 this.closeButton.on('click', function (e) {
768 this.closeButton.on('click', function (e) {
769 self.close();
769 self.close();
770 });
770 });
771 },
771 },
772
772
773 edit: function (event) {
773 edit: function (event) {
774 this.editButton.hide();
774 this.editButton.hide();
775 this.closeButton.show();
775 this.closeButton.show();
776 this.addButton.show();
776 this.addButton.show();
777 this.removeButtons.css('visibility', 'visible');
777 this.removeButtons.css('visibility', 'visible');
778 // review rules
778 // review rules
779 reviewersController.loadReviewRules(
779 reviewersController.loadReviewRules(
780 ${c.pull_request.reviewer_data_json | n});
780 ${c.pull_request.reviewer_data_json | n});
781 },
781 },
782
782
783 close: function (event) {
783 close: function (event) {
784 this.editButton.show();
784 this.editButton.show();
785 this.closeButton.hide();
785 this.closeButton.hide();
786 this.addButton.hide();
786 this.addButton.hide();
787 this.removeButtons.css('visibility', 'hidden');
787 this.removeButtons.css('visibility', 'hidden');
788 // hide review rules
788 // hide review rules
789 reviewersController.hideReviewRules()
789 reviewersController.hideReviewRules()
790 }
790 }
791 };
791 };
792
792
793 PRDetails.init();
793 PRDetails.init();
794 ReviewersPanel.init();
794 ReviewersPanel.init();
795
795
796 showOutdated = function (self) {
796 showOutdated = function (self) {
797 $('.comment-inline.comment-outdated').show();
797 $('.comment-inline.comment-outdated').show();
798 $('.filediff-outdated').show();
798 $('.filediff-outdated').show();
799 $('.showOutdatedComments').hide();
799 $('.showOutdatedComments').hide();
800 $('.hideOutdatedComments').show();
800 $('.hideOutdatedComments').show();
801 };
801 };
802
802
803 hideOutdated = function (self) {
803 hideOutdated = function (self) {
804 $('.comment-inline.comment-outdated').hide();
804 $('.comment-inline.comment-outdated').hide();
805 $('.filediff-outdated').hide();
805 $('.filediff-outdated').hide();
806 $('.hideOutdatedComments').hide();
806 $('.hideOutdatedComments').hide();
807 $('.showOutdatedComments').show();
807 $('.showOutdatedComments').show();
808 };
808 };
809
809
810 refreshMergeChecks = function () {
810 refreshMergeChecks = function () {
811 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
811 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
812 $('.pull-request-merge').css('opacity', 0.3);
812 $('.pull-request-merge').css('opacity', 0.3);
813 $('.action-buttons-extra').css('opacity', 0.3);
813 $('.action-buttons-extra').css('opacity', 0.3);
814
814
815 $('.pull-request-merge').load(
815 $('.pull-request-merge').load(
816 loadUrl, function () {
816 loadUrl, function () {
817 $('.pull-request-merge').css('opacity', 1);
817 $('.pull-request-merge').css('opacity', 1);
818
818
819 $('.action-buttons-extra').css('opacity', 1);
819 $('.action-buttons-extra').css('opacity', 1);
820 }
820 }
821 );
821 );
822 };
822 };
823
823
824 closePullRequest = function (status) {
824 closePullRequest = function (status) {
825 if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) {
825 if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) {
826 return false;
826 return false;
827 }
827 }
828 // inject closing flag
828 // inject closing flag
829 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
829 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
830 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
830 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
831 $(generalCommentForm.submitForm).submit();
831 $(generalCommentForm.submitForm).submit();
832 };
832 };
833
833
834 $('#show-outdated-comments').on('click', function (e) {
834 $('#show-outdated-comments').on('click', function (e) {
835 var button = $(this);
835 var button = $(this);
836 var outdated = $('.comment-outdated');
836 var outdated = $('.comment-outdated');
837
837
838 if (button.html() === "(Show)") {
838 if (button.html() === "(Show)") {
839 button.html("(Hide)");
839 button.html("(Hide)");
840 outdated.show();
840 outdated.show();
841 } else {
841 } else {
842 button.html("(Show)");
842 button.html("(Show)");
843 outdated.hide();
843 outdated.hide();
844 }
844 }
845 });
845 });
846
846
847 $('.show-inline-comments').on('change', function (e) {
847 $('.show-inline-comments').on('change', function (e) {
848 var show = 'none';
848 var show = 'none';
849 var target = e.currentTarget;
849 var target = e.currentTarget;
850 if (target.checked) {
850 if (target.checked) {
851 show = ''
851 show = ''
852 }
852 }
853 var boxid = $(target).attr('id_for');
853 var boxid = $(target).attr('id_for');
854 var comments = $('#{0} .inline-comments'.format(boxid));
854 var comments = $('#{0} .inline-comments'.format(boxid));
855 var fn_display = function (idx) {
855 var fn_display = function (idx) {
856 $(this).css('display', show);
856 $(this).css('display', show);
857 };
857 };
858 $(comments).each(fn_display);
858 $(comments).each(fn_display);
859 var btns = $('#{0} .inline-comments-button'.format(boxid));
859 var btns = $('#{0} .inline-comments-button'.format(boxid));
860 $(btns).each(fn_display);
860 $(btns).each(fn_display);
861 });
861 });
862
862
863 $('#merge_pull_request_form').submit(function () {
863 $('#merge_pull_request_form').submit(function () {
864 if (!$('#merge_pull_request').attr('disabled')) {
864 if (!$('#merge_pull_request').attr('disabled')) {
865 $('#merge_pull_request').attr('disabled', 'disabled');
865 $('#merge_pull_request').attr('disabled', 'disabled');
866 }
866 }
867 return true;
867 return true;
868 });
868 });
869
869
870 $('#edit_pull_request').on('click', function (e) {
870 $('#edit_pull_request').on('click', function (e) {
871 var title = $('#pr-title-input').val();
871 var title = $('#pr-title-input').val();
872 var description = codeMirrorInstance.getValue();
872 var description = codeMirrorInstance.getValue();
873 var renderer = $('#pr-renderer-input').val();
873 var renderer = $('#pr-renderer-input').val();
874 editPullRequest(
874 editPullRequest(
875 "${c.repo_name}", "${c.pull_request.pull_request_id}",
875 "${c.repo_name}", "${c.pull_request.pull_request_id}",
876 title, description, renderer);
876 title, description, renderer);
877 });
877 });
878
878
879 $('#update_pull_request').on('click', function (e) {
879 $('#update_pull_request').on('click', function (e) {
880 $(this).attr('disabled', 'disabled');
880 $(this).attr('disabled', 'disabled');
881 $(this).addClass('disabled');
881 $(this).addClass('disabled');
882 $(this).html(_gettext('Saving...'));
882 $(this).html(_gettext('Saving...'));
883 reviewersController.updateReviewers(
883 reviewersController.updateReviewers(
884 "${c.repo_name}", "${c.pull_request.pull_request_id}");
884 "${c.repo_name}", "${c.pull_request.pull_request_id}");
885 });
885 });
886
886
887
887
888 // fixing issue with caches on firefox
888 // fixing issue with caches on firefox
889 $('#update_commits').removeAttr("disabled");
889 $('#update_commits').removeAttr("disabled");
890
890
891 $('.show-inline-comments').on('click', function (e) {
891 $('.show-inline-comments').on('click', function (e) {
892 var boxid = $(this).attr('data-comment-id');
892 var boxid = $(this).attr('data-comment-id');
893 var button = $(this);
893 var button = $(this);
894
894
895 if (button.hasClass("comments-visible")) {
895 if (button.hasClass("comments-visible")) {
896 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
896 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
897 $(this).hide();
897 $(this).hide();
898 });
898 });
899 button.removeClass("comments-visible");
899 button.removeClass("comments-visible");
900 } else {
900 } else {
901 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
901 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
902 $(this).show();
902 $(this).show();
903 });
903 });
904 button.addClass("comments-visible");
904 button.addClass("comments-visible");
905 }
905 }
906 });
906 });
907
907
908 // register submit callback on commentForm form to track TODOs
908 // register submit callback on commentForm form to track TODOs
909 window.commentFormGlobalSubmitSuccessCallback = function () {
909 window.commentFormGlobalSubmitSuccessCallback = function () {
910 refreshMergeChecks();
910 refreshMergeChecks();
911 };
911 };
912
912
913 ReviewerAutoComplete('#user');
913 ReviewerAutoComplete('#user');
914
914
915 })
915 })
916
916
917 </script>
917 </script>
918
918
919 </div>
919 </div>
920
920
921 </%def>
921 </%def>
General Comments 0
You need to be logged in to leave comments. Login now