Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use header taglib to decouple from core #101

Merged
merged 5 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.440.2</jenkins.version>
<jenkins.version>2.459</jenkins.version>
<gitHubRepo>jenkinsci/customizable-header-plugin</gitHubRepo>
<node.version>20.8.0</node.version>
<yarn.version>1.22.19</yarn.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import io.jenkins.plugins.customizable_header.logo.Logo;
import java.io.IOException;
import java.io.StringWriter;
import jenkins.views.PartialHeader;
import jenkins.views.FullHeader;

@Extension(ordinal = 99999)
public class LogoHeader extends PartialHeader implements SystemMessageProvider {
public class LogoHeader extends FullHeader implements SystemMessageProvider {

@Override
public boolean isEnabled() {
Expand Down Expand Up @@ -37,9 +37,4 @@ public boolean hasLinks() {
public Logo getLogo() {
return CustomHeaderConfiguration.get().getLogo();
}

@Override
public int getSupportedHeaderVersion() {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
<j:if test="${it.hasLinks()}">
<script src="${rootURL}/plugin/customizable-header/js/bundles/app-nav.js" type="text/javascript"></script>
</j:if>
<script src="${resURL}/jsbundles/keyboard-shortcuts.js" type="text/javascript"></script>
</j:if>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<st:include page="headerContent" class="jenkins.views.JenkinsHeader"/>
<j:jelly xmlns:j="jelly:core" xmlns:h="/lib/layout/header">

<header id="page-header" class="page-header">
<h:logo/>
<h:searchbox/>
<h:login/>
</header>

<j:if test="${it.systemMessage != ''}">
<div class="alert alert-${it.systemMessageColor} custom-header__system-message-header">
<j:out value="${it.systemMessage}"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:h="/lib/layout/header">
<template id="custom-header-icons">
<l:icon id="external-link" src="symbol-open-outline plugin-ionicons-api" class="icon-xs"/>
</template>
<header id="header" class="page-header custom-header__page">
<header id="page-header" class="page-header custom-header__page">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted to match core as jenkinsci/jenkins#7569 was going to use it, although I removed the hard dependency on it there in jenkinsci/jenkins@6092031 there is at least one other reference to it

<j:if test="${it.hasLinks()}">
<div class="custom-header__app-nav">
<button class="custom-header__app-nav-button" data-href="${rootURL}/customizable-header/getLinks">
Expand All @@ -21,63 +21,8 @@
<j:out value="${it.title}"/>
</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:icon src="symbol-search"/>
</span>
<a href="${searchHelpUrl}" class="main-search__icon-trailing">
<l:icon src="symbol-help-circle"/>
</a>

<div id="search-box-completion" data-search-url="${searchURL}"/>
<st:adjunct includes="jenkins.views.JenkinsHeader.search-box"/>
</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">
<l:icon src="symbol-person-circle" class="icon-md"/>
<span class="hidden-xs hidden-sm">${userName}</span>
</a>
<j:if test="${app.securityRealm.canLogOut()}">
<a href="${rootURL}/logout">
<l:icon src="symbol-log-out" class="icon-md"/>
<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>
<h:searchbox/>
<h:login/>
</header>
<j:if test="${it.systemMessage != ''}">
<div class="alert alert-${it.systemMessageColor} custom-header__system-message-header">
Expand Down