-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cee0d06
commit f905a3f
Showing
8 changed files
with
162 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package jenkins.views; | ||
|
||
import hudson.ExtensionPoint; | ||
|
||
public interface Header extends ExtensionPoint { | ||
|
||
/** | ||
* Checks if header is enabled. By default it is if installed, but the logic is deferred in the plugins. | ||
* @return | ||
*/ | ||
boolean isHeaderEnabled(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package jenkins.views; | ||
|
||
import hudson.Extension; | ||
|
||
@Extension(ordinal = Integer.MIN_VALUE) | ||
public class JenkinsHeader implements Header { | ||
|
||
@Override | ||
public boolean isHeaderEnabled() { | ||
return true; | ||
} | ||
|
||
} |
80 changes: 80 additions & 0 deletions
80
core/src/main/resources/jenkins/views/JenkinsHeader/headerContent.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml"> | ||
<header id="header" class="page-header"> | ||
<div class="page-header__brand"> | ||
<div class="logo"> | ||
<a id="jenkins-home-link" href="${rootURL}/"> | ||
<img id="jenkins-head-icon" src="${imagesURL}/jenkins-header-logo-v2.svg" alt="[${logoAlt}]" /> | ||
<img id="jenkins-name-icon" src="${imagesURL}/title.svg" alt="${title}" width="139" height="34" /> | ||
</a> | ||
</div> | ||
|
||
<a class="page-header__brand-link" href="${rootURL}/"> | ||
<img src="${imagesURL}/jenkins-header-logo-v2.svg" | ||
alt="[${logoAlt}]" | ||
class="page-header__brand-image" /> | ||
<span class="page-header__brand-name">Jenkins</span> | ||
</a> | ||
</div> | ||
|
||
<div class="searchbox hidden-xs"> | ||
<!-- search box --> | ||
<j:set var="searchURL" value="${h.searchURL}"/> | ||
<form action="${searchURL}" method="get" style="position:relative;" class="no-json" name="search" role="search"> | ||
<!-- this div is used to calculate the width of the text box --> | ||
<div id="search-box-sizer"/> | ||
<div id="searchform"> | ||
<input name="q" placeholder="${searchPlaceholder}" id="search-box" class="main-search__input" value="${request.getParameter('q')}" role="searchbox" /> | ||
|
||
<span class="main-search__icon-leading"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_search_24px" /> | ||
</span> | ||
<a href="${searchHelpUrl}" class="main-search__icon-trailing"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_help_outline_24px" /> | ||
</a> | ||
|
||
<div id="search-box-completion" /> | ||
<script>createSearchBox("${searchURL}");</script> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<div class="login page-header__hyperlinks"> | ||
<div id="visible-am-insertion" class="page-header__am-wrapper" /> | ||
<div id="visible-sec-am-insertion" class="page-header__am-wrapper" /> | ||
|
||
<!-- login field --> | ||
<j:if test="${app.useSecurity}"> | ||
<j:choose> | ||
<j:when test="${!h.isAnonymous()}"> | ||
<j:invokeStatic var="user" className="hudson.model.User" method="current" /> | ||
<j:choose> | ||
<j:when test="${user.fullName == null || user.fullName.trim().isEmpty()}"> | ||
<j:set var="userName" value="${user.id}"/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="userName" value="${user.fullName}"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<a href="${rootURL}/${user.url}" class="model-link inside inverse"> | ||
<l:svgIcon | ||
class="am-monitor-icon" > | ||
<use href="${resURL}/images/material-icons/svg-sprite-social-symbol.svg#ic_person_24px"></use> | ||
</l:svgIcon> | ||
<span class="hidden-xs hidden-sm">${userName}</span> | ||
</a> | ||
<j:if test="${app.securityRealm.canLogOut()}"> | ||
<a href="${rootURL}/logout"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_input_24px" /> | ||
<span class="hidden-xs hidden-sm">${logout}</span> | ||
</a> | ||
</j:if> | ||
</j:when> | ||
<j:otherwise> | ||
<st:include it="${app.securityRealm}" page="loginLink.jelly" /> | ||
</j:otherwise> | ||
</j:choose> | ||
</j:if> | ||
</div> | ||
</header> | ||
</j:jelly> |
28 changes: 28 additions & 0 deletions
28
core/src/main/resources/jenkins/views/JenkinsHeader/headerDocumentation.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml"> | ||
<st:documentation> | ||
Generates the page header, along with its associated dynamic behaviours. | ||
This tag is used by l:layout and not expected to be used by anyone else, | ||
but it's written as separate tag for better readability of code. | ||
|
||
<st:attribute name="title" required="true"> | ||
Page title and title attribute for the logo | ||
</st:attribute> | ||
|
||
<st:attribute name="logoAlt" required="true"> | ||
Alt text for the logo | ||
</st:attribute> | ||
|
||
<st:attribute name="searchPlaceholder" required="true"> | ||
Placeholder text for the search input | ||
</st:attribute> | ||
|
||
<st:attribute name="searchHelpUrl" required="true"> | ||
Link value for the help icon on the search box | ||
</st:attribute> | ||
|
||
<st:attribute name="logout" required="true"> | ||
Text for the logout link | ||
</st:attribute> | ||
</st:documentation> | ||
</j:jelly> |
3 changes: 3 additions & 0 deletions
3
core/src/main/resources/jenkins/views/JenkinsHeader/postHeader.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml"> | ||
</j:jelly> |
3 changes: 3 additions & 0 deletions
3
core/src/main/resources/jenkins/views/JenkinsHeader/preHeader.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml"> | ||
</j:jelly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,8 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml"> | ||
<st:documentation> | ||
Generates the page header, along with its associated dynamic behaviours. | ||
This tag is used by l:layout and not expected to be used by anyone else, | ||
but it's written as separate tag for better readability of code. | ||
|
||
<st:attribute name="title" required="true"> | ||
Page title and title attribute for the logo | ||
</st:attribute> | ||
|
||
<st:attribute name="logoAlt" required="true"> | ||
Alt text for the logo | ||
</st:attribute> | ||
|
||
<st:attribute name="searchPlaceholder" required="true"> | ||
Placeholder text for the search input | ||
</st:attribute> | ||
|
||
<st:attribute name="searchHelpUrl" required="true"> | ||
Link value for the help icon on the search box | ||
</st:attribute> | ||
|
||
<st:attribute name="logout" required="true"> | ||
Text for the logout link | ||
</st:attribute> | ||
</st:documentation> | ||
|
||
<header id="header" class="page-header"> | ||
<div class="page-header__brand"> | ||
<div class="logo"> | ||
<a id="jenkins-home-link" href="${rootURL}/"> | ||
<img id="jenkins-head-icon" src="${imagesURL}/jenkins-header-logo-v2.svg" alt="[${logoAlt}]" /> | ||
<img id="jenkins-name-icon" src="${imagesURL}/title.svg" alt="${title}" width="139" height="34" /> | ||
</a> | ||
</div> | ||
|
||
<a class="page-header__brand-link" href="${rootURL}/"> | ||
<img src="${imagesURL}/jenkins-header-logo-v2.svg" | ||
alt="[${logoAlt}]" | ||
class="page-header__brand-image" /> | ||
<span class="page-header__brand-name">Jenkins</span> | ||
</a> | ||
</div> | ||
|
||
<div class="searchbox hidden-xs"> | ||
<!-- search box --> | ||
<j:set var="searchURL" value="${h.searchURL}"/> | ||
<form action="${searchURL}" method="get" style="position:relative;" class="no-json" name="search" role="search"> | ||
<!-- this div is used to calculate the width of the text box --> | ||
<div id="search-box-sizer"/> | ||
<div id="searchform"> | ||
<input name="q" placeholder="${searchPlaceholder}" id="search-box" class="main-search__input" value="${request.getParameter('q')}" role="searchbox" /> | ||
|
||
<span class="main-search__icon-leading"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_search_24px" /> | ||
</span> | ||
<a href="${searchHelpUrl}" class="main-search__icon-trailing"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_help_outline_24px" /> | ||
</a> | ||
|
||
<div id="search-box-completion" /> | ||
<script>createSearchBox("${searchURL}");</script> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<div class="login page-header__hyperlinks"> | ||
<div id="visible-am-insertion" class="page-header__am-wrapper" /> | ||
<div id="visible-sec-am-insertion" class="page-header__am-wrapper" /> | ||
|
||
<!-- login field --> | ||
<j:if test="${app.useSecurity}"> | ||
<j:choose> | ||
<j:when test="${!h.isAnonymous()}"> | ||
<j:invokeStatic var="user" className="hudson.model.User" method="current" /> | ||
<j:choose> | ||
<j:when test="${user.fullName == null || user.fullName.trim().isEmpty()}"> | ||
<j:set var="userName" value="${user.id}"/> | ||
</j:when> | ||
<j:otherwise> | ||
<j:set var="userName" value="${user.fullName}"/> | ||
</j:otherwise> | ||
</j:choose> | ||
<a href="${rootURL}/${user.url}" class="model-link inside inverse"> | ||
<l:svgIcon | ||
class="am-monitor-icon" > | ||
<use href="${resURL}/images/material-icons/svg-sprite-social-symbol.svg#ic_person_24px"></use> | ||
</l:svgIcon> | ||
<span class="hidden-xs hidden-sm">${userName}</span> | ||
</a> | ||
<j:if test="${app.securityRealm.canLogOut()}"> | ||
<a href="${rootURL}/logout"> | ||
<l:svgIcon href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_input_24px" /> | ||
<span class="hidden-xs hidden-sm">${logout}</span> | ||
</a> | ||
</j:if> | ||
</j:when> | ||
<j:otherwise> | ||
<st:include it="${app.securityRealm}" page="loginLink.jelly" /> | ||
</j:otherwise> | ||
</j:choose> | ||
</j:if> | ||
</div> | ||
</header> | ||
<j:set var="header" value="${h.header()}" /> | ||
<st:include it="${header}" page="headerDocumentation.jelly"/> | ||
<st:include it="${header}" page="preHeader.jelly"/> | ||
<st:include it="${header}" page="headerContent.jelly"/> | ||
<st:include it="${header}" page="postHeader.jelly"/> | ||
</j:jelly> |