Improve comparing view

This commit is contained in:
Naoki Takezoe
2015-08-16 01:12:44 +09:00
parent 6580e5458a
commit c85b31a7d5
3 changed files with 89 additions and 30 deletions

View File

@@ -4,7 +4,37 @@
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.model._
<div class="box">
<div class="box" style="margin-bottom: 20px;">
@commits.map { day =>
<div style="margin-top: 8px; margin-bottom: 8px;" class="muted">
Commits on @date(day.head.commitTime)
</div>
<table style="width: 98%; margin-left: 4px; margin-right: 4px;" align="center">
@day.map { commit =>
<tr>
<td style="width: 20%;">
<i class="octicon octicon-git-commit"></i>
@avatar(commit, 20)
@user(commit.authorName, commit.authorEmailAddress, "username strong")
</td>
<td><span class="monospace">@commit.shortMessage</span></td>
@*
<span class="badge" style="display: inline">@if(comments.isDefined){
@comments.get.flatMap @{
case comment: CommitComment => Some(comment)
case other => None
}.count(t => t.commitId == commit.id && !t.pullRequest)
}</span>
*@
<td style="width: 10%; text-align: right;">
<a href="@url(repository)/commit/@commit.id" class="monospace">@commit.id.substring(0, 7)</a>
</td>
</tr>
}
</table>
}
@*
<table class="table table-file-list" style="border: 1px solid silver;">
@commits.map { day =>
<tr>
@@ -32,4 +62,5 @@
}
}
</table>
*@
</div>

View File

@@ -49,35 +49,35 @@
<a href="#" class="btn btn-success" id="show-form">Create pull request</a>
</div>
<div id="pull-request-form" class="box" style="display: none;">
<div class="box-content">
<form method="POST" action="@path/@originRepository.owner/@originRepository.name/pulls/new" validate="true">
<div style="width: 240px; position: absolute; margin-left: 610px;">
<div class="check-conflict" style="display: none;">
<img src="@assets/common/images/indicator.gif"/> Checking...
</div>
<div class="box-content">
<form method="POST" action="@path/@originRepository.owner/@originRepository.name/pulls/new" validate="true">
<div style="width: 240px; position: absolute; margin-left: 610px;">
<div class="check-conflict" style="display: none;">
<img src="@assets/common/images/indicator.gif"/> Checking...
</div>
<div style="width: 600px; border-right: 1px solid #d4d4d4;">
<span class="error" id="error-title"></span>
<input type="text" name="title" style="width: 580px" placeholder="Title"/>
@helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
enableRefsLink = true,
enableTaskList = true,
hasWritePermission = hasWritePermission,
style = "width: 580px; height: 200px;"
)
<input type="hidden" name="targetUserName" value="@originRepository.owner"/>
<input type="hidden" name="targetBranch" value="@originId"/>
<input type="hidden" name="requestUserName" value="@forkedRepository.owner"/>
<input type="hidden" name="requestRepositoryName" value="@forkedRepository.name"/>
<input type="hidden" name="requestBranch" value="@forkedId"/>
<input type="hidden" name="commitIdFrom" value="@sourceId"/>
<input type="hidden" name="commitIdTo" value="@commitId"/>
</div>
</form>
</div>
</div>
<div style="width: 600px; border-right: 1px solid #d4d4d4;">
<span class="error" id="error-title"></span>
<input type="text" name="title" style="width: 580px" placeholder="Title"/>
@helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
enableRefsLink = true,
enableTaskList = true,
hasWritePermission = hasWritePermission,
style = "width: 580px; height: 200px;"
)
<input type="hidden" name="targetUserName" value="@originRepository.owner"/>
<input type="hidden" name="targetBranch" value="@originId"/>
<input type="hidden" name="requestUserName" value="@forkedRepository.owner"/>
<input type="hidden" name="requestRepositoryName" value="@forkedRepository.name"/>
<input type="hidden" name="requestBranch" value="@forkedId"/>
<input type="hidden" name="commitIdFrom" value="@sourceId"/>
<input type="hidden" name="commitIdTo" value="@commitId"/>
</div>
</form>
</div>
</div>
}
@if(commits.isEmpty){
@@ -90,6 +90,34 @@
</tr>
</table>
} else {
<div style="margin-bottom: 10px;" class="box-content">
<table class="fill-width">
<tr>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-commit"></i>
@defining(commits.flatten){ commits =>
<strong>@commits.size</strong> @plural(commits.size, "commit")
}
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-diff"></i>
<strong>@diffs.size</strong> @plural(diffs.size, "file") changed
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-comment"></i>
@defining(comments.collect { case c: gitbucket.core.model.CommitComment => c }){ comments =>
<strong>@comments.size</strong> commit @plural(comments.size, "comment")
}
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-organization"></i>
@defining(commits.flatMap(_.map(_.authorEmailAddress)).distinct){ contributors =>
<strong>@contributors.size</strong> @plural(contributors.size, "contributor")
}
</td>
</tr>
</table>
</div>
@pulls.html.commits(commits, Some(comments), repository)
@helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true, None, hasWritePermission, false)
<p>Showing you all comments on commits in this comparison.</p>

View File

@@ -14,7 +14,7 @@
@html.menu("code", repository){
<table class="table table-bordered">
<tr>
<th>
<th class="box-header">
<div class="pull-right align-right">
<a href="@url(repository)/tree/@commit.id" class="btn btn-small">Browse code</a>
</div>