Skip to content

Commit 2b1a5d4

Browse files
authored
Merge branch 'master' into ServletException
2 parents 17e452e + a765226 commit 2b1a5d4

File tree

9 files changed

+29
-47
lines changed

9 files changed

+29
-47
lines changed

core/src/main/resources/jenkins/model/Jenkins/configure.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE SOFTWARE.
2929
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
3030
<l:layout permissions="${app.MANAGE_AND_SYSTEM_READ}" title="${%System}" type="one-column">
3131
<st:include page="sidepanel.jelly" />
32-
<l:breadcrumb title="${%System}" />
32+
<f:breadcrumb-config-outline title="${%System}" />
3333

3434
<l:main-panel>
3535
<j:set var="readOnlyMode" value="${!h.hasPermission(app.MANAGE)}"/>

core/src/main/resources/lib/form/breadcrumb-config-outline.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ THE SOFTWARE.
3232
</st:attribute>
3333
</st:documentation>
3434

35-
<l:breadcrumb title="${attrs.title?:'%configuration'}" id="inpage-nav" />
35+
<l:breadcrumb title="${attrs.title?:'%configuration'}" id="inpage-nav" hasMenu="true" />
3636
</j:jelly>

core/src/main/resources/lib/layout/breadcrumb.jelly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ THE SOFTWARE.
4848

4949
<j:if test="${mode=='breadcrumbs'}">
5050
<j:set var="hasLink" value="${attrs.href != null}" />
51-
<li id="${attrs.id}" class="jenkins-breadcrumbs__list-item" data-type="breadcrumb-item" aria-current="${hasLink ? null : 'page'}">
51+
<li id="${attrs.id}" class="jenkins-breadcrumbs__list-item" data-type="breadcrumb-item" aria-current="${hasLink ? null : 'page'}" data-has-menu="${attrs.hasMenu}">
5252
<j:choose>
5353
<j:when test="${!hasLink}">
54-
<span>${attrs.title}</span>
54+
<span class="${attrs.hasMenu ? 'hoverable-model-link' : ''}">${attrs.title}</span>
5555
</j:when>
5656
<j:otherwise>
5757
<a href="${attrs.href}" class="${attrs.hasMenu ? 'hoverable-model-link' : ''} ${attrs.hasChildrenMenu ? 'hoverable-children-model-link' : ''}">

src/main/js/components/dropdowns/autocomplete.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ function init() {
9393
0,
9494
function (e) {
9595
e.setAttribute("autocomplete", "off");
96-
e.dataset["hideOnClick"] = "false";
9796
// form field with auto-completion support
9897
e.style.position = "relative";
9998
// otherwise menu won't hide on tab with nothing selected

src/main/js/components/dropdowns/inpage-jumplist.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ import { toId } from "@/util/dom";
55
* sections on the page (if using <f:breadcrumb-config-outline />)
66
*/
77
function init() {
8-
const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav");
8+
const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav span");
99

1010
if (inpageNavigationBreadcrumb) {
11-
const chevron = document.createElement("li");
12-
chevron.classList.add("children");
13-
chevron.items = Array.from(
11+
inpageNavigationBreadcrumb.items = Array.from(
1412
document.querySelectorAll(
1513
"form > div > .jenkins-section > .jenkins-section__title",
1614
),
1715
).map((section) => {
1816
section.id = toId(section.textContent);
1917
return { label: section.textContent, url: "#" + section.id };
2018
});
21-
22-
inpageNavigationBreadcrumb.after(chevron);
2319
}
2420
}
2521

src/main/js/components/dropdowns/jumplists.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function generateDropdowns() {
3838
Utils.generateDropdown(
3939
element,
4040
(instance) => {
41-
const href = element.href;
42-
4341
if (element.items) {
4442
instance.setContent(Utils.generateDropdownItems(element.items));
4543
return;
4644
}
4745

46+
const href = element.href;
47+
4848
const hasModelLink = element.classList.contains(
4949
"hoverable-model-link",
5050
);
@@ -105,7 +105,7 @@ function generateDropdowns() {
105105
instance.loaded = true;
106106
});
107107
},
108-
false,
108+
element.items != null,
109109
{
110110
trigger: "mouseenter",
111111
offset: [-16, 10],

src/main/js/components/dropdowns/utils.js

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,25 @@ function generateDropdown(element, callback, immediate, options = {}) {
2222
{},
2323
Templates.dropdown(),
2424
{
25-
hideOnClick:
26-
element.dataset["hideOnClick"] !== "false" ? "toggle" : false,
2725
onCreate(instance) {
2826
const onload = () => {
2927
if (instance.loaded) {
3028
return;
3129
}
3230

3331
document.addEventListener("click", (event) => {
34-
const isClickInAnyDropdown =
35-
!!event.target.closest("[data-tippy-root]");
3632
const isClickOnReference = instance.reference.contains(
3733
event.target,
3834
);
35+
// Don't close the dropdown if the user is interacting with a SELECT menu inside of it
36+
const isSelect = event.target.tagName === "SELECT";
3937

40-
if (!isClickInAnyDropdown && !isClickOnReference) {
38+
if (!isClickOnReference && !isSelect) {
39+
instance.clickToHide = true;
4140
instance.hide();
4241
}
4342
});
4443

45-
instance.popper.addEventListener("mouseenter", () => {
46-
const handleMouseMove = () => {
47-
const dropdowns =
48-
document.querySelectorAll("[data-tippy-root]");
49-
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
50-
(dropdown) => dropdown.matches(":hover"),
51-
);
52-
53-
if (!isMouseOverAnyDropdown) {
54-
instance.hide();
55-
document.removeEventListener("mousemove", handleMouseMove);
56-
}
57-
};
58-
59-
document.addEventListener("mousemove", handleMouseMove);
60-
});
61-
6244
callback(instance);
6345
};
6446
if (immediate) {
@@ -69,13 +51,21 @@ function generateDropdown(element, callback, immediate, options = {}) {
6951
});
7052
}
7153
},
72-
onHide() {
73-
const dropdowns = document.querySelectorAll("[data-tippy-root]");
74-
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
75-
(dropdown) => dropdown.matches(":hover"),
76-
);
54+
onHide(instance) {
55+
if (
56+
instance.props.trigger === "mouseenter" &&
57+
!instance.clickToHide
58+
) {
59+
const dropdowns = document.querySelectorAll("[data-tippy-root]");
60+
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
61+
(dropdown) => dropdown.matches(":hover"),
62+
);
63+
64+
return !isMouseOverAnyDropdown;
65+
}
7766

78-
return !isMouseOverAnyDropdown;
67+
instance.clickToHide = false;
68+
return true;
7969
},
8070
},
8171
options,

src/main/js/util/jenkins.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ var jenkins = {};
1010

1111
// gets the base Jenkins URL including context path
1212
jenkins.baseUrl = function () {
13-
var u = $("head").attr("data-rooturl");
14-
if (!u) {
15-
u = "";
16-
}
17-
return u;
13+
return document.head.dataset.rooturl;
1814
};
1915

2016
/**

src/main/scss/base/_core.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ html {
33
box-sizing: border-box;
44
-webkit-tap-highlight-color: transparent;
55
color: var(--text-color);
6+
scroll-padding-top: calc(var(--header-height) + var(--section-padding));
67
}
78

89
body {

0 commit comments

Comments
 (0)