diff --git a/src/main/twirl/gitbucket/core/issues/commentform.scala.html b/src/main/twirl/gitbucket/core/issues/commentform.scala.html index ecbb863..02b9076 100644 --- a/src/main/twirl/gitbucket/core/issues/commentform.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentform.scala.html @@ -2,12 +2,11 @@ reopenable: Boolean, hasWritePermission: Boolean, repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context) -@import context.loginAccount -@import gitbucket.core.view.helpers.{avatarLink, url} -@if(loginAccount.isDefined){ +@import gitbucket.core.view.helpers +@if(context.loginAccount.isDefined){

-
@avatarLink(loginAccount.get.userName, 48)
+
@helpers.avatarLink(context.loginAccount.get.userName, 48)
@gitbucket.core.helper.html.preview( @@ -25,10 +24,10 @@ )
- @if((reopenable || !issue.closed) && (hasWritePermission || issue.openedUserName == loginAccount.get.userName)){ - + @if((reopenable || !issue.closed) && (hasWritePermission || issue.openedUserName == context.loginAccount.get.userName)){ + } - +
diff --git a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html index 8b79147..4d50975 100644 --- a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html @@ -3,22 +3,22 @@ hasWritePermission: Boolean, repository: gitbucket.core.service.RepositoryService.RepositoryInfo, pullreq: Option[gitbucket.core.model.PullRequest] = None)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ +@import gitbucket.core.view.helpers +@import gitbucket.core.helper.html.datetimeago @import gitbucket.core.model.CommitComment @if(issue.isDefined){ -
@avatarLink(issue.get.openedUserName, 48)
+
@helpers.avatarLink(issue.get.openedUserName, 48)
- @user(issue.get.openedUserName, styleClass="username strong") commented @helper.html.datetimeago(issue.get.registeredDate) + @helpers.user(issue.get.openedUserName, styleClass="username strong") commented @datetimeago(issue.get.registeredDate) - @if(hasWritePermission || loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){ + @if(hasWritePermission || context.loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){ }
- @markdown( + @helpers.markdown( markdown = issue.get.content getOrElse "No description provided.", repository = repository, enableWikiLink = false, @@ -36,20 +36,20 @@ case comment: gitbucket.core.model.IssueComment => { @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch" && comment.action != "commit" && comment.action != "refer"){ -
@avatarLink(comment.commentedUserName, 48)
+
@helpers.avatarLink(comment.commentedUserName, 48)
- @user(comment.commentedUserName, styleClass="username strong") + @helpers.user(comment.commentedUserName, styleClass="username strong") @if(comment.action == "comment"){ commented } else { referenced the @issueOrPullRequest() } - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate) @if(comment.action != "commit" && comment.action != "merge" && comment.action != "refer" - && (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){ + && (hasWritePermission || context.loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){   @@ -57,7 +57,7 @@ }
- @markdown( + @helpers.markdown( markdown = comment.content, repository = repository, enableWikiLink = false, @@ -80,20 +80,20 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") added a commit that referenced this @issueOrPullRequest() - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
@commitId.map{ id => - @id.substring(0, 7) + @id.substring(0, 7) } - @link(head, repository) + @helpers.link(head, repository) @rest.map{ content => ... - + }
@@ -103,14 +103,14 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") referenced the @issueOrPullRequest() - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
@defining(comment.content.split(":")){ case Array(issueId, rest @ _*) => - @issueLink(repository, issueId.toInt): @rest.mkString(":") + @helpers.issueLink(repository, issueId.toInt): @rest.mkString(":") }
@@ -119,8 +119,8 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") merged commit @pullreq.map(_.commitIdTo.substring(0, 7)) into @if(pullreq.get.requestUserName == repository.owner){ @@ -128,7 +128,7 @@ } else { @pullreq.map(_.userName):@pullreq.map(_.branch) from @pullreq.map(_.requestUserName):@pullreq.map(_.requestBranch) } - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
} @@ -136,10 +136,10 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") closed this @issueOrPullRequest() - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
} @@ -147,10 +147,10 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") reopened the @issueOrPullRequest() - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
} @@ -158,16 +158,16 @@
- @avatar(comment.commentedUserName, 16) - @user(comment.commentedUserName, styleClass="username strong") + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") deleted the @pullreq.map(_.requestBranch) branch - @helper.html.datetimeago(comment.registeredDate) + @datetimeago(comment.registeredDate)
} } case comment: CommitComment => { - @helper.html.commitcomment(comment, hasWritePermission, repository, pullreq.map(_.commitIdTo)) + @gitbucket.core.helper.html.commitcomment(comment, hasWritePermission, repository, pullreq.map(_.commitIdTo)) } } diff --git a/src/main/twirl/gitbucket/core/issues/listparts.scala.html b/src/main/twirl/gitbucket/core/issues/listparts.scala.html index 219026e..8d06cb1 100644 --- a/src/main/twirl/gitbucket/core/issues/listparts.scala.html +++ b/src/main/twirl/gitbucket/core/issues/listparts.scala.html @@ -9,8 +9,10 @@ labels: List[gitbucket.core.model.Label] = Nil, repository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo] = None, hasWritePermission: Boolean = false)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ +@import gitbucket.core.view.helpers +@import gitbucket.core.helper.html.dropdown +@import gitbucket.core.helper.html.checkicon +@import gitbucket.core.helper.html.datetimeago @import gitbucket.core.service.IssuesService.IssueInfo @* @if(condition.nonEmpty){ @@ -28,96 +30,96 @@ - @helper.html.dropdown("Author") { + @dropdown("Author") { @collaborators.map { collaborator =>
  • - @helper.html.checkicon(condition.author == Some(collaborator)) - @avatar(collaborator, 20) @collaborator + @checkicon(condition.author == Some(collaborator)) + @helpers.avatar(collaborator, 20) @collaborator
  • } } - @helper.html.dropdown("Label") { + @dropdown("Label") { @labels.map { label =>
  • - @helper.html.checkicon(condition.labels.contains(label.labelName)) + @checkicon(condition.labels.contains(label.labelName))    @label.labelName
  • } } - @helper.html.dropdown("Milestone") { + @dropdown("Milestone") {
  • - @helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone + @checkicon(condition.milestone == Some(None)) Issues with no milestone
  • @milestones.filter(_.closedDate.isEmpty).map { milestone =>
  • - @helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title + @checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title
  • } } - @helper.html.dropdown("Assignee") { + @dropdown("Assignee") {
  • - @helper.html.checkicon(condition.assigned == Some(None)) Assigned to nobody + @checkicon(condition.assigned == Some(None)) Assigned to nobody
  • @collaborators.map { collaborator =>
  • - @helper.html.checkicon(condition.assigned == Some(Some(collaborator))) - @avatar(collaborator, 20) @collaborator + @checkicon(condition.assigned == Some(Some(collaborator))) + @helpers.avatar(collaborator, 20) @collaborator
  • } } - @helper.html.dropdown("Sort"){ + @dropdown("Sort"){
  • - @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest + @checkicon(condition.sort == "created" && condition.direction == "desc") Newest
  • - @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest + @checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
  • - @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented + @checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
  • - @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented + @checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
  • - @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated + @checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
  • - @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated + @checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
  • }
    @if(hasWritePermission){ - @helper.html.dropdown("Mark as") { + @dropdown("Mark as") {
  • Open
  • Close
  • } - @helper.html.dropdown("Label") { + @dropdown("Label") { @labels.map { label =>
  • @@ -128,16 +130,16 @@
  • } } - @helper.html.dropdown("Milestone") { + @dropdown("Milestone") {
  • No milestone
  • @milestones.filter(_.closedDate.isEmpty).map { milestone =>
  • @milestone.title
  • } } - @helper.html.dropdown("Assignee") { + @dropdown("Assignee") {
  • Clear assignee
  • @collaborators.map { collaborator => -
  • @avatar(collaborator, 20) @collaborator
  • +
  • @helpers.avatar(collaborator, 20) @collaborator
  • } }
    @@ -161,9 +163,9 @@ *@ @if(repository.isDefined){ @if(target == "issues"){ - Create a new issue. + Create a new issue. } else { - Create a new pull request. + Create a new pull request. } } @* @@ -182,33 +184,33 @@ *@ @if(repository.isEmpty){ - @issue.repositoryName ・ + @issue.repositoryName ・ } @if(target == "issues"){ - @issue.title + @issue.title } else { - @issue.title + @issue.title } - @commitstatus(issue, commitStatus) + @gitbucket.core.issues.html.commitstatus(issue, commitStatus) @labels.map { label => @label.labelName } @issue.assignedUserName.map { userName => - @avatar(userName, 20, tooltip = true) + @helpers.avatar(userName, 20, tooltip = true) } @if(commentCount > 0){ - + @commentCount } else { - + @commentCount }
    - #@issue.issueId opened @helper.html.datetimeago(issue.registeredDate) by @user(issue.openedUserName, styleClass="username") + #@issue.issueId opened @datetimeago(issue.registeredDate) by @helpers.user(issue.openedUserName, styleClass="username") @milestone.map { milestone => @milestone } @@ -219,5 +221,5 @@
    - @helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), gitbucket.core.service.IssuesService.IssueLimit, 10, condition.toURL) + @gitbucket.core.helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), gitbucket.core.service.IssuesService.IssueLimit, 10, condition.toURL)
    diff --git a/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html index 1b82c28..b4a9e5f 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html @@ -1,15 +1,15 @@ @(milestone: Option[gitbucket.core.model.Milestone], repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ -@html.main(s"Milestones - ${repository.owner}/${repository.name}"){ - @html.menu("milestones", repository){ +@import gitbucket.core.view.helpers +@import gitbucket.core.helper.html.datepicker +@gitbucket.core.html.main(s"Milestones - ${repository.owner}/${repository.name}"){ + @gitbucket.core.html.menu("milestones", repository){ @if(milestone.isEmpty){

    New milestone

    Create a new milestone to help organize your issues and pull requests.
    }
    - +
    @@ -21,7 +21,7 @@
    - @helper.html.datepicker("dueDate", milestone.flatMap(_.dueDate)) + @datepicker("dueDate", milestone.flatMap(_.dueDate))

    @@ -31,10 +31,10 @@ } else { @if(milestone.get.closedDate.isDefined){ + onclick="location.href='@helpers.url(repository)/issues/milestones/@milestone.get.milestoneId/close';"/> } else { + onclick="location.href='@helpers.url(repository)/issues/milestones/@milestone.get.milestoneId/open';"/> } } diff --git a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html index c183cac..8c10d2f 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html @@ -2,13 +2,13 @@ milestones: List[(gitbucket.core.model.Milestone, Int, Int)], repository: gitbucket.core.service.RepositoryService.RepositoryInfo, hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ -@html.main(s"Milestones - ${repository.owner}/${repository.name}"){ - @html.menu("milestones", repository){ - @if(loginAccount.isDefined){ +@import gitbucket.core.view.helpers +@import gitbucket.core.helper.html.datetimeago +@gitbucket.core.html.main(s"Milestones - ${repository.owner}/${repository.name}"){ + @gitbucket.core.html.menu("milestones", repository){ + @if(context.loginAccount.isDefined){ } @@ -35,17 +35,17 @@ diff --git a/src/main/twirl/gitbucket/core/pulls/commits.scala.html b/src/main/twirl/gitbucket/core/pulls/commits.scala.html index 8a86392..83df3ec 100644 --- a/src/main/twirl/gitbucket/core/pulls/commits.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/commits.scala.html @@ -1,39 +1,38 @@ @(commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]], comments: Option[List[gitbucket.core.model.Comment]] = None, repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ -@import gitbucket.core.model._ +@import gitbucket.core.view.helpers +@import gitbucket.core.helper.html.datetimeago
    - @milestone.title + @milestone.title
    @if(milestone.closedDate.isDefined){ - Closed @helper.html.datetimeago(milestone.closedDate.get) + Closed @datetimeago(milestone.closedDate.get) } else { @milestone.dueDate.map { dueDate => - @if(isPast(dueDate)){ + @if(helpers.isPast(dueDate)){ - Due by @date(dueDate) + Due by @helpers.date(dueDate) } else { - Due by @date(dueDate) + Due by @helpers.date(dueDate) } }.getOrElse { No due date @@ -54,7 +54,7 @@
    - @progress(openCount + closedCount, closedCount) + @gitbucket.core.issues.milestones.html.progress(openCount + closedCount, closedCount)
    @if(closedCount == 0){ @@ -67,13 +67,13 @@
    @if(hasWritePermission){ - Edit    + Edit    @if(milestone.closedDate.isDefined){ - Open    + Open    } else { - Close    + Close    } - Delete + Delete }
    @@ -81,7 +81,7 @@
    @if(milestone.description.isDefined){
    - @markdown( + @helpers.markdown( markdown = milestone.description.get, repository = repository, enableWikiLink = false, @@ -98,7 +98,7 @@
    No milestones to show. @if(hasWritePermission){ - Create a new milestone. + Create a new milestone. }
    @commits.map { day => - + @day.zipWithIndex.map { case (commit, i) => @if(i != 0){ } @@ -136,16 +134,16 @@
    @commits.map { day =>
    - Commits on @date(day.head.commitTime) + Commits on @helpers.date(day.head.commitTime)
    @date(day.head.commitTime)@helpers.date(day.head.commitTime)
    -
    @avatarLink(commit, 40)
    +
    @helpers.avatarLink(commit, 40)
    - @link(commit.summary, repository) + @helpers.link(commit.summary, repository) @if(commit.description.isDefined){ ... }
    @if(commit.description.isDefined){ - + }
    @if(commit.isDifferentFromAuthor) { - @user(commit.authorName, commit.authorEmailAddress, "username") - authored @helper.html.datetimeago(commit.authorTime) + @helpers.user(commit.authorName, commit.authorEmailAddress, "username") + authored @datetimeago(commit.authorTime) } - @user(commit.committerName, commit.committerEmailAddress, "username") - committed @helper.html.datetimeago(commit.commitTime) + @helpers.user(commit.committerName, commit.committerEmailAddress, "username") + committed @datetimeago(commit.commitTime)
    diff --git a/src/main/twirl/gitbucket/core/pulls/compare.scala.html b/src/main/twirl/gitbucket/core/pulls/compare.scala.html index 17207cb..fc0f6dd 100644 --- a/src/main/twirl/gitbucket/core/pulls/compare.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/compare.scala.html @@ -14,10 +14,8 @@ collaborators: List[String], milestones: List[gitbucket.core.model.Milestone], labels: List[gitbucket.core.model.Label])(implicit context: gitbucket.core.controller.Context) -@import context.loginAccount -@import context.path +@import gitbucket.core.view.helpers @import gitbucket.core.helper.html._ -@import gitbucket.core.view.helpers._ @gitbucket.core.html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){ @gitbucket.core.html.menu("pulls", repository){
    @@ -29,7 +27,7 @@ } @dropdown(originId, "base") { @originRepository.branchList.map { branch => -
  • @checkicon(branch == originId) @branch
  • +
  • @checkicon(branch == originId) @branch
  • } } ... @@ -40,22 +38,22 @@ } @dropdown(forkedId, "compare") { @forkedRepository.branchList.map { branch => -
  • @checkicon(branch == forkedId) @branch
  • +
  • @checkicon(branch == forkedId) @branch
  • } }
    - @if(commits.nonEmpty && loginAccount.isDefined){ + @if(commits.nonEmpty && context.loginAccount.isDefined){
    Create pull request    Discuss and review the changes in this comparison with others.
    @defining(commits.flatten){ commits => - @commits.size @plural(commits.size, "commit") + @commits.size @helpers.plural(commits.size, "commit") } - @diffs.size @plural(diffs.size, "file") changed + @diffs.size @helpers.plural(diffs.size, "file") changed @defining(comments.collect { case c: gitbucket.core.model.CommitComment => c }){ comments => - @comments.size commit @plural(comments.size, "comment") + @comments.size commit @helpers.plural(comments.size, "comment") } @defining(commits.flatMap(_.map(_.authorEmailAddress)).distinct){ contributors => - @contributors.size @plural(contributors.size, "contributor") + @contributors.size @helpers.plural(contributors.size, "contributor") }
    @day.map { commit => + @helpers.avatar(commit, 20) + @helpers.user(commit.authorName, commit.authorEmailAddress, "username strong") + @* @if(comments.isDefined){ @@ -156,7 +154,7 @@ } *@ } @@ -178,11 +176,11 @@ e.parents('div.btn-group').find('button span.strong').text(e.text()); @if(members.isEmpty){ - location.href = '@url(repository)/compare/' + + location.href = '@helpers.url(repository)/compare/' + $.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' + $.trim($('i.octicon-check').parents('a.forked-branch').data('branch')); } else { - location.href = '@path/' + + location.href = '@context.path/' + $.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' + $.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' + $.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' + @@ -200,10 +198,10 @@ $('#show-form').click(); } - @if(loginAccount.isDefined){ + @if(context.loginAccount.isDefined){ function checkConflict(from, to){ $('.check-conflict').show(); - $.get('@url(forkedRepository)/compare/' + from + '...' + to + '/mergecheck', + $.get('@helpers.url(forkedRepository)/compare/' + from + '...' + to + '/mergecheck', function(data){ $('.check-conflict').html(data); }); } diff --git a/src/main/twirl/gitbucket/core/pulls/conversation.scala.html b/src/main/twirl/gitbucket/core/pulls/conversation.scala.html index cbb772b..b9704b2 100644 --- a/src/main/twirl/gitbucket/core/pulls/conversation.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/conversation.scala.html @@ -7,12 +7,10 @@ labels: List[gitbucket.core.model.Label], hasWritePermission: Boolean, repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ -@import gitbucket.core.model._ +@import gitbucket.core.view.helpers
    - @issues.html.commentlist(Some(issue), comments, hasWritePermission, repository, Some(pullreq)) + @gitbucket.core.issues.html.commentlist(Some(issue), comments, hasWritePermission, repository, Some(pullreq))
    @defining(comments.flatMap { case comment: gitbucket.core.model.IssueComment => Some(comment) @@ -22,7 +20,7 @@ @@ -31,7 +29,7 @@ pullreq.repositoryName == pullreq.requestRepositoryName && repository.branchList.contains(pullreq.requestBranch)){
    - Delete branch + Delete branch
    Pull request successfully merged and closed
    @@ -39,11 +37,11 @@
    } - @issues.html.commentform(issue, !merged, hasWritePermission, repository) + @gitbucket.core.issues.html.commentform(issue, !merged, hasWritePermission, repository) }
    - @issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository) + @gitbucket.core.issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
    - @avatar(commit, 20) - @user(commit.authorName, commit.authorEmailAddress, "username strong") - @commit.shortMessage - @commit.id.substring(0, 7) + @commit.id.substring(0, 7)