File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
2017-01-05
2017-01-05
2018-01-16
2018-01-17
@**
* Yona, 21st Century Project Hosting SW
*
* Copyright Yona & Yobi Authors & NAVER Corp.
* https://yona.io
**@
@(project:Project, issue:Issue)
@import org.apache.commons.lang3.StringUtils
@import utils.TemplateHelper._
@import utils.AccessControl._
@import utils.JodaDateUtil
@import play.libs.Json.toJson
@import utils.Markdown
@import controllers.api.IssueApi
@avatarByLoginId(loginId: String, loginName: String) = {
<a href="@userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginName">
<img src="@getUserAvatarUrl(User.findByLoginId(loginId), 32)" 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="@userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginId">
<strong>@loginName</strong>
</a>
}
case _ => { Anonymous }
}
}
@assginedMesssage(newValue: String, user:User) = @{
val LoginId = user.loginId
newValue match {
case LoginId => "issue.event.assignedToMe"
case _: String => "issue.event.assigned"
case _ => "issue.event.unassigned"
}
}
@isAuthorComment(commentId: String) = @{
if(commentId == UserApp.currentUser().loginId) {"author"}
}
@linkToPullRequest(pull: PullRequest) ={
<strong>@Messages("pullRequest")-@pull.number <a href="@routes.PullRequestApp.pullRequest(pull.toProject.owner, pull.toProject.name, pull.number)" class="link">@pull.title</a></strong>
}
@linkToProject(owner: String, name: String) ={
<strong><a href="@routes.ProjectApp.project(owner, name)" class="link">@owner/@name</a></strong>
}
@linkToCommit(commitId: String) ={
<strong>@Messages("code.commits") <a href="@routes.CodeHistoryApp.show(project.owner, project.name, commitId)" class="link">@{"@"}@commitId</a></strong>
}
@VOTER_AVATAR_SHOW_LIMIT = @{ 5 }
<div class="comment-header"><i class="yobicon-comments"></i> <strong>@Messages("common.comment")</strong> <strong class="num">@issue.comments.size</strong></div>
<hr class="nm">
@if(issue.comments.size + issue.events.size > 0) {
<ul class="comments">
@for(item <- issue.getTimeline){
@item match {
case (comment: Comment) => {
<li class="comment @isAuthorComment(comment.authorLoginId)" id="comment-@comment.id">
<div class="comment-avatar">
<a href="@userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorLoginId">
<img src="@User.findByLoginId(comment.authorLoginId).avatarUrl(64)" width="32" height="32" alt="@comment.authorName">
</a>
</div>
<div class="media-body">
<div class="meta-info">
<span class="comment_author">
<span class="resp-comment-avatar">
<a href="@userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName">
<img src="@User.findByLoginId(comment.authorLoginId).avatarUrl(64)" width="32" height="32" alt="@comment.authorLoginId">
</a>
</span>
<a href="@userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorLoginId"><strong>@User.findByLoginId(comment.authorLoginId).getDisplayName</strong></a>
</span>
<span class="ago-date">
<a href="#comment-@comment.id" class="ago" title="@JodaDateUtil.getDateString(comment.createdDate)">@utils.TemplateHelper.agoOrDateString(comment.createdDate)</a>
</span>
<span class="act-row pull-right">
@if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.READ) && comment.isInstanceOf[IssueComment]) {
@defining(comment.asInstanceOf[IssueComment]) { issueComment =>
@if(issueComment.voters.size > VOTER_AVATAR_SHOW_LIMIT) {
<span style="margin-right:2px;" data-toggle="tooltip" data-html="true" title="
@for(voter <- VoteApp.getVotersForName(issueComment.voters, 0, 5)) {
@voter.name<br>
}
…">
<a class="vote-description-people" href="#voters-@issueComment.id" data-toggle="modal">
@if(issueComment.voters.size == 1) {
@Messages("common.comment.vote.agreement", issueComment.voters.size)
} else {
@Messages("common.comment.vote.agreements", issueComment.voters.size)
}
</a>
</span>
@partial_voter_list("voters-" + issueComment.id, issueComment.voters)
} else {
@for(voter <- issueComment.voters){
<a href="@userInfo(voter.loginId)" class="avatar-wrap smaller" data-toggle="tooltip" data-placement="top" title="@voter.name">
<img src="@User.findByLoginId(voter.loginId).avatarUrl">
</a>
}
}
@if(issueComment.voters.contains(UserApp.currentUser())) {
<button type="button" class="btn-transparent-with-fontsize-lineheight" title="@Messages("common.comment.unvote")" data-request-type="comment-vote" data-request-uri="@routes.VoteApp.unvoteComment(project.owner, project.name, issue.getNumber, comment.id)">
<i class="yobicon-hearts vote-heart-on"></i>
</button>
} else {
@if(UserApp.currentUser().isAnonymous()) {
<i class="yobicon-hearts vote-heart-off vote-heart-disable-hover"></i>
} else {
<button type="button" class="btn-transparent-with-fontsize-lineheight" title="@Messages("common.comment.vote")" data-request-type="comment-vote" data-request-uri="@routes.VoteApp.voteComment(project.owner, project.name, issue.getNumber, comment.id)">
<i class="yobicon-hearts vote-heart-off"></i>
</button>
}
}
}
}
@if(StringUtils.isNotBlank(IssueApi.TRANSLATION_API)){
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 comment-translate" data-toggle="tooltip" data-comment-id="@comment.id" title="@Messages("button.translation")"><i class="yobicon-lang"></i></button>
}
@if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.READ)) {
<button type="button" class="btn-transparent-with-fontsize-lineheight ml10" data-toggle="comment-edit" data-comment-id="@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button>
}
@if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.DELETE)) {
<button type="button" class="btn-transparent-with-fontsize-lineheight ml6" data-toggle="comment-delete" data-request-uri="@routes.IssueApp.deleteComment(project.owner, project.name, issue.getNumber, comment.id)" title="@Messages("common.comment.delete")"><i class="yobicon-trash"></i></button>
}
</span>
</div>
@common.commentUpdateForm(comment, routes.IssueApp.newComment(project.owner, project.name, issue.getNumber).toString(), comment.contents)
<div id="comment-body-@comment.id">
<div class="comment-body markdown-wrap" data-via-email="@OriginalEmail.exists(comment.asResource)">@Html(Markdown.render(comment.contents, project))</div>
<div class="attachments pull-right" data-attachments="@toJson(AttachmentApp.getFileList(ResourceType.ISSUE_COMMENT.toString(), comment.id.toString()))"></div>
</div>
</div>
</li>
}
case (event: IssueEvent) => {
@if(event.eventType != EventType.ISSUE_BODY_CHANGED) {
<li class="event" id="event-@event.id">
@defining(User.findByLoginId(event.senderLoginId)) { user =>
@event.eventType match {
case EventType.ISSUE_STATE_CHANGED => {
<span class="state @event.newValue">@Messages("issue.state." + event.newValue)</span> @Html(Messages("issue.event." + event.newValue, linkToUser(user.loginId, user.getDisplayName)))
}
case EventType.ISSUE_ASSIGNEE_CHANGED => {
<span class="state changed">@Messages("issue.state.assigned")</span>
@Html(Messages(assginedMesssage(event.newValue, user), linkToUser(user.loginId, user.getDisplayName), linkToUser(event.newValue,User.findByLoginId(event.newValue).getDisplayName, true)))
}
case EventType.ISSUE_REFERRED_FROM_COMMIT => {
<span class="state changed">@Messages("issue.event.referred.title")</span>
@Html(Messages("issue.event.referred",linkToUser(user.loginId, user.getDisplayName),linkToCommit(event.newValue)))
}
case EventType.ISSUE_MOVED => {
<span class="state changed">@Messages("issue.event.moved.title")</span>
@Html(Messages("issue.event.moved", linkToUser(user.loginId, user.getDisplayName), linkToProject(event.oldValue.split("/")(0), event.oldValue.split("/")(1))))
}
case EventType.ISSUE_REFERRED_FROM_PULL_REQUEST => {
<span class="state changed">@Messages("issue.event.referred.title")</span>
@defining(PullRequest.findById(Long.valueOf(event.newValue))) { pull =>
@Html(Messages("issue.event.referred",linkToUser(user.loginId, user.getDisplayName),linkToPullRequest(pull)))
}
}
case _ => {
@event.newValue by @linkToUser(user.loginId, user.getDisplayName)
}
}
}
<span class="date"><a href="#event-@event.id">@utils.TemplateHelper.agoOrDateString(event.getDate())</a></span>
</li>
}
}
}
}
</ul>
}