... | ... |
@@ -191,6 +191,10 @@ |
191 | 191 |
return; |
192 | 192 |
} |
193 | 193 |
|
194 |
+ # Member projects |
|
195 |
+ my $member_projects = app->manager->member_projects($base_user_id, $base_project_id); |
|
196 |
+ unshift @$member_projects, $base_project; |
|
197 |
+ |
|
194 | 198 |
# Base branches |
195 | 199 |
my $base_branches = $git->branches($base_rep_info); |
196 | 200 |
@$base_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$base_branches; |
... | ... |
@@ -219,7 +223,40 @@ |
219 | 223 |
|
220 | 224 |
%= javascript begin |
221 | 225 |
$(document).ready(function () { |
222 |
- |
|
226 |
+ |
|
227 |
+ // Change base fork |
|
228 |
+ $('#base-fork-btn').on('click', function () { |
|
229 |
+ $('#base-fork-popup') |
|
230 |
+ .css('display', 'block') |
|
231 |
+ .css('top', '40px') |
|
232 |
+ .css('left', '10px') |
|
233 |
+ ; |
|
234 |
+ }); |
|
235 |
+ $('#base-fork-popup').on('click', function () { |
|
236 |
+ $('#base-fork-popup').css('display', 'none'); |
|
237 |
+ }); |
|
238 |
+ // close popup |
|
239 |
+ $(document).click(function() { $('#base-fork-popup').hide(); }); |
|
240 |
+ $('#base-fork-btn').click(function() { event.stopPropagation(); }); |
|
241 |
+ $('#base-fork-popup').click(function() { event.stopPropagation(); }); |
|
242 |
+ |
|
243 |
+ |
|
244 |
+ // Change head fork |
|
245 |
+ $('#head-fork-btn').on('click', function () { |
|
246 |
+ $('#head-fork-popup') |
|
247 |
+ .css('display', 'block') |
|
248 |
+ .css('top', '40px') |
|
249 |
+ .css('left', '10px') |
|
250 |
+ ; |
|
251 |
+ }); |
|
252 |
+ $('#head-fork-popup').on('click', function () { |
|
253 |
+ $('#head-fork-popup').css('display', 'none'); |
|
254 |
+ }); |
|
255 |
+ // close popup |
|
256 |
+ $(document).click(function() { $('#head-fork-popup').hide(); }); |
|
257 |
+ $('#head-fork-btn').click(function() { event.stopPropagation(); }); |
|
258 |
+ $('#head-fork-popup').click(function() { event.stopPropagation(); }); |
|
259 |
+ |
|
223 | 260 |
// Change base branch |
224 | 261 |
$('#base-branch-btn').on('click', function () { |
225 | 262 |
$('#base-branch-popup') |
... | ... |
@@ -248,7 +285,7 @@ |
248 | 285 |
location.href = href; |
249 | 286 |
} |
250 | 287 |
}); |
251 |
- // ポップアップを閉じる |
|
288 |
+ // close popup |
|
252 | 289 |
$(document).click(function() { $('#base-branch-popup').hide(); }); |
253 | 290 |
$('#base-branch-btn').click(function() { event.stopPropagation(); }); |
254 | 291 |
$('#base-branch-popup').click(function() { event.stopPropagation(); }); |
... | ... |
@@ -274,7 +311,7 @@ |
274 | 311 |
location.href = href; |
275 | 312 |
} |
276 | 313 |
}); |
277 |
- // ポップアップを閉じる |
|
314 |
+ // close popup |
|
278 | 315 |
$(document).click(function() { $('#target-branch-popup').hide(); }); |
279 | 316 |
$('#target-branch-btn').click(function() { event.stopPropagation(); }); |
280 | 317 |
$('#target-branch-popup').click(function() { event.stopPropagation(); }); |
... | ... |
@@ -384,29 +421,109 @@ |
384 | 421 |
%= text_field 'target-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker'; |
385 | 422 |
</div> |
386 | 423 |
<div style="background:white;max-height:500px;overflow:auto;"> |
387 |
- <ul class="nav nav-tabs nav-stacked"> |
|
388 |
- % for (my $i = 0; $i < @$target_branches; $i++) { |
|
389 |
- % my $target_branch = $target_branches->[$i]; |
|
390 |
- <li> |
|
424 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
425 |
+ % for (my $i = 0; $i < @$target_branches; $i++) { |
|
426 |
+ % my $target_branch = $target_branches->[$i]; |
|
427 |
+ <li> |
|
428 |
+ <% |
|
429 |
+ my $url; |
|
430 |
+ if ($base_user_id eq $target_user_id) { |
|
431 |
+ $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch->{name}"); |
|
432 |
+ } |
|
433 |
+ else { |
|
434 |
+ $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_user_id:$target_branch->{name}"); |
|
435 |
+ } |
|
436 |
+ %> |
|
437 |
+ <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
438 |
+ <%= $target_branch->{name} %> |
|
439 |
+ </a> |
|
440 |
+ </li> |
|
441 |
+ % } |
|
442 |
+ </ul> |
|
443 |
+ </div> |
|
444 |
+ </div> |
|
445 |
+ |
|
446 |
+ |
|
447 |
+ <div id="base-fork-popup" style="display:none;width:330px;position:absolute"> |
|
448 |
+ <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
449 |
+ <div style="overflow:hidden"> |
|
450 |
+ <div style="float:left;width:90%;"> |
|
451 |
+ <b>Choose a base fork</b> |
|
452 |
+ </div> |
|
453 |
+ <div style="float:left:width:10%;text-align:right;"> |
|
454 |
+ <i id="member-project-close" class="icon-remove-circle"></i> |
|
455 |
+ </div> |
|
456 |
+ </div> |
|
457 |
+ </div> |
|
458 |
+ <div style="background:white;max-height:500px;overflow:auto;"> |
|
459 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
460 |
+ % for (my $i = 0; $i < @$member_projects; $i++) { |
|
461 |
+ % my $member_project = $member_projects->[$i]; |
|
391 | 462 |
<% |
392 |
- my $url; |
|
393 |
- if ($base_user_id eq $target_user_id) { |
|
394 |
- $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch->{name}"); |
|
395 |
- } |
|
396 |
- else { |
|
397 |
- $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_user_id:$target_branch->{name}"); |
|
398 |
- } |
|
463 |
+ my $member_user_id = $member_project->{'__user.id'}; |
|
464 |
+ my $member_project_id = $member_project->{id}; |
|
399 | 465 |
%> |
400 |
- <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
401 |
- <%= $target_branch->{name} %> |
|
402 |
- </a> |
|
403 |
- </li> |
|
404 |
- % } |
|
405 |
- </ul> |
|
466 |
+ <li> |
|
467 |
+ <% |
|
468 |
+ my $url; |
|
469 |
+ if ($member_user_id eq $target_user_id) { |
|
470 |
+ $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_branch"); |
|
471 |
+ } |
|
472 |
+ else { |
|
473 |
+ $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_user_id:$target_branch"); |
|
474 |
+ } |
|
475 |
+ %> |
|
476 |
+ <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
477 |
+ <%= $member_user_id %>/<%= $member_project_id %> |
|
478 |
+ </a> |
|
479 |
+ </li> |
|
480 |
+ % } |
|
481 |
+ </ul> |
|
482 |
+ </div> |
|
483 |
+ </div> |
|
484 |
+ |
|
485 |
+ |
|
486 |
+ |
|
487 |
+ |
|
488 |
+ <div id="head-fork-popup" style="display:none;width:330px;position:absolute"> |
|
489 |
+ <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
490 |
+ <div style="overflow:hidden"> |
|
491 |
+ <div style="float:left;width:90%;"> |
|
492 |
+ <b>Choose a head fork</b> |
|
493 |
+ </div> |
|
494 |
+ <div style="float:left:width:10%;text-align:right;"> |
|
495 |
+ <i id="member-project-close" class="icon-remove-circle"></i> |
|
496 |
+ </div> |
|
497 |
+ </div> |
|
498 |
+ </div> |
|
499 |
+ <div style="background:white;max-height:500px;overflow:auto;"> |
|
500 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
501 |
+ % for (my $i = 0; $i < @$member_projects; $i++) { |
|
502 |
+ % my $member_project = $member_projects->[$i]; |
|
503 |
+ <% |
|
504 |
+ my $member_user_id = $member_project->{'__user.id'}; |
|
505 |
+ my $member_project_id = $member_project->{id}; |
|
506 |
+ %> |
|
507 |
+ <li> |
|
508 |
+ <% |
|
509 |
+ my $url; |
|
510 |
+ if ($member_user_id eq $base_user_id) { |
|
511 |
+ $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch"); |
|
512 |
+ } |
|
513 |
+ else { |
|
514 |
+ $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$member_user_id:$target_branch"); |
|
515 |
+ } |
|
516 |
+ %> |
|
517 |
+ <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
518 |
+ <%= $member_user_id %>/<%= $member_project_id %> |
|
519 |
+ </a> |
|
520 |
+ </li> |
|
521 |
+ % } |
|
522 |
+ </ul> |
|
406 | 523 |
</div> |
407 | 524 |
</div> |
408 | 525 |
</div> |
409 |
- |
|
526 |
+ |
|
410 | 527 |
% if ($merge_success) { |
411 | 528 |
<div class="compare-open-pull-request"> |
412 | 529 |
<form action="<%= url_for %>" method="post"> |