diff --git a/src/main/scala/app/PullRequestsController.scala b/src/main/scala/app/PullRequestsController.scala index 72ee553..b620140 100644 --- a/src/main/scala/app/PullRequestsController.scala +++ b/src/main/scala/app/PullRequestsController.scala @@ -453,7 +453,6 @@ private def searchPullRequests(userName: Option[String], repository: RepositoryService.RepositoryInfo) = defining(repository.owner, repository.name){ case (owner, repoName) => - //val filterUser = userName.map { x => Map("created_by" -> x) } getOrElse Map("all" -> "") val page = IssueSearchCondition.page(request) val sessionKey = Keys.Session.Pulls(owner, repoName) @@ -466,8 +465,10 @@ pulls.html.list( searchIssue(condition, true, (page - 1) * PullRequestLimit, PullRequestLimit, owner -> repoName), getPullRequestCountGroupByUser(condition.state == "closed", Some(owner), Some(repoName)), - userName, page, + (getCollaborators(owner, repoName) :+ owner).sorted, + getMilestones(owner, repoName), + getLabels(owner, repoName), countIssue(condition.copy(state = "open" ), true, owner -> repoName), countIssue(condition.copy(state = "closed"), true, owner -> repoName), countIssue(condition.copy(assigned = None, author = None), true, owner -> repoName), diff --git a/src/main/twirl/issues/list.scala.html b/src/main/twirl/issues/list.scala.html index 72848cf..2a9410f 100644 --- a/src/main/twirl/issues/list.scala.html +++ b/src/main/twirl/issues/list.scala.html @@ -133,7 +133,9 @@ *@ @***** show issue list *****@ - @listparts(issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission) +
+ @listparts(issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission) +
@if(hasWritePermission){
diff --git a/src/main/twirl/issues/listparts.scala.html b/src/main/twirl/issues/listparts.scala.html index 0730d41..1ace8be 100644 --- a/src/main/twirl/issues/listparts.scala.html +++ b/src/main/twirl/issues/listparts.scala.html @@ -11,265 +11,193 @@ @import context._ @import view.helpers._ @import service.IssuesService.IssueInfo -
- @* - @if(condition.labels.nonEmpty || condition.milestoneId.isDefined){ - - Clear milestone and label filters - - } - @if(condition.repo.isDefined){ - - Clear filter on @condition.repo - - } +@if(condition.nonEmpty){ + Clear current search query, filters, and sorts +} + + + + + @if(issues.isEmpty){ + + + + } else { + @* + @if(hasWritePermission){ + + + + } + *@ + } + @issues.map { case IssueInfo(issue, labels, milestone, commentCount) => + + + + } +
+ + @openCount Open + @closedCount Closed
- @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.IssuesService.IssueLimit, 7, condition.toURL) -
- - @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(condition.nonEmpty){ - Clear current search query, filters, and sorts - } - - - - - @if(issues.isEmpty){ - - - - } else { - @* - @if(hasWritePermission){ - - - + @helper.html.dropdown("Author", flat = true) { + @collaborators.map { collaborator => +
  • + + @helper.html.checkicon(condition.author == Some(collaborator)) + @avatar(collaborator, 20) @collaborator + +
  • } - *@ } - @issues.map { case IssueInfo(issue, labels, milestone, commentCount) => - - - + @helper.html.dropdown("Label", flat = true) { + @labels.map { label => +
  • + + @helper.html.checkicon(condition.labels.contains(label.labelName)) +    + @label.labelName + +
  • + } } -
    - - @openCount Open - @closedCount Closed -
    - @helper.html.dropdown("Author", flat = true) { - @collaborators.map { collaborator => -
  • - - @helper.html.checkicon(condition.author == Some(collaborator)) - @avatar(collaborator, 20) @collaborator - -
  • - } - } - @helper.html.dropdown("Label", flat = true) { - @labels.map { label => -
  • - - @helper.html.checkicon(condition.labels.contains(label.labelName)) -    - @label.labelName - -
  • - } - } - @helper.html.dropdown("Milestone", flat = true) { -
  • - - @helper.html.checkicon(condition.milestoneId == Some(None)) Issues with no milestone - -
  • - @milestones.filter(_.closedDate.isEmpty).map { milestone => -
  • - - @helper.html.checkicon(condition.milestoneId == Some(Some(milestone.milestoneId))) @milestone.title - -
  • - } - } - @helper.html.dropdown("Assignee", flat = true) { - @collaborators.map { collaborator => -
  • - - @helper.html.checkicon(condition.assigned == Some(collaborator)) - @avatar(collaborator, 20) @collaborator - -
  • - } - } - @helper.html.dropdown("Sort", flat = true){ -
  • - - @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 - -
  • - } -
    -
    - 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){ - - } -
    - - +
    + 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/pulls/list.scala.html b/src/main/twirl/pulls/list.scala.html index acc242e..e2afc2f 100644 --- a/src/main/twirl/pulls/list.scala.html +++ b/src/main/twirl/pulls/list.scala.html @@ -1,7 +1,9 @@ @(issues: List[service.IssuesService.IssueInfo], counts: List[service.PullRequestService.PullRequestCount], - filter: Option[String], page: Int, + collaborators: List[String], + milestones: List[model.Milestone], + labels: List[model.Label], openCount: Int, closedCount: Int, allCount: Int, @@ -13,7 +15,9 @@ @import service.IssuesService.IssueInfo @html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){ @html.menu("pulls", repository){ + @_root_.issues.html.tab("pulls", false, repository)
    + @*
    - @listparts(issues, page, openCount, closedCount, condition, Some(repository), hasWritePermission) + *@ +
    + @listparts(issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission) +
    } } diff --git a/src/main/twirl/pulls/listparts.scala.html b/src/main/twirl/pulls/listparts.scala.html index 46343b4..010ec25 100644 --- a/src/main/twirl/pulls/listparts.scala.html +++ b/src/main/twirl/pulls/listparts.scala.html @@ -3,68 +3,160 @@ 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], hasWritePermission: Boolean)(implicit context: app.Context) @import context._ @import view.helpers._ @import service.IssuesService.IssueInfo -
    - @repository.map { repository => - @if(hasWritePermission){ +@* +@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 +
    + } +} +*@ +@* + +@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 + +
  • +} +*@ + + +
    + + @openCount Open + @closedCount Closed
    - @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 7, condition.toURL) - New pull request + @helper.html.dropdown("Author", flat = true) { + @collaborators.map { collaborator => +
  • + + @helper.html.checkicon(condition.author == Some(collaborator)) + @avatar(collaborator, 20) @collaborator + +
  • + } + } + @helper.html.dropdown("Label", flat = true) { + @labels.map { label => +
  • + + @helper.html.checkicon(condition.labels.contains(label.labelName)) +    + @label.labelName + +
  • + } + } + @helper.html.dropdown("Milestone", flat = true) { +
  • + + @helper.html.checkicon(condition.milestoneId == Some(None)) Issues with no milestone + +
  • + @milestones.filter(_.closedDate.isEmpty).map { milestone => +
  • + + @helper.html.checkicon(condition.milestoneId == Some(Some(milestone.milestoneId))) @milestone.title + +
  • + } + } + @helper.html.dropdown("Assignee", flat = true) { + @collaborators.map { collaborator => +
  • + + @helper.html.checkicon(condition.assigned == Some(collaborator)) + @avatar(collaborator, 20) @collaborator + +
  • + } + } + @helper.html.dropdown("Sort", flat = true){ +
  • + + @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 + +
  • + }
    - } - } - - @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){ - } -
    @@ -74,28 +166,33 @@ } @issues.map { case IssueInfo(issue, labels, milestone, commentCount) =>
    - + + @if(hasWritePermission){ +
    -
    - @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 10, condition.toURL) -
    +
    +
    + @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), service.PullRequestService.PullRequestLimit, 10, condition.toURL)
    \ No newline at end of file