]> source.dussan.org Git - gitblit.git/commitdiff
Add the No Docs page if there are no root documents
authorJames Moger <james.moger@gitblit.com>
Fri, 28 Feb 2014 23:14:54 +0000 (18:14 -0500)
committerJames Moger <james.moger@gitblit.com>
Sat, 1 Mar 2014 14:21:32 +0000 (09:21 -0500)
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/pages/DocsPage.java
src/main/java/com/gitblit/wicket/pages/NoDocsPage.html [new file with mode: 0644]
src/main/java/com/gitblit/wicket/pages/NoDocsPage.java [new file with mode: 0644]
src/main/resources/gitblit.css

index 23cb649c1f4b1775f563ad7fb1f07427c2b34e68..8f3a6aafcd59cfcab7b2e9003d4f979a83b32684 100644 (file)
@@ -509,3 +509,6 @@ gb.home = home
 gb.isMirror = this repository is a mirror
 gb.mirrorOf = mirror of {0}
 gb.mirrorWarning = this repository is a mirror and can not receive pushes
+gb.docsWelcome1 = You can use docs to document your repository.
+gb.docsWelcome2 = Commit a README.md or a HOME.md file to get started.
+gb.createReadme = create a README
\ No newline at end of file
index 85c19e22a839848750d88ff394a5c52d48f14b6b..907dd6e22e758d780f548c9a8b6b9f466c840476 100644 (file)
@@ -59,8 +59,9 @@ public class DocsPage extends RepositoryPage {
                List<MarkupDocument> roots = processor.getRootDocs(r, repositoryName, commitId);\r
                Fragment fragment = null;\r
                if (roots.isEmpty()) {\r
-                       // no identified root documents just show the standard document list\r
+                       // no identified root documents\r
                        fragment = new Fragment("docs", "noIndexFragment", this);\r
+                       setResponsePage(NoDocsPage.class, params);\r
                } else {\r
                        // root documents, use tabbed ui of index/root and document list\r
                        fragment = new Fragment("docs", "tabsFragment", this);\r
diff --git a/src/main/java/com/gitblit/wicket/pages/NoDocsPage.html b/src/main/java/com/gitblit/wicket/pages/NoDocsPage.html
new file mode 100644 (file)
index 0000000..0672e94
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"  
+      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  
+      xml:lang="en"  
+      lang="en"> 
+
+<wicket:extend>
+       <!-- No tickets -->
+       <div class="featureWelcome">
+               <div class="row">
+               <div class="icon span2"><i class="fa fa-book"></i></div>
+               <div class="span9">             
+                       <h1><wicket:message key="gb.docs"></wicket:message></h1>
+                       <p><wicket:message key="gb.docsWelcome1"></wicket:message></p>
+                       <p><wicket:message key="gb.docsWelcome2"></wicket:message></p>
+                       <p></p>
+                       <!-- <a wicket:id="newreadme" class="btn btn-appmenu"><wicket:message key="gb.createReadme"></wicket:message></a>-->
+               </div>
+               </div>
+       </div>
+</wicket:extend>
+</html>
\ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/pages/NoDocsPage.java b/src/main/java/com/gitblit/wicket/pages/NoDocsPage.java
new file mode 100644 (file)
index 0000000..868e5d0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket.pages;
+
+import org.apache.wicket.PageParameters;
+
+public class NoDocsPage extends RepositoryPage {
+
+       public NoDocsPage(PageParameters params) {
+               super(params);
+
+               //UserModel user = GitBlitWebSession.get().getUser();
+               //boolean isAuthenticated = user != null && user.isAuthenticated;
+               //add(new BookmarkablePageLink<Void>("newreadme", NewTicketPage.class, WicketUtils.newRepositoryParameter(repositoryName)).setVisible(isAuthenticated));
+       }
+
+       @Override
+       protected String getPageName() {
+               return getString("gb.docs");
+       }
+
+       @Override
+       protected Class<? extends BasePage> getRepoNavPageClass() {
+               return DocsPage.class;
+       }
+}
index 91825f7e3e991e4ac3062e1d839a4a511e35d940..cd5c57b001013a3d3cbbb3f1686f8beab87c6995 100644 (file)
@@ -520,6 +520,18 @@ th {
        text-align: left;       \r
 }\r
 \r
+div.featureWelcome {\r
+       padding: 15px;\r
+       background-color: #fbfbfb;\r
+       border: 1px solid #ccc;\r
+       border-radius: 5px;     \r
+}\r
+\r
+div.featureWelcome div.icon {\r
+       color: #ccc;\r
+       font-size: 144px;\r
+}\r
+\r
 div.sourceview {\r
        overflow: hidden;\r
 }\r