From 5d59b9ba3206894198a24807690fba00844c98f7 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Sat, 07 Mar 2015 11:52:14 -0500 Subject: [PATCH] Add links to commit diff and blob diff pages to toggle whitespace setting --- src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java index 2ec829e..95580ed 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java +++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java @@ -57,9 +57,9 @@ public CommitDiffPage(PageParameters params) { super(params); - Repository r = getRepository(); - - RevCommit commit = getCommit(); + final Repository r = getRepository(); + final RevCommit commit = getCommit(); + final DiffComparator diffComparator = WicketUtils.getDiffComparator(params); List<String> parents = new ArrayList<String>(); if (commit.getParentCount() > 0) { @@ -79,6 +79,8 @@ WicketUtils.newObjectParameter(repositoryName, objectId))); add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); + add(new LinkPanel("whitespaceLink", null, getString(diffComparator.getOpposite().getTranslationKey()), + CommitDiffPage.class, WicketUtils.newDiffParameter(repositoryName, objectId, diffComparator.getOpposite()))); add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); @@ -86,7 +88,6 @@ final ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName, parents.isEmpty() ? null : parents.get(0), commit.getName(), imageExtensions); - final DiffComparator diffComparator = WicketUtils.getDiffComparator(params); final DiffOutput diff = DiffUtils.getCommitDiff(r, commit, diffComparator, DiffOutputType.HTML, handler); if (handler.getImgDiffCount() > 0) { addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs -- Gitblit v1.9.1