THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
6.5 KiB

@**
* Yobi, Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @Author JiHan Kim, insanehong
*
* 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.
**@
@(pull: PullRequest, event: PullRequestEvent)
@import utils.TemplateHelper._
@import utils.TemplateHelper.DiffRenderer._
@import utils.JodaDateUtil._
@import models.enumeration.State
@import org.apache.commons.lang3.StringUtils
@avatarByLoginId(loginId: String, loginName: String) = {
<a href="@routes.UserApp.userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginId">
<img src="@User.findByLoginId(loginId).avatarUrl" class="avatar-wrap small">
</a>
}
@linkToUser(loginId: String, loginName: String, showAvatar: Boolean = true) = {
@loginId match {
case (loginId: String) => {
@if(showAvatar){ @avatarByLoginId(loginId, loginName) }
<a href="@routes.UserApp.userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginId">
<strong>@loginName</strong>
</a>
}
case _ => { Anonymous }
}
}
@linkToCommit(project: models.Project, commitId: String) = {
<a class="link"
href="@routes.CodeHistoryApp.show(project.owner, project.name, commitId).url"
title="@Messages("code.showCommit")">@StringUtils.left(commitId, 7)</a>
}
@defining(User.findByLoginId(event.senderLoginId)) { user =>
@event.eventType match {
case EventType.PULL_REQUEST_REVIEW_STATE_CHANGED => {
@if(event.newValue == PullRequestReviewAction.DONE.name) {
<li class="event" id="comment-@event.id">
<span class="state changed">@Messages("pullRequest.review")</span>
@Html(Messages("notification.pullrequestHeader.reviewed",linkToUser(user.loginId, user.name)))
<span class="date">
<a href="#event-@event.id" title="@getDateString(event.getDate())">@agoOrDateString(event.getDate())</a>
</span>
</li>
} else {
<li class="event" id="comment-@event.id">
<span class="state changed">@Messages("pullRequest.unreview")</span>
@Html(Messages("notification.pullrequestHeader.unreviewed", linkToUser(user.loginId, user.name)))
<span class="date">
<a href="#event-@event.id" title="@getDateString(event.getDate())">@agoOrDateString(event.getDate())</a>
</span>
</li>
}
}
case EventType.PULL_REQUEST_STATE_CHANGED => {
<li class="event" id="comment-@event.id">
<span class="state @event.newValue">@Messages("pullRequest.event." + event.newValue)</span>
@State.getValue(event.newValue) match {
case State.MERGED => {
@Html(Messages("pullRequest.event.message." + event.newValue, linkToUser(user.loginId, user.name),
linkToCommit(event.pullRequest.toProject, event.pullRequest.mergedCommitIdTo)))
}
case _ => {
@Html(Messages("pullRequest.event.message." + event.newValue, linkToUser(user.loginId, user.name)))
}
}
<span class="date">
<a href="#event-@event.id" title="@getDateString(event.getDate())">@agoOrDateString(event.getDate())</a>
</span>
</li>
}
case EventType.PULL_REQUEST_MERGED => {
<li class="event" id="comment-@event.id">
<span class="state @event.newValue">@Messages("pullRequest.event." + event.newValue)</span>
@Html(Messages("pullRequest.event.message." + event.newValue, linkToUser(user.loginId, user.name)))
<span class="date">
<a href="#event-@event.id" title="@getDateString(event.getDate())">@agoOrDateString(event.getDate())</a>
</span>
</li>
}
case EventType.PULL_REQUEST_COMMIT_CHANGED => {
<li class="event" id="comment-@event.id">
<span class="state changed">@Messages("pullRequest.event.commit")</span>
@Html(Messages("pullRequest.event.message.commit", linkToUser(user.loginId, user.name)))
<span class="date">
<a href="#event-@event.id" title="@getDateString(event.getDate())">@agoOrDateString(event.getDate())</a>
</span>
@if(event.oldValue != null) {
<a href="@urlToCompare(pull.toProject, event.oldValue)" class="ybtn ybtn-mini">@Messages("pullRequest.additional.changes")</a>
}
<ul class="commit-list">
@for(commit <- event.getPullRequestCommits) {
<li class="comment-body commit-info @if(commit.state == PullRequestCommit.State.PRIOR){ outdated }">
@defining(User.findByEmail(commit.authorEmail)) { author =>
<a href="@routes.PullRequestApp.specificChange(pull.toProject.owner, pull.toProject.name, pull.number, commit.commitId)" class="commit-id">
@commit.commitShortId
</a>
@if(!author.isAnonymous()) {
<a href="@routes.UserApp.userInfo(author.loginId)" class="avatar-wrap small" data-toggle="tooltip" data-placement="top" title="@User.findByLoginId(author.loginId).name">
<img src="@author.avatarUrl" alt="@author.name"> @commit.authorEmail
</a>
} else {
<img src="@urlToPicture(commit.getAuthorEmail, 32)" class="avatar-wrap small">
}
<div class="date" title="@getDateString(commit.authorDate)">@utils.TemplateHelper.agoOrDateString(commit.authorDate)</div>
@common.commitMsg(commit.commitMessage.split("\n")(0), commit.commitMessage,
routes.PullRequestApp.specificChange(pull.toProject.owner, pull.toProject.name, pull.number, commit.commitId).toString)
}
</li>
}
</ul>
</li>
}
case _ => {
}
}
}