diff --git a/src/main/twirl/helper/diff.scala.html b/src/main/twirl/helper/diff.scala.html index 43928bc..9e517ab 100644 --- a/src/main/twirl/helper/diff.scala.html +++ b/src/main/twirl/helper/diff.scala.html @@ -1,10 +1,39 @@ @(diffs: Seq[util.JGitUtil.DiffInfo], repository: service.RepositoryService.RepositoryInfo, newCommitId: Option[String], - oldCommitId: Option[String])(implicit context: app.Context) + oldCommitId: Option[String], + showIndex: Boolean)(implicit context: app.Context) @import context._ @import view.helpers._ @import org.eclipse.jgit.diff.DiffEntry.ChangeType +@if(showIndex){ +
+
+ +
+ Showing @diffs.size changed @plural(diffs.size, "file") +
+ +} @diffs.zipWithIndex.map { case (diff, i) => @@ -103,6 +132,17 @@ } $(function(){ + @if(showIndex){ + $('#toggle-file-list').click(function(){ + $('#commit-file-list').toggle(); + if($(this).val() == 'Show file list'){ + $(this).val('Hide file list'); + } else { + $(this).val('Show file list'); + } + }); + } + @diffs.zipWithIndex.map { case (diff, i) => @if(diff.newContent != None || diff.oldContent != None){ if($('#oldText-@i').length > 0){ diff --git a/src/main/twirl/pulls/compare.scala.html b/src/main/twirl/pulls/compare.scala.html index 202294a..8b5493b 100644 --- a/src/main/twirl/pulls/compare.scala.html +++ b/src/main/twirl/pulls/compare.scala.html @@ -12,7 +12,6 @@ hasWritePermission: Boolean)(implicit context: app.Context) @import context._ @import view.helpers._ -@import org.eclipse.jgit.diff.DiffEntry.ChangeType @html.main("Pull Requests - " + repository.owner + "/" + repository.name){ @html.header("pulls", repository)
@@ -108,33 +107,7 @@ }
-
-
- -
- Showing @diffs.size changed @plural(diffs.size, "file") -
- - @helper.html.diff(diffs, repository, Some(commitId), Some(sourceId)) + @helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true) } } diff --git a/src/main/twirl/pulls/files.scala.html b/src/main/twirl/pulls/files.scala.html deleted file mode 100644 index d94312d..0000000 --- a/src/main/twirl/pulls/files.scala.html +++ /dev/null @@ -1,49 +0,0 @@ -@(issue: model.Issue, - pullreq: model.PullRequest, - diffs: Seq[util.JGitUtil.DiffInfo], - newCommitId: String, - oldCommitId: String, - hasWritePermission: Boolean, - repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) -@import context._ -@import view.helpers._ -@import org.eclipse.jgit.diff.DiffEntry.ChangeType -
-
- -
- Showing @diffs.size changed @plural(diffs.size, "file") -
- -@helper.html.diff(diffs, repository, Some(newCommitId), Some(oldCommitId)) - diff --git a/src/main/twirl/pulls/pullreq.scala.html b/src/main/twirl/pulls/pullreq.scala.html index 6c66d8a..1a879b4 100644 --- a/src/main/twirl/pulls/pullreq.scala.html +++ b/src/main/twirl/pulls/pullreq.scala.html @@ -45,7 +45,7 @@ @pulls.html.commits(issue, pullreq, dayByDayCommits, hasWritePermission, repository)
- @pulls.html.files(issue, pullreq, diffs, commits.head.id, commits.last.id, hasWritePermission, repository) + @helper.html.diff(diffs, repository, Some(commits.head.id), Some(commits.last.id), true)
} diff --git a/src/main/twirl/repo/commit.scala.html b/src/main/twirl/repo/commit.scala.html index fac4c2f..17cef3b 100644 --- a/src/main/twirl/repo/commit.scala.html +++ b/src/main/twirl/repo/commit.scala.html @@ -8,7 +8,6 @@ @import context._ @import view.helpers._ @import util.Implicits._ -@import org.eclipse.jgit.diff.DiffEntry.ChangeType @html.main(commit.shortMessage, Some(repository)){ @html.header("code", repository) @tab(commitId, repository, "commits") @@ -71,52 +70,10 @@ -
-
- -
- Showing @diffs.size changed @plural(diffs.size, "file") - @* - @if(diffs.size == 1){ - Showing 1 changed file - } else { - Showing @diffs.size changed files - } - *@ -
- - @helper.html.diff(diffs, repository, Some(commit.id), oldCommitId) + @helper.html.diff(diffs, repository, Some(commit.id), oldCommitId, true) }