diff options
author | James Moger <james.moger@gitblit.com> | 2013-06-26 17:10:13 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-06-26 17:10:13 -0400 |
commit | c129a913c4fd64558aef4cbad41c4246f5886a97 (patch) | |
tree | ab0e47226921b693159176f4e10cee0cfecd307f | |
parent | 17725677285470ca7dbf5da93e4235415545a7cf (diff) | |
download | gitblit-c129a913c4fd64558aef4cbad41c4246f5886a97.tar.gz gitblit-c129a913c4fd64558aef4cbad41c4246f5886a97.zip |
Support custom header colors and finish theme flattening (issue 209)
-rw-r--r-- | releases.moxie | 7 | ||||
-rw-r--r-- | src/main/distrib/data/gitblit.properties | 40 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.html | 5 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/ProjectPage.html | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/RepositoriesPage.html | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/RootPage.java | 47 | ||||
-rw-r--r-- | src/main/resources/bootstrap/css/bootstrap-responsive.css | 9 | ||||
-rw-r--r-- | src/main/resources/gitblit.css | 40 | ||||
-rw-r--r-- | src/site/custom.less | 8 |
9 files changed, 129 insertions, 31 deletions
diff --git a/releases.moxie b/releases.moxie index 0327e4be..ff7e0927 100644 --- a/releases.moxie +++ b/releases.moxie @@ -53,6 +53,7 @@ r17: { - Added a ui for the ref log introduced in 1.2.1 (issue-177)
- Added weblogic.xml to WAR for deployment on WebLogic (issue 199)
- Support setting a custom header logo (issue 208)
+ - Support header color customizations (issue 209)
- Support username substitution in web.otherUrls (issue 213)
- Option to force client-side basic authentication instead of form-based authentication if web.authenticateViewPages=true (issue 222)
- Setting to automatically create an user account based on an authenticated user principal from the servlet container (issue-246)
@@ -134,6 +135,12 @@ r17: { - { name: 'web.activityCacheDays', defaultValue: 14 }
- { name: 'web.allowAppCloneLinks', defaultValue: 'true' }
- { name: 'web.forceDefaultLocale', defaultValue: ' ' }
+ - { name: 'web.headerLogo', defaultValue: '${baseFolder}/logo.png' }
+ - { name: 'web.headerBackgroundColor', defaultValue: ' ' }
+ - { name: 'web.headerForegroundColor', defaultValue: ' ' }
+ - { name: 'web.headerHoverColor', defaultValue: ' ' }
+ - { name: 'web.headerBorderColor', defaultValue: ' ' }
+ - { name: 'web.headerBorderFocusColor', defaultValue: ' ' }
- { name: 'web.metricAuthorExclusions', defaultValue: ' ' }
- { name: 'web.overviewReflogCount', defaultValue: 5 }
- { name: 'web.reflogChangesPerPage', defaultValue: 10 }
diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties index 50b09f30..f6ed3833 100644 --- a/src/main/distrib/data/gitblit.properties +++ b/src/main/distrib/data/gitblit.properties @@ -538,6 +538,46 @@ web.siteName = # BASEFOLDER
web.headerLogo = ${baseFolder}/logo.png
+# You may specify a custom header background CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerBackgroundColor = #002060
+#
+# SINCE 1.3.0
+web.headerBackgroundColor =
+
+# You may specify a custom header foreground CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerForegroundColor = white
+#
+# SINCE 1.3.0
+web.headerForegroundColor =
+
+# You may specify a custom header foreground hover CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerHoverColor = white
+#
+# SINCE 1.3.0
+web.headerHoverColor =
+
+# You may specify a custom header border CSS color. If unspecified, the default
+# color will be used.
+#
+# e.g. web.headerBorderColor = #002060
+#
+# SINCE 1.3.0
+web.headerBorderColor =
+
+# You may specify a custom header border CSS color. If unspecified, the default
+# color will be used.
+#
+# e.g. web.headerBorderFocusColor = #ff9900
+#
+# SINCE 1.3.0
+web.headerBorderFocusColor =
+
# If *web.authenticateAdminPages*=true, users with "admin" role can create
# repositories, create users, and edit repository metadata.
#
diff --git a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.html b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.html index 20d31c39..91a6ef43 100644 --- a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.html +++ b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.html @@ -15,8 +15,9 @@ <wicket:extend>
<body onload="document.getElementById('query').focus(); prettyPrint();">
<div class="container">
- <div class="pageTitle">
- <h2><wicket:message key="gb.search"></wicket:message></h2>
+ <!-- page header -->
+ <div class="dashboardTitle">
+ <wicket:message key="gb.search"></wicket:message>
</div>
<form class="form-inline" wicket:id="searchForm">
<div class="row">
diff --git a/src/main/java/com/gitblit/wicket/pages/ProjectPage.html b/src/main/java/com/gitblit/wicket/pages/ProjectPage.html index 925b18e1..aaf9108e 100644 --- a/src/main/java/com/gitblit/wicket/pages/ProjectPage.html +++ b/src/main/java/com/gitblit/wicket/pages/ProjectPage.html @@ -7,7 +7,7 @@ <body>
<wicket:extend>
<div class="container">
- <div class="row" style="padding-top:5px;">
+ <div class="row">
<div class="span12">
<div class="dashboardTitle">
<span wicket:id="projectTitle"></span>
diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoriesPage.html b/src/main/java/com/gitblit/wicket/pages/RepositoriesPage.html index d7846745..36670a80 100644 --- a/src/main/java/com/gitblit/wicket/pages/RepositoriesPage.html +++ b/src/main/java/com/gitblit/wicket/pages/RepositoriesPage.html @@ -7,7 +7,7 @@ <body>
<wicket:extend>
<div class="container">
- <div class="markdown" style="padding-bottom:5px;" wicket:id="repositoriesMessage">[repositories message]</div>
+ <div class="markdown" style="padding: 5px 0px;" wicket:id="repositoriesMessage">[repositories message]</div>
<div wicket:id="repositoriesPanel">[repositories panel]</div>
</div>
diff --git a/src/main/java/com/gitblit/wicket/pages/RootPage.java b/src/main/java/com/gitblit/wicket/pages/RootPage.java index f4ac907b..7739e6df 100644 --- a/src/main/java/com/gitblit/wicket/pages/RootPage.java +++ b/src/main/java/com/gitblit/wicket/pages/RootPage.java @@ -33,6 +33,9 @@ import java.util.regex.Pattern; import org.apache.wicket.MarkupContainer;
import org.apache.wicket.PageParameters;
+import org.apache.wicket.behavior.HeaderContributor;
+import org.apache.wicket.markup.html.IHeaderContributor;
+import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.TextField;
@@ -83,6 +86,50 @@ public abstract class RootPage extends BasePage { @Override
protected void setupPage(String repositoryName, String pageName) {
+
+ // CSS header overrides
+ add(new HeaderContributor(new IHeaderContributor() {
+ private static final long serialVersionUID = 1L;
+
+ public void renderHead(IHeaderResponse response) {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("<style type=\"text/css\">\n");
+ buffer.append(".navbar-inner {\n");
+ final String headerBackground = GitBlit.getString(Keys.web.headerBackgroundColor, null);
+ if (!StringUtils.isEmpty(headerBackground)) {
+ buffer.append(MessageFormat.format("background-color: {0};\n", headerBackground));
+ }
+ final String headerBorder = GitBlit.getString(Keys.web.headerBorderColor, null);
+ if (!StringUtils.isEmpty(headerBorder)) {
+ buffer.append(MessageFormat.format("border-bottom: 1px solid {0} !important;\n", headerBorder));
+ }
+ buffer.append("}\n");
+ final String headerBorderFocus = GitBlit.getString(Keys.web.headerBorderFocusColor, null);
+ if (!StringUtils.isEmpty(headerBorderFocus)) {
+ buffer.append(".navbar ul li:focus, .navbar .active {\n");
+ buffer.append(MessageFormat.format("border-bottom: 4px solid {0};\n", headerBorderFocus));
+ buffer.append("}\n");
+ }
+ final String headerForeground = GitBlit.getString(Keys.web.headerForegroundColor, null);
+ if (!StringUtils.isEmpty(headerForeground)) {
+ buffer.append(".navbar ul.nav li a {\n");
+ buffer.append(MessageFormat.format("color: {0};\n", headerForeground));
+ buffer.append("}\n");
+ buffer.append(".navbar ul.nav .active a {\n");
+ buffer.append(MessageFormat.format("color: {0};\n", headerForeground));
+ buffer.append("}\n");
+ }
+ final String headerHover = GitBlit.getString(Keys.web.headerHoverColor, null);
+ if (!StringUtils.isEmpty(headerHover)) {
+ buffer.append(".navbar ul.nav li a:hover {\n");
+ buffer.append(MessageFormat.format("color: {0} !important;\n", headerHover));
+ buffer.append("}\n");
+ }
+ buffer.append("</style>\n");
+ response.renderString(buffer.toString());
+ }
+ }));
+
boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, false);
boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
diff --git a/src/main/resources/bootstrap/css/bootstrap-responsive.css b/src/main/resources/bootstrap/css/bootstrap-responsive.css index 06e55c0b..7e7ec697 100644 --- a/src/main/resources/bootstrap/css/bootstrap-responsive.css +++ b/src/main/resources/bootstrap/css/bootstrap-responsive.css @@ -688,24 +688,19 @@ position: static; } .navbar-fixed-top { - margin-bottom: 18px; + margin-bottom: 0px; } .navbar-fixed-bottom { margin-top: 18px; } .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner { - padding: 5px; + padding: 0px 5px 1px; } .navbar .container { width: auto; padding: 0; } - .navbar .brand { - padding-right: 10px; - padding-left: 10px; - margin: 0 0 0 -5px; - } .nav-collapse { clear: both; } diff --git a/src/main/resources/gitblit.css b/src/main/resources/gitblit.css index d10f3809..cf699005 100644 --- a/src/main/resources/gitblit.css +++ b/src/main/resources/gitblit.css @@ -1,6 +1,6 @@ body {
- /* 50px to start the container 10px below the navbar */
- padding-top: 60px;
+ /* 47px is the header height */
+ padding-top: 47px;
}
footer {
@@ -61,6 +61,9 @@ hr { .navbar .brand {
padding: 0px 10px 0px 20px;
}
+.navbar .btn-navbar {
+ margin-top: 10px;
+}
.navbar .pull-right {
margin: 0;
@@ -88,20 +91,16 @@ hr { .navbar-inner {
background-color: #002060;
- background-repeat: none;
background-image: none;
- -webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);
- -moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);
- box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);
- border-bottom: 2px solid #ff9900 !important;
+ box-shadow: none;
+ border-bottom: 1px solid #002060 !important;
}
.navbar ul li:focus, .navbar .active {
- background-repeat:no-repeat;
- background-image: url(arrow_page.png);
- background-position: center bottom;
- outline: 0;
- padding-bottom:3px;
+ outline: 0;
+ padding-bottom: 1px;
+ border-bottom: 3px solid #ff9900;
+ margin-bottom: -1px;
}
.navbar .active a {
@@ -152,8 +151,8 @@ div.reflog i { div.dashboardTitle {
font-size: 1.75em;
- padding-bottom: 5px;
- margin-bottom: 10px;
+ padding: 5px 0px;
+ margin: 10px 0px;
border-bottom: 1px solid #ccc;
}
@@ -165,12 +164,12 @@ div.dashboardTitle small { .repositorynavbar {
background-color: #fbfbfb;
border-bottom: 1px solid #ccc;
- margin-top: -8px;
margin-bottom: 10px;
}
.repositorynavbar .title {
line-height: 32px;
+ padding: 5px 0px;
}
.repositorynavbar .repository {
@@ -183,7 +182,8 @@ div.dashboardTitle small { color: #002060;
}
-.repositorynavbar .repositorynavbar-inner {
+.repositorynavbar .repositorynavbar-inner {
+ padding-top: 2px;
}
.repositorynavbar ul {
@@ -221,6 +221,14 @@ div.dashboardTitle small { text-decoration: underline;
}
+@media (max-width: 767px) {
+ .repositorynavbar {
+ margin-right: -20px;
+ margin-left: -20px;
+ padding: 0px 5px;
+ }
+}
+
.btn-appmenu {
border-radius: 4px !important;
background-color: #002060;
diff --git a/src/site/custom.less b/src/site/custom.less index ca207dfa..96e70ca7 100644 --- a/src/site/custom.less +++ b/src/site/custom.less @@ -66,10 +66,10 @@ }
ul > li:focus, .active {
- background-repeat:no-repeat;
- background-image: url('../../arrow_page.png');
- background-position: center bottom;
- outline: 0;
+ outline: 0;
+ padding-bottom: 1px;
+ border-bottom: 3px solid #ff9900;
+ margin-bottom: -1px;
}
}
|