diff --git a/src/main/scala/app/DashboardController.scala b/src/main/scala/app/DashboardController.scala index d0a40f0..030f875 100644 --- a/src/main/scala/app/DashboardController.scala +++ b/src/main/scala/app/DashboardController.scala @@ -54,7 +54,7 @@ val page = IssueSearchCondition.page(request) dashboard.html.issues( - issues.html.listparts( + dashboard.html.issueslist( searchIssue(condition, filterUser, false, (page - 1) * IssueLimit, IssueLimit, userRepos: _*), page, countIssue(condition.copy(state = "open" ), filterUser, false, userRepos: _*), @@ -89,7 +89,7 @@ IssueSearchCondition().copy(state = condition.state), Map.empty, true, userRepos: _*) dashboard.html.pulls( - pulls.html.listparts( + dashboard.html.pullslist( searchIssue(condition, filterUser, true, (page - 1) * PullRequestLimit, PullRequestLimit, allRepos: _*), page, countIssue(condition.copy(state = "open" ), filterUser, true, allRepos: _*), diff --git a/src/main/twirl/dashboard/issueslist.scala.html b/src/main/twirl/dashboard/issueslist.scala.html new file mode 100644 index 0000000..8a96492 --- /dev/null +++ b/src/main/twirl/dashboard/issueslist.scala.html @@ -0,0 +1,184 @@ +@(issues: List[(model.Issue, List[model.Label], Int)], + page: Int, + openCount: Int, + closedCount: Int, + condition: service.IssuesService.IssueSearchCondition, + collaborators: List[String] = Nil, + milestones: List[model.Milestone] = Nil, + labels: List[model.Label] = Nil, + repository: Option[service.RepositoryService.RepositoryInfo] = None, + hasWritePermission: Boolean = false)(implicit context: app.Context) +@import context._ +@import view.helpers._ + +
+ @if(condition.labels.nonEmpty || condition.milestoneId.isDefined){ + + Clear milestone and label filters + + } + @if(condition.repo.isDefined){ + + Clear filter on @condition.repo + + } +
+ @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.IssuesService.IssueLimit, 7, condition.toURL) +
+
+ @openCount Open + @closedCount Closed +
+ @helper.html.dropdown( + value = (condition.sort, condition.direction) match { + case ("created" , "desc") => "Newest" + case ("created" , "asc" ) => "Oldest" + case ("comments", "desc") => "Most commented" + case ("comments", "asc" ) => "Least commented" + case ("updated" , "desc") => "Recently updated" + case ("updated" , "asc" ) => "Least recently updated" + }, + prefix = "Sort", + mini = false + ){ +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated + +
  • + } + + @if(issues.isEmpty){ + + + + } else { + @if(hasWritePermission){ + + + + } + } + @issues.map { case (issue, labels, commentCount) => + + + + } +
    + No issues to show. + @if(condition.labels.nonEmpty || condition.milestoneId.isDefined){ + Clear active filters. + } else { + @if(repository.isDefined){ + Create a new issue. + } + } +
    +
    + +
    + @helper.html.dropdown("Label") { + @labels.map { label => +
  • + + +   + @label.labelName + +
  • + } + } + @helper.html.dropdown("Assignee") { +
  • Clear assignee
  • + @collaborators.map { collaborator => +
  • @avatar(collaborator, 20) @collaborator
  • + } + } + @helper.html.dropdown("Milestone") { +
  • Clear this milestone
  • + @milestones.map { milestone => +
  • + + @milestone.title +
    + @milestone.dueDate.map { dueDate => + @if(isPast(dueDate)){ + Due in @date(dueDate) + } else { + Due in @date(dueDate) + } + }.getOrElse { + No due date + } +
    +
    +
  • + } + } +
    + @if(hasWritePermission){ + + } +
    +
    + @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.IssuesService.IssueLimit, 10, condition.toURL) +
    +
    + diff --git a/src/main/twirl/dashboard/pullslist.scala.html b/src/main/twirl/dashboard/pullslist.scala.html new file mode 100644 index 0000000..c0d0cdc --- /dev/null +++ b/src/main/twirl/dashboard/pullslist.scala.html @@ -0,0 +1,100 @@ +@(issues: List[(model.Issue, List[model.Label], Int)], + page: Int, + openCount: Int, + closedCount: Int, + condition: service.IssuesService.IssueSearchCondition, + repository: Option[service.RepositoryService.RepositoryInfo], + hasWritePermission: Boolean)(implicit context: app.Context) +@import context._ +@import view.helpers._ +
    + @repository.map { repository => + @if(hasWritePermission){ +
    + @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 7, condition.toURL) + New pull request +
    + } + } +
    + @openCount Open + @closedCount Closed +
    + @helper.html.dropdown( + value = (condition.sort, condition.direction) match { + case ("created" , "desc") => "Newest" + case ("created" , "asc" ) => "Oldest" + case ("comments", "desc") => "Most commented" + case ("comments", "asc" ) => "Least commented" + case ("updated" , "desc") => "Recently updated" + case ("updated" , "asc" ) => "Least recently updated" + }, + prefix = "Sort", + mini = false + ){ +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated + +
  • + } + + @if(issues.isEmpty){ + + + + } + @issues.map { case (issue, labels, commentCount) => + + + + } +
    + No pull requests to show. +
    + + @issue.title + #@issue.issueId +
    + @issue.content.map { content => + @cut(content, 90) + }.getOrElse { + No description available + } +
    +
    + @avatarLink(issue.openedUserName, 20) by @user(issue.openedUserName, styleClass="username") @datetime(issue.registeredDate)  + @if(commentCount > 0){ + @commentCount @plural(commentCount, "comment") + } +
    +
    +
    + @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 10, condition.toURL) +
    +
    \ No newline at end of file