summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-11-14 17:53:35 -0500
committerJames Moger <james.moger@gitblit.com>2013-11-14 17:53:35 -0500
commitfab099270c3d53e4d0a3acf0337932f53e5ff14b (patch)
treeb6a10a06778bc53c0880267dfb6844828755b186 /src/main/java
parent9de1a56ac4a888289cd758d033cb02ece2bbca76 (diff)
downloadgitblit-fab099270c3d53e4d0a3acf0337932f53e5ff14b.tar.gz
gitblit-fab099270c3d53e4d0a3acf0337932f53e5ff14b.zip
README files are not shown on the summary page by default
Change-Id: I421a6b8f8c8eaa5d34b7629858de76fc96458cd3
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/SummaryPage.html2
-rw-r--r--src/main/java/com/gitblit/wicket/pages/SummaryPage.java28
2 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/SummaryPage.html b/src/main/java/com/gitblit/wicket/pages/SummaryPage.html
index 69cd3903..42c59c48 100644
--- a/src/main/java/com/gitblit/wicket/pages/SummaryPage.html
+++ b/src/main/java/com/gitblit/wicket/pages/SummaryPage.html
@@ -54,7 +54,7 @@
<i style="vertical-align: middle;" class="icon-book"></i>
<span style="font-weight:bold;vertical-align:middle;" wicket:id="readmeFile"></span>
</div>
- <div style="border:1px solid #ddd;border-radius: 0 0 3px 3px;padding: 20px;">
+ <div style="border:1px solid #ddd;border-radius: 0 0 3px 3px;padding: 15px 20px;">
<div wicket:id="readmeContent"></div>
</div>
</wicket:fragment>
diff --git a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java
index 872f038c..6f9d3a44 100644
--- a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java
@@ -138,18 +138,24 @@ public class SummaryPage extends RepositoryPage {
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs, false).hideIfEmpty());
- RevCommit head = JGitUtils.getCommit(r, null);
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());
- MarkupDocument markupDoc = processor.parseReadme(r, repositoryName, getBestCommitId(head));
- if (markupDoc.markup == null) {
- add(new Label("readme").setVisible(false));
+ if (GitBlit.getBoolean(Keys.web.summaryShowReadme, false)) {
+ // show a readme on the summary page
+ RevCommit head = JGitUtils.getCommit(r, null);
+ MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());
+ MarkupDocument markupDoc = processor.parseReadme(r, repositoryName, getBestCommitId(head));
+ if (markupDoc == null || markupDoc.markup == null) {
+ add(new Label("readme").setVisible(false));
+ } else {
+ Fragment fragment = new Fragment("readme", MarkupSyntax.PLAIN.equals(markupDoc.syntax) ? "plaintextPanel" : "markdownPanel", this);
+ fragment.add(new Label("readmeFile", markupDoc.documentPath));
+ // Add the html to the page
+ Component content = new Label("readmeContent", markupDoc.html).setEscapeModelStrings(false);
+ fragment.add(content.setVisible(!StringUtils.isEmpty(markupDoc.html)));
+ add(fragment);
+ }
} else {
- Fragment fragment = new Fragment("readme", MarkupSyntax.PLAIN.equals(markupDoc.syntax) ? "plaintextPanel" : "markdownPanel", this);
- fragment.add(new Label("readmeFile", markupDoc.documentPath));
- // Add the html to the page
- Component content = new Label("readmeContent", markupDoc.html).setEscapeModelStrings(false);
- fragment.add(content.setVisible(!StringUtils.isEmpty(markupDoc.html)));
- add(fragment);
+ // global, no readme on summary page
+ add(new Label("readme").setVisible(false));
}
// Display an activity line graph