Newer
Older
gitbucket_jkp / src / main / twirl / pulls / listparts.scala.html
  1. @(issues: List[(model.Issue, List[model.Label], Int)],
  2. page: Int,
  3. openCount: Int,
  4. closedCount: Int,
  5. condition: service.IssuesService.IssueSearchCondition,
  6. repository: Option[service.RepositoryService.RepositoryInfo],
  7. hasWritePermission: Boolean)(implicit context: app.Context)
  8. @import context._
  9. @import view.helpers._
  10. <div class="span9">
  11. @repository.map { repository =>
  12. @if(hasWritePermission){
  13. <div class="pull-right">
  14. @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 7, condition.toURL)
  15. <a href="@url(repository)/compare" class="btn btn-success">New pull request</a>
  16. </div>
  17. }
  18. }
  19. <div class="btn-group">
  20. <a class="btn@if(condition.state == "open"){ active}" href="@condition.copy(state = "open").toURL">@openCount Open</a>
  21. <a class="btn@if(condition.state == "closed"){ active}" href="@condition.copy(state = "closed").toURL">@closedCount Closed</a>
  22. </div>
  23. @helper.html.dropdown(
  24. value = (condition.sort, condition.direction) match {
  25. case ("created" , "desc") => "Newest"
  26. case ("created" , "asc" ) => "Oldest"
  27. case ("comments", "desc") => "Most commented"
  28. case ("comments", "asc" ) => "Least commented"
  29. case ("updated" , "desc") => "Recently updated"
  30. case ("updated" , "asc" ) => "Least recently updated"
  31. },
  32. prefix = "Sort",
  33. mini = false
  34. ){
  35. <li>
  36. <a href="@condition.copy(sort="created", direction="desc").toURL">
  37. @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
  38. </a>
  39. </li>
  40. <li>
  41. <a href="@condition.copy(sort="created", direction="asc" ).toURL">
  42. @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
  43. </a>
  44. </li>
  45. <li>
  46. <a href="@condition.copy(sort="comments", direction="desc").toURL">
  47. @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
  48. </a>
  49. </li>
  50. <li>
  51. <a href="@condition.copy(sort="comments", direction="asc" ).toURL">
  52. @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
  53. </a>
  54. </li>
  55. <li>
  56. <a href="@condition.copy(sort="updated", direction="desc").toURL">
  57. @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
  58. </a>
  59. </li>
  60. <li>
  61. <a href="@condition.copy(sort="updated", direction="asc" ).toURL">
  62. @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
  63. </a>
  64. </li>
  65. }
  66. <table class="table table-bordered table-hover table-issues">
  67. @if(issues.isEmpty){
  68. <tr>
  69. <td style="padding: 20px; background-color: #eee; text-align: center;">
  70. No pull requests to show.
  71. </td>
  72. </tr>
  73. }
  74. @issues.map { case (issue, labels, commentCount) =>
  75. <tr>
  76. <td>
  77. <img src="@assets/common/images/pullreq-@(if(issue.closed) "closed" else "open").png"/>
  78. <a href="@path/@issue.userName/@issue.repositoryName/pull/@issue.issueId" class="issue-title">@issue.title</a>
  79. <span class="pull-right muted">#@issue.issueId</span>
  80. <div style="margin-left: 20px;">
  81. @issue.content.map { content =>
  82. @cut(content, 90)
  83. }.getOrElse {
  84. <span class="muted">No description available</span>
  85. }
  86. </div>
  87. <div class="small muted" style="margin-left: 20px;">
  88. @avatar(issue.openedUserName, 20) by <a href="@url(issue.openedUserName)" class="username">@issue.openedUserName</a> @datetime(issue.registeredDate)&nbsp;
  89. @if(commentCount > 0){
  90. <i class="icon-comment"></i><a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">@commentCount @plural(commentCount, "comment")</a>
  91. }
  92. </div>
  93. </td>
  94. </tr>
  95. }
  96. </table>
  97. <div class="pull-right">
  98. @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 10, condition.toURL)
  99. </div>
  100. </div>