diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-25 16:34:11 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-26 16:07:04 -0500 |
commit | 8a71a13f23e6352e8a50e500401959ca90eaf8dc (patch) | |
tree | 7ad9288b053d809ca0d7854580a25f1f5ec93997 /src/main/java/com | |
parent | 3d87db0d203b855ea819e4dfdd6bd1a328182719 (diff) | |
download | gitblit-8a71a13f23e6352e8a50e500401959ca90eaf8dc.tar.gz gitblit-8a71a13f23e6352e8a50e500401959ca90eaf8dc.zip |
Improve doc page formatting
Change-Id: Icd060aad6c5d72bd02bac8b4098d4b9fe418494b
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/DocPage.html | 23 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/DocPage.java | 20 |
2 files changed, 36 insertions, 7 deletions
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 @@ <body>
<wicket:extend>
+<div wicket:id="doc"></div>
+
+<wicket:fragment wicket:id="markupContent">
+<div class="docs" style="margin-top: -10px;">
+ <!-- doc nav links -->
+ <div style="float: right;" class="docnav">
+ <a wicket:id="blameLink"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a>
+ </div>
+
+ <!-- document content -->
+ <div class="markdown" wicket:id="content">[content]</div>
+</div>
+</wicket:fragment>
+
+<wicket:fragment wicket:id="plainContent">
+<div class="docs">
<!-- doc nav links -->
- <div style="float: right;" class="page_nav2">
+ <div style="float: right;" class="docnav">
<a wicket:id="blameLink"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a>
</div>
<!-- document content -->
- <div class="markdown" style="padding-bottom:5px;" wicket:id="content">[content]</div>
+ <div wicket:id="content">[content]</div>
+</div>
+</wicket:fragment>
+
</wicket:extend>
</body>
</html>
\ 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<Void>("blameLink", BlamePage.class,
+ fragment.add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));
- add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ fragment.add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));
- add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(
+ fragment.add(new BookmarkablePageLink<Void>("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
|