Browse Source

Add the No Docs page if there are no root documents

tags/v1.4.0
James Moger 10 years ago
parent
commit
c8a833a2ea

+ 3
- 0
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties View 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

+ 2
- 1
src/main/java/com/gitblit/wicket/pages/DocsPage.java View File

@@ -59,8 +59,9 @@ public class DocsPage extends RepositoryPage {
List<MarkupDocument> roots = processor.getRootDocs(r, repositoryName, commitId);
Fragment fragment = null;
if (roots.isEmpty()) {
// no identified root documents just show the standard document list
// no identified root documents
fragment = new Fragment("docs", "noIndexFragment", this);
setResponsePage(NoDocsPage.class, params);
} else {
// root documents, use tabbed ui of index/root and document list
fragment = new Fragment("docs", "tabsFragment", this);

+ 22
- 0
src/main/java/com/gitblit/wicket/pages/NoDocsPage.html View File

@@ -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>

+ 39
- 0
src/main/java/com/gitblit/wicket/pages/NoDocsPage.java View File

@@ -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;
}
}

+ 12
- 0
src/main/resources/gitblit.css View File

@@ -520,6 +520,18 @@ th {
text-align: left;
}
div.featureWelcome {
padding: 15px;
background-color: #fbfbfb;
border: 1px solid #ccc;
border-radius: 5px;
}
div.featureWelcome div.icon {
color: #ccc;
font-size: 144px;
}
div.sourceview {
overflow: hidden;
}

Loading…
Cancel
Save