File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
@**
* Yobi, Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @author Keesun Baik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**@
@(project: Project, pull: PullRequest, commitId: String = null)
@import utils.JodaDateUtil
@import utils.TemplateHelper._
@import utils.TemplateHelper.DiffRenderer._
@import utils.AccessControl._
@import models.enumeration
@import scala.collection.JavaConversions._
@projectLayout(Messages("menu.pullRequest"), project, utils.MenuType.PULL_REQUEST) {
@projectMenu(project, utils.MenuType.PULL_REQUEST, "main-menu-only")
<div class="page-wrap-outer">
<div class="project-page-wrap">
<div class="code-browse-wrap">
@partial_info(project, pull, "changes")
<div class="board-body mb20">
<div class="author-info right-txt" style="margin-top:20px;">
<a href="@routes.UserApp.userInfo(pull.contributor.loginId)" class="usf-group pull-left">
<span class="avatar-wrap smaller">
<img src="@pull.contributor.avatarUrl" width="32" height="32">
</span>
<strong class="name">@pull.contributor.name</strong>
<span class="loginid"> <strong>@{"@"}</strong>@pull.contributor.loginId</span>
</a>
@partial_branch(pull)
</div>
</div>
<div class="codediff-wrap mt10 @if(pull.commentThreads.size == 0) {diffs-only}">
@if(pull.commentThreads.size > 0) {
<button type="button" class="ybtn ybtn-default btn-show-reviewcards">
<i class="yobicon-restore"></i>
</button>
}
<div id="changes" class="diffs-wrap">
<div id="commits" class="btn-group auto mb10">
<button class="btn dropdown-toggle auto" data-toggle="dropdown">
<span class="d-label">
@if(commitId == null) {
@Messages("pullRequest.changes.all")
} else {
@PullRequestCommit.getByCommitId(pull, commitId) match {
case (commit: PullRequestCommit) => {
@commit.state match {
case PullRequestCommit.State.PRIOR => {
<strong class="blue-txt mr10 commit-hash">@shortId(commitId)</strong>
<span>@commit.getCommitMessage.split("\n")(0) (@Messages("review.outdated"))</span>
}
case _ => {
<strong class="blue-txt mr10 commit-hash">@shortId(commitId)</strong>
<span>@commit.getCommitMessage.split("\n")(0)</span>
}
}
}
case null => {
@Messages("pullRequest.changes.all") (@Messages("review.outdated") - <strong class="blue-txt mr10">@shortId(commitId)</strong>)
}
}
}
</span>
<span class="d-caret"><span class="caret"></span></span>
</button>
<ul class="dropdown-menu">
<li data-value="All">
<a href="@routes.PullRequestApp.pullRequestChanges(project.owner, project.name, pull.number)">@Messages("pullRequest.changes.all")</a>
</li>
<li class="divider"></li>
@for(commit <- pull.pullRequestCommits if commit.state == PullRequestCommit.State.CURRENT){
<li data-value="@commit.commitId">
<a href="@routes.PullRequestApp.specificChange(project.owner, project.name, pull.number, commit.commitId)">
<strong class="blue-txt mr10 commit-hash">@commit.commitShortId</strong>
<span>@commit.getCommitMessage.split("\n")(0)</span>
</a>
</li>
}
</ul>
</div>
@if(commitId != null && PullRequestCommit.getByCommitId(pull, commitId) != null) {
@defining(playRepository.RepositoryService.getRepository(project).getCommit(commitId)) { commit =>
<p class="commitInfo">
@(commit.getAuthor, commit.getAuthorEmail, commit.getAuthorName) match {
case (user: User, _, _) if !user.isAnonymous => {
<a href="@routes.UserApp.userInfo(commit.getAuthor.loginId)" class="avatar-wrap smaller">
<img src="@commit.getAuthor.avatarUrl" alt="@commit.getAuthor.name" width="32" height="32"/>
</a>
<strong>@commit.getAuthor.name</strong>
}
case (_, email, name) if email != null => {
<span class="avatar-wrap smaller">
<img src="@urlToPicture(commit.getAuthorEmail, 32)" width="32" height="32">
</span>
@if(name != null) {
<strong>@name</strong>
}
}
case (_, _, name) if name != null => {
<strong>@name</strong>
}
case (_, _, _) => {
<strong>@User.anonymous.name</strong>
}
}
<span class="ago" title="@JodaDateUtil.getDateString(commit.getAuthorDate)">
@agoOrDateString(commit.getAuthorDate)
</span>
</p>
<pre class="commitMsg mt5">@commit.getMessage</pre>
}
}
<div class="diff-body diffs-wrap-scroll">
@partial_state(project, pull, false, false)
@if(pull.isDiffable){
@views.html.partial_diff(pull.getDiff(commitId), pull.getCodeCommentThreadsForChanges(commitId), pull.toProject, pull.toProject)
}
<div class="btnPop"><button type="button" class="ybtn ybtn-info ybtn-small"><i class="yobicon-post2"></i></button></div>
</div>
<div class="board-comment-wrap">
<div class="non-ranged-threads-wrap">
@renderNonRangedThreads(pull.commentThreads.toList, commitId, Html(""))
</div>
@common.commentForm(pull.asResource(), ResourceType.REVIEW_COMMENT, routes.PullRequestApp.newComment(project.owner, project.name, pull.id, commitId).toString())
</div>
@** BlockComment **@
@if(isProjectResourceCreatable(UserApp.currentUser, project, ResourceType.REVIEW_COMMENT)){
@common.reviewForm(project, ResourceType.REVIEW_COMMENT, routes.PullRequestApp.newComment(project.owner, project.name, pull.id, commitId).toString())
}
@** // BlockComment **@
</div>
@if(pull.commentThreads.size > 0) {
<div class="review-wrap">
<div class="review-container">
<button type="button" class="ybtn ybtn-default btn-hide-reviewcards">
<i class="yobicon-maximize"></i>
</button>
<ul class="nav nav-tabs" style="margin-bottom:10px;">
<li class="active"><a href="#reviewcards-open" data-toggle="tab">@Messages("issue.state.open") @pull.getCommentThreadsByState(CommentThread.ThreadState.OPEN).size</a></li>
<li><a href="#reviewcards-closed" data-toggle="tab">@Messages("issue.state.closed") @pull.getCommentThreadsByState(CommentThread.ThreadState.CLOSED).size</a></li>
</ul>
<div class="tab-content review-list">
<div id="reviewcards-open" class="tab-pane active">
@partial_reviewlist(pull.getCommentThreadsByState(CommentThread.ThreadState.OPEN))
</div>
<div id="reviewcards-closed" class="tab-pane">
@partial_reviewlist(pull.getCommentThreadsByState(CommentThread.ThreadState.CLOSED))
</div>
</div>
</div>
</div>
}
</div>
</div>
</div>
</div>
@common.markdown(project)
@common.commentDeleteModal("#changes")
<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.css")">
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.caret.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/common/yobi.CodeCommentBox.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/common/yobi.CodeCommentBlock.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/jquery/jquery-ui-1.10.4.custom.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/jquery/jquery.cookie.js")"></script>
<script type="text/javascript">
$(document).ready(function() {
// yobi.Mention
yobi.Mention({
target:'textarea[id^=editor-]',
@if(pull.getCurrentCommits.isEmpty) {
url : "@Html(routes.ProjectApp.mentionListAtPullRequest(pull.toProject.owner, pull.toProject.name, "", pull.id).toString())"
} else {
url : "@Html(routes.ProjectApp.mentionListAtPullRequest(pull.toProject.owner, pull.toProject.name, pull.getCurrentCommits.get(0).getCommitId, pull.id).toString())"
}
});
// code.Diff
$yobi.loadModule("code.Diff", {
"bCommentable" : @isProjectResourceCreatable(UserApp.currentUser, project, ResourceType.REVIEW_COMMENT)
});
// commit message
$("button.moreBtn").on("click", function(){
$(this).next("pre.commitMsg.desc").toggleClass("hidden");
});
$('.diff-partial-meta').click(function() {
$(this).parent().find('.diff-partial-code').toggle();
}).css({cursor: 'pointer'});
});
</script>
}