]> source.dussan.org Git - gitblit.git/commitdiff
Improve doc page formatting
authorJames Moger <james.moger@gitblit.com>
Mon, 25 Nov 2013 21:34:11 +0000 (16:34 -0500)
committerJames Moger <james.moger@gitblit.com>
Tue, 26 Nov 2013 21:07:04 +0000 (16:07 -0500)
Change-Id: Icd060aad6c5d72bd02bac8b4098d4b9fe418494b

src/main/java/com/gitblit/wicket/pages/DocPage.html
src/main/java/com/gitblit/wicket/pages/DocPage.java

index a484a64841684137c41b1dd841d64393806671d0..2bb7e1bc38d79bd70fdaddd744084c8a12fc2e20 100644 (file)
@@ -6,13 +6,32 @@
 \r
 <body>\r
 <wicket:extend>\r
+<div wicket:id="doc"></div>\r
+\r
+<wicket:fragment wicket:id="markupContent">\r
+<div class="docs" style="margin-top: -10px;">\r
+               <!-- doc nav links -->  \r
+               <div style="float: right;" class="docnav">\r
+                       <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>\r
+               </div>  \r
+       \r
+               <!--  document content -->\r
+               <div class="markdown" wicket:id="content">[content]</div>\r
+</div>\r
+</wicket:fragment>\r
+\r
+<wicket:fragment wicket:id="plainContent">\r
+<div class="docs">\r
                <!-- doc nav links -->  \r
-               <div style="float: right;" class="page_nav2">\r
+               <div style="float: right;" class="docnav">\r
                        <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>\r
                </div>  \r
        \r
                <!--  document content -->\r
-               <div class="markdown" style="padding-bottom:5px;" wicket:id="content">[content]</div>\r
+               <div wicket:id="content">[content]</div>\r
+</div>\r
+</wicket:fragment>\r
+\r
 </wicket:extend>\r
 </body>\r
 </html>
\ No newline at end of file
index a0bdb9977fb4d308232b83e8be1eb11163934c99..ab0c4623230117ac9e9803cc43669dda84a3b084 100644 (file)
@@ -20,6 +20,7 @@ import java.util.List;
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Fragment;\r
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 \r
@@ -30,6 +31,7 @@ import com.gitblit.wicket.CacheControl;
 import com.gitblit.wicket.CacheControl.LastModified;\r
 import com.gitblit.wicket.MarkupProcessor;\r
 import com.gitblit.wicket.MarkupProcessor.MarkupDocument;\r
+import com.gitblit.wicket.MarkupProcessor.MarkupSyntax;\r
 import com.gitblit.wicket.WicketUtils;\r
 \r
 @CacheControl(LastModified.BOOT)\r
@@ -65,16 +67,24 @@ public class DocPage extends RepositoryPage {
                        }\r
                }\r
 \r
+               Fragment fragment;\r
+               MarkupDocument markupDoc = processor.parse(repositoryName, getBestCommitId(commit), documentPath, markupText);\r
+               if (MarkupSyntax.PLAIN.equals(markupDoc.syntax)) {\r
+                       fragment = new Fragment("doc", "plainContent", this);\r
+               } else {\r
+                       fragment = new Fragment("doc", "markupContent", this);\r
+               }\r
+\r
                // document page links\r
-               add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,\r
+               fragment.add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,\r
                                WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));\r
-               add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,\r
+               fragment.add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,\r
                                WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));\r
-               add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(\r
+               fragment.add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(\r
                                repositoryName, objectId, documentPath)));\r
 \r
-               MarkupDocument markupDoc = processor.parse(repositoryName, getBestCommitId(commit), documentPath, markupText);\r
-               add(new Label("content", markupDoc.html).setEscapeModelStrings(false));\r
+               fragment.add(new Label("content", markupDoc.html).setEscapeModelStrings(false));\r
+               add(fragment);\r
        }\r
 \r
        @Override\r