diff --git a/src/main/scala/app/PullRequestsController.scala b/src/main/scala/app/PullRequestsController.scala index 4598669..d361d44 100644 --- a/src/main/scala/app/PullRequestsController.scala +++ b/src/main/scala/app/PullRequestsController.scala @@ -77,7 +77,7 @@ issue, pullreq, getComments(owner, name, issueId.toInt), (getCollaborators(owner, name) :+ owner).sorted, - getMilestones(owner, name), + getMilestonesWithIssueCount(owner, name), commits, diffs, requestCommitId.getName, diff --git a/src/main/twirl/issues/commentform.scala.html b/src/main/twirl/issues/commentform.scala.html new file mode 100644 index 0000000..3c2f7ff --- /dev/null +++ b/src/main/twirl/issues/commentform.scala.html @@ -0,0 +1,29 @@ +@(issue: model.Issue, + hasWritePermission: Boolean, + repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) +@import context._ +@import view.helpers._ +@if(loginAccount.isDefined){ +
+
@avatar(loginAccount.get.userName, 48)
+
+
+ @helper.html.preview(repository, "", false, true, "width: 680px; height: 100px;") +
+
+
+ + + @if((!issue.isPullRequest || !issue.closed) && (hasWritePermission || issue.openedUserName == loginAccount.get.userName)){ + + } +
+
+} + \ No newline at end of file diff --git a/src/main/twirl/issues/commentlist.scala.html b/src/main/twirl/issues/commentlist.scala.html new file mode 100644 index 0000000..7957ee7 --- /dev/null +++ b/src/main/twirl/issues/commentlist.scala.html @@ -0,0 +1,61 @@ +@(comments: List[model.IssueComment], + hasWritePermission: Boolean, + repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) +@import context._ +@import view.helpers._ +@comments.map { comment => + @if(comment.action != "close" && comment.action != "reopen" && comment.action != "merge"){ +
@avatar(comment.commentedUserName, 48)
+
+
+ + @comment.commentedUserName commented + + @datetime(comment.registeredDate) + @if(comment.action != "commit" && (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){ + + } + +
+
+ @markdown(comment.content, repository, false, true) +
+
+ } + @if(comment.action == "merge"){ +
+ Merged + @avatar(comment.commentedUserName, 20) + @comment.commentedUserName merged the pull request @datetime(comment.registeredDate) +
+ } + @if(comment.action == "close" || comment.action == "close_comment"){ +
+ Closed + @avatar(comment.commentedUserName, 20) + @comment.commentedUserName closed the issue @datetime(comment.registeredDate) +
+ } + @if(comment.action == "reopen" || comment.action == "reopen_comment"){ +
+ Reopened + @avatar(comment.commentedUserName, 20) + @comment.commentedUserName reopened the issue @datetime(comment.registeredDate) +
+ } +} + \ No newline at end of file diff --git a/src/main/twirl/issues/issue.scala.html b/src/main/twirl/issues/issue.scala.html index b4038a8..5742215 100644 --- a/src/main/twirl/issues/issue.scala.html +++ b/src/main/twirl/issues/issue.scala.html @@ -17,134 +17,9 @@
-
@avatar(issue.openedUserName, 48)
-
-
-
- @if(hasWritePermission || loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){ - Edit - } -
- @issue.openedUserName opened this issue @datetime(issue.registeredDate) -
-

@issue.title

-
-
- - @issue.assignedUserName.map { userName => - @avatar(userName, 20) @userName is assigned - }.getOrElse("No one is assigned") - - @if(hasWritePermission){ - @helper.html.dropdown() { -
  • Clear assignee
  • - @collaborators.map { collaborator => -
  • @avatar(collaborator, 20) @collaborator
  • - } - } - } -
    - - @issue.milestoneId.map { milestoneId => - @milestones.collect { case (milestone, _, _) if(milestone.milestoneId == milestoneId) => - Milestone: @milestone.title - } - }.getOrElse("No milestone") - -
    - @issue.milestoneId.map { milestoneId => - @milestones.collect { case (milestone, openCount, closeCount) if(milestone.milestoneId == milestoneId) => - @issues.milestones.html.progress(openCount + closeCount, closeCount, false) - } - } -
    - @if(hasWritePermission){ - @helper.html.dropdown() { -
  • No milestone
  • - @milestones.map { case (milestone, _, _) => -
  • - - @milestone.title -
    - @milestone.dueDate.map { dueDate => - @if(isPast(dueDate)){ - Due in @date(dueDate) - } else { - Due in @date(dueDate) - } - }.getOrElse { - No due date - } -
    -
    -
  • - } - } - } -
    -
    -
    - @markdown(issue.content getOrElse "No description given.", repository, false, true) -
    -
    -
    -
    - @defining((issue.openedUserName :: comments.map(_.commentedUserName)).distinct){ participants => - @participants.size @plural(participants.size, "participant") - @participants.map { participant => @avatar(participant, 20, tooltip = true) } - } -
    - @comments.map { comment => - @if(comment.action != "close" && comment.action != "reopen"){ -
    @avatar(comment.commentedUserName, 48)
    -
    -
    - - @comment.commentedUserName commented - - @datetime(comment.registeredDate) - @if(comment.action != "commit" && (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){ - - } - -
    -
    - @markdown(comment.content, repository, false, true) -
    -
    - } - @if(comment.action == "close" || comment.action == "close_comment"){ -
    - Closed - @avatar(comment.commentedUserName, 20) - @comment.commentedUserName closed the issue @datetime(comment.registeredDate) -
    - } - @if(comment.action == "reopen" || comment.action == "reopen_comment"){ -
    - Reopened - @avatar(comment.commentedUserName, 20) - @comment.commentedUserName reopened the issue @datetime(comment.registeredDate) -
    - } - } - @if(loginAccount.isDefined){ -
    -
    @avatar(loginAccount.get.userName, 48)
    -
    -
    - @helper.html.preview(repository, "", false, true, "width: 680px; height: 100px;") -
    -
    -
    - - - @if(hasWritePermission || issue.openedUserName == loginAccount.get.userName){ - - } -
    -
    - } + @issuedetail(issue, comments, collaborators, milestones, hasWritePermission, repository) + @commentlist(comments, hasWritePermission, repository) + @commentform(issue, hasWritePermission, repository)
    @if(issue.closed) { @@ -184,82 +59,6 @@ } \ No newline at end of file diff --git a/src/main/twirl/pulls/discussion.scala.html b/src/main/twirl/pulls/discussion.scala.html index 9932b1a..76bb332 100644 --- a/src/main/twirl/pulls/discussion.scala.html +++ b/src/main/twirl/pulls/discussion.scala.html @@ -2,7 +2,7 @@ pullreq: model.PullRequest, comments: List[model.IssueComment], collaborators: List[String], - milestones: List[model.Milestone], + milestones: List[(model.Milestone, Int, Int)], hasConflict: Boolean, hasWritePermission: Boolean, repository: service.RepositoryService.RepositoryInfo, @@ -11,96 +11,9 @@ @import view.helpers._
    -
    @avatar(issue.openedUserName, 48)
    -
    -
    -
    - @if(hasWritePermission || loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){ - Edit - } -
    - @issue.openedUserName opened this issue @datetime(issue.registeredDate) -
    -

    @issue.title

    -
    -
    - - @issue.assignedUserName.map { userName => - @avatar(userName, 20) @userName is assigned - }.getOrElse("No one is assigned") - - @if(hasWritePermission){ - @helper.html.dropdown() { -
  • Clear assignee
  • - @collaborators.map { collaborator => -
  • @avatar(collaborator, 20) @collaborator
  • - } - } - } -
    - - @issue.milestoneId.map { milestoneId => - @milestones.find(_.milestoneId == milestoneId).map { milestone => - Milestone: @milestone.title - } - }.getOrElse("No milestone") - - @if(hasWritePermission){ - @helper.html.dropdown() { -
  • No milestone
  • - @milestones.map { milestone => -
  • @milestone.title
  • - } - } - } -
    -
    -
    - @markdown(issue.content getOrElse "No description given.", repository, false, true) -
    -
    -
    - @comments.map { comment => - @if(comment.action != "close" && comment.action != "reopen" && comment.action != "merge"){ -
    @avatar(comment.commentedUserName, 48)
    -
    -
    - - @comment.commentedUserName commented - - @datetime(comment.registeredDate) - @if(hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false)){ - - } - -
    -
    - @markdown(comment.content, repository, false, true) -
    -
    - } - @if(comment.action == "merge"){ -
    - Merged - @avatar(comment.commentedUserName, 20) - @comment.commentedUserName merged the pull request @datetime(comment.registeredDate) -
    - } - @if(comment.action == "close" || comment.action == "close_comment"){ -
    - Closed - @avatar(comment.commentedUserName, 20) - @comment.commentedUserName closed the pull request @datetime(comment.registeredDate) -
    - } - @if(comment.action == "reopen" || comment.action == "reopen_comment"){ -
    - Reopened - @avatar(comment.commentedUserName, 20) - @comment.commentedUserName reopened the issue @datetime(comment.registeredDate) -
    - } - } + @issues.html.issuedetail(issue, comments, collaborators, milestones, hasWritePermission, repository) + @issues.html.commentlist(comments, hasWritePermission, repository) + @if(hasWritePermission && !issue.closed){
    @@ -173,23 +86,7 @@
    } - @if(loginAccount.isDefined){ -
    -
    @avatar(loginAccount.get.userName, 48)
    -
    -
    - @helper.html.preview(repository, "", false, true, "width: 680px; height: 100px;") -
    -
    -
    - - - @if(!issue.closed && (hasWritePermission || issue.openedUserName == loginAccount.get.userName)){ - - } -
    -
    - } + @issues.html.commentform(issue, hasWritePermission, repository)
    @if(issue.closed) { @@ -209,77 +106,6 @@