From: James Moger Date: Mon, 25 Nov 2013 21:34:11 +0000 (-0500) Subject: Improve doc page formatting X-Git-Tag: v1.4.0~194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a71a13f23e6352e8a50e500401959ca90eaf8dc;p=gitblit.git Improve doc page formatting Change-Id: Icd060aad6c5d72bd02bac8b4098d4b9fe418494b --- diff --git a/src/main/java/com/gitblit/wicket/pages/DocPage.html b/src/main/java/com/gitblit/wicket/pages/DocPage.html index a484a648..2bb7e1bc 100644 --- a/src/main/java/com/gitblit/wicket/pages/DocPage.html +++ b/src/main/java/com/gitblit/wicket/pages/DocPage.html @@ -6,13 +6,32 @@ +
+ + +
+ +
+ | | +
+ + +
[content]
+
+
+ + +
- + + \ No newline at end of file diff --git a/src/main/java/com/gitblit/wicket/pages/DocPage.java b/src/main/java/com/gitblit/wicket/pages/DocPage.java index a0bdb997..ab0c4623 100644 --- a/src/main/java/com/gitblit/wicket/pages/DocPage.java +++ b/src/main/java/com/gitblit/wicket/pages/DocPage.java @@ -20,6 +20,7 @@ import java.util.List; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.html.panel.Fragment; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; @@ -30,6 +31,7 @@ import com.gitblit.wicket.CacheControl; import com.gitblit.wicket.CacheControl.LastModified; import com.gitblit.wicket.MarkupProcessor; import com.gitblit.wicket.MarkupProcessor.MarkupDocument; +import com.gitblit.wicket.MarkupProcessor.MarkupSyntax; import com.gitblit.wicket.WicketUtils; @CacheControl(LastModified.BOOT) @@ -65,16 +67,24 @@ public class DocPage extends RepositoryPage { } } + Fragment fragment; + MarkupDocument markupDoc = processor.parse(repositoryName, getBestCommitId(commit), documentPath, markupText); + if (MarkupSyntax.PLAIN.equals(markupDoc.syntax)) { + fragment = new Fragment("doc", "plainContent", this); + } else { + fragment = new Fragment("doc", "markupContent", this); + } + // document page links - add(new BookmarkablePageLink("blameLink", BlamePage.class, + fragment.add(new BookmarkablePageLink("blameLink", BlamePage.class, WicketUtils.newPathParameter(repositoryName, objectId, documentPath))); - add(new BookmarkablePageLink("historyLink", HistoryPage.class, + fragment.add(new BookmarkablePageLink("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, documentPath))); - add(new BookmarkablePageLink("rawLink", RawPage.class, WicketUtils.newPathParameter( + fragment.add(new BookmarkablePageLink("rawLink", RawPage.class, WicketUtils.newPathParameter( repositoryName, objectId, documentPath))); - MarkupDocument markupDoc = processor.parse(repositoryName, getBestCommitId(commit), documentPath, markupText); - add(new Label("content", markupDoc.html).setEscapeModelStrings(false)); + fragment.add(new Label("content", markupDoc.html).setEscapeModelStrings(false)); + add(fragment); } @Override