(refs #2)Comparing between all forked repositories.

This commit is contained in:
takezoe
2013-07-27 04:11:33 +09:00
parent 59d85531ce
commit 66f3a1fe7d
4 changed files with 119 additions and 68 deletions

View File

@@ -1,13 +1,14 @@
@(commits: Seq[Seq[util.JGitUtil.CommitInfo]],
diffs: Seq[util.JGitUtil.DiffInfo],
origin: String,
members: List[String],
originId: String,
forkedId: String,
sourceId: String,
commitId: String,
hasConflict: Boolean,
repository: service.RepositoryService.RepositoryInfo,
originRepository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
originRepository: service.RepositoryService.RepositoryInfo,
forkedRepository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@import view.helpers._
@import org.eclipse.jgit.diff.DiffEntry.ChangeType
@@ -16,21 +17,29 @@
<div style="border: 1px solid #eee; background-color: #f8f8f8; margin-bottom: 10px; padding: 8px;">
<div id="compare-info">
<a href="#" id="edit-compare-condition" class="btn btn-mini pull-right">Edit</a>
<span class="label label-info monospace">@origin:@originId</span> ... <span class="label label-info monospace">@repository.owner:@forkedId</span>
<span class="label label-info monospace">@originRepository.owner:@originId</span> ... <span class="label label-info monospace">@forkedRepository.owner:@forkedId</span>
</div>
<div id="compare-edit" style="display: none;">
<a href="#" id="refresh-compare" class="pull-right"><i class="icon-remove-circle"></i></a>
<span class="label label-info monospace">@origin/@repository.name:</span>
@helper.html.dropdown(originId) {
<a href="#" id="cancel-condition-editing" class="pull-right"><i class="icon-remove-circle"></i></a>
@helper.html.dropdown(originRepository.owner + "/" + repository.name, "base fork") {
@members.map { member =>
<li><a href="#" class="origin-owner" data-name="@member">@helper.html.checkicon(member == originRepository.owner) @member/@repository.name</a></li>
}
}
@helper.html.dropdown(originId, "base") {
@originRepository.branchList.map { branch =>
<li><a href="#" class="origin-branch" data-branch="@branch">@helper.html.checkicon(branch == originId) @branch</a></li>
<li><a href="#" class="origin-branch" data-name="@branch">@helper.html.checkicon(branch == originId) @branch</a></li>
}
}
...
<span class="label label-info monospace">@repository.owner/@repository.name:</span>
@helper.html.dropdown(forkedId) {
@repository.branchList.map { branch =>
<li><a href="#" class="forked-branch" data-branch="@branch">@helper.html.checkicon(branch == forkedId) @branch</a></li>
@helper.html.dropdown(forkedRepository.owner + "/" + repository.name, "head fork") {
@members.map { member =>
<li><a href="#" class="forked-owner" data-name="@member">@helper.html.checkicon(member == forkedRepository.owner) @member/@repository.name</a></li>
}
}
@helper.html.dropdown(forkedId, "compare") {
@forkedRepository.branchList.map { branch =>
<li><a href="#" class="forked-branch" data-name="@branch">@helper.html.checkicon(branch == forkedId) @branch</a></li>
}
}
</div>
@@ -41,7 +50,7 @@
</div>
<div id="pull-request-form" class="box" style="display: none;">
<div class="box-content">
<form method="POST" action="@path/@origin/@repository.name/pulls/new" validate="true">
<form method="POST" action="@path/@originRepository.owner/@repository.name/pulls/new" validate="true">
<div style="width: 260px; position: absolute; margin-left: 635px;">
@if(hasConflict){
<h4>We cant automatically merge these branches</h4>
@@ -71,7 +80,7 @@
<tr>
<td style="padding: 20px; background-color: #eee; text-align: center;">
<h4>There isn't anything to compare.</h4>
<strong>@origin:@originId</strong> and <strong>@repository.owner:@forkedId</strong> are identical.
<strong>@originRepository.owner:@originId</strong> and <strong>@forkedRepository.owner:@forkedId</strong> are identical.
</td>
</tr>
</table>
@@ -133,17 +142,22 @@ $(function(){
$('#compare-edit').show();
});
$('a.origin-branch, a.forked-branch').click(function(){
$('#cancel-condition-editing').click(function(){
$('#compare-info').show();
$('#compare-edit').hide();
});
$('a.origin-owner, a.forked-owner, a.origin-branch, a.forked-branch').click(function(){
var e = $(this);
e.parents('ul').find('i').attr('class', 'icon-white');
e.find('i').attr('class', 'icon-ok');
e.parents('div.btn-group').find('button strong').text(e.data('branch'));
});
e.parents('div.btn-group').find('button strong').text(e.text());
$('#refresh-compare').click(function(){
location.href = '@url(repository)/pulls/compare/@origin:' +
$.trim($('i.icon-ok').parents('a.origin-branch').text()) + '...' +
$.trim($('i.icon-ok').parents('a.forked-branch').text());
location.href = '@url(repository)/pulls/compare/' +
$.trim($('i.icon-ok').parents('a.origin-owner' ).data('name')) + ':' +
$.trim($('i.icon-ok').parents('a.origin-branch').data('name')) + '...' +
$.trim($('i.icon-ok').parents('a.forked-owner' ).data('name')) + ':' +
$.trim($('i.icon-ok').parents('a.forked-branch').data('name'));
});
$('#show-form').click(function(){