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

Update form bottom button bar appearance #6295

Merged
merged 25 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01c6de0
Squashed commit of the following:
janfaracik Feb 7, 2022
61c6b4e
Undo form changes
janfaracik Feb 7, 2022
7532463
Delete checkboxes.jelly
janfaracik Feb 7, 2022
cd67881
Move draggable card to
janfaracik Feb 7, 2022
ead06c8
Update toggle-switch.less
janfaracik Feb 7, 2022
c4bd3ae
Update style.less
janfaracik Feb 7, 2022
366bc77
Update layout.less
janfaracik Feb 7, 2022
de79fde
Update colours, add variables
janfaracik Feb 8, 2022
b904987
Update codemirror.less
janfaracik Feb 8, 2022
c1c25f0
Fix log recorder
janfaracik Feb 8, 2022
d42d67b
Update style.less
janfaracik Feb 8, 2022
65ae954
Update style.less
janfaracik Feb 10, 2022
7304741
Add files from future pr
janfaracik Feb 10, 2022
682922d
Update bottomButtonBar.jelly
janfaracik Feb 10, 2022
12db36b
Update style.less
janfaracik Feb 10, 2022
6f2c0e4
Update style.less
janfaracik Feb 10, 2022
32e6cc6
Update hudson-behavior.js
janfaracik Feb 10, 2022
fd7f6aa
Add form class, fix table width
janfaracik Feb 10, 2022
02970f5
Merge branch 'master' into update-forms-1.6-new-bottom-bar
janfaracik Feb 10, 2022
d33d824
Merge branch 'master' into update-forms-1.6-new-bottom-bar
janfaracik Feb 12, 2022
6c68564
Merge branch 'master' into update-forms-1.6-new-bottom-bar
janfaracik Feb 16, 2022
08ccf7a
Update layout.less
janfaracik Feb 16, 2022
990dd0f
Merge branch 'master' into update-forms-1.6-new-bottom-bar
janfaracik Feb 21, 2022
b3a5742
Fix table positioning on job page
janfaracik Feb 21, 2022
f371e20
Fix table tooltip in Chrome
janfaracik Feb 21, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ l.layout(permission:app.SYSTEM_READ, title:my.displayName, cssclass:request.getP
div(class:"behavior-loading") {
l.spinner(text: _("LOADING"))
}
f.form(method:"post",name:"config",action:"configure") {
f.form(method:"post",name:"config",action:"configure", class: "jenkins-form") {
set("instance",my)
set("descriptor", my.descriptor)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ l.layout(norefresh:true, permission:app.SYSTEM_READ, title:my.displayName) {
l.spinner(text: _("LOADING"))
}

f.form(method:"post",name:"config",action:"configure") {
f.form(method:"post",name:"config",action:"configure", class: "jenkins-form") {
f.block {
if (app.clouds.size() == 0 && !h.hasPermission(app.ADMINISTER)) {
p(_("No clouds have been configured."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ l.layout(permission:app.SYSTEM_READ, title:my.displayName) {
l.spinner(text: _("LOADING"))
}

f.form(method:"post",name:"config",action:"configure") {
f.form(method:"post",name:"config",action:"configure", class: "jenkins-form") {
Copy link
Member

Choose a reason for hiding this comment

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

What happens to forms in plugins that do not have this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The bottom bar fills the width of the page rather than ends at the width of the form, so nothing major just the shadow is wider than it should be.

Copy link
Member

@daniel-beck daniel-beck Feb 24, 2022

Choose a reason for hiding this comment

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

Why isn't every f:form a jenkins-form? Why does this need to be copied & pasted into every f:form?

Functions.getSortedDescriptorsForGlobalConfigByDescriptor(my.FILTER).each { Descriptor descriptor ->
set("descriptor",descriptor)
set("instance",descriptor)
Expand Down
12 changes: 5 additions & 7 deletions core/src/main/resources/lib/form/bottomButtonBar.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ THE SOFTWARE.
<st:documentation>
Creates a button bar at the bottom of the page for things like "Submit".
The actual buttons should be specified as the body of this tag.
This area will always be visible in the bottom of the screen.
This area will always be visible at the bottom of the screen.
</st:documentation>

<f:block>
<div id="bottom-sticker" >
<div class="bottom-sticker-inner">
<d:invokeBody />
</div>
<div id="bottom-sticker">
<div class="bottom-sticker-inner">
<d:invokeBody />
</div>
</f:block>
</div>
</j:jelly>
2 changes: 0 additions & 2 deletions core/src/main/resources/lib/form/password/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,5 @@ Behaviour.specify('.hidden-password', 'hidden-password-button', 0, function (e)
e.querySelector('.hidden-password-field').setAttribute('type', 'password');
e.querySelector('.hidden-password-placeholder').remove();
secretUpdateBtn.remove();
// fix UI bug when DOM changes
Event.fire(window, 'jenkins:bottom-sticker-adjust');
};
});
2 changes: 0 additions & 2 deletions core/src/main/resources/lib/form/secretTextarea/secret.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,5 @@ Behaviour.specify('.secret', 'secret-button', 0, function (e) {
clearSecretValue();
replaceUpdateButton();
removeSecretLegendLabel();
// fix UI bug when DOM changes
Event.fire(window, 'jenkins:bottom-sticker-adjust');
};
});
5 changes: 0 additions & 5 deletions war/src/main/js/util/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ function breadcrumbBarHeight() {
return elementHeight('#breadcrumbBar');
}

function fireBottomStickerAdjustEvent() {
Event.fire(window, 'jenkins:bottom-sticker-adjust'); // jshint ignore:line
}

function removeTextHighlighting(selector) {
$('span.highlight-split', selector).each(function() {
var highlightSplit = $(this);
Expand All @@ -70,6 +66,5 @@ export default {
onWinScroll,
pageHeaderHeight,
breadcrumbBarHeight,
fireBottomStickerAdjustEvent,
removeTextHighlighting
}
2 changes: 0 additions & 2 deletions war/src/main/less/abstracts/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@
--light-bg-color--hover: rgba(255, 255, 255, 0.65);
--add-item-btn-decorator-border-color: #acb;
--add-item-btn-decorator-bg-color: rgba(245, 249, 239, 0.75);
--configure-job-bottom-sticker-bg-color: rgba(245, 249, 239, 0.75);
--configure-job-bottom-sticker-border-color: var(--line-green);

// Plugin manager
--plugin-manager-bg-color-already-upgraded: var(--light-grey);
Expand Down
55 changes: 50 additions & 5 deletions war/src/main/less/base/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -467,25 +467,70 @@ div.behavior-loading {

.bottom-sticker,
#bottom-sticker {
width: 100%; /* it needs to occupy the entire width or else the underlying content will see through */
z-index: 999;
position: sticky;
// This has to be set to -1px so that IntersectionObserver can add the
// &--stuck class when the element is stuck to the bottom of the screen
// https://css-tricks.com/how-to-detect-when-a-sticky-element-gets-pinned/
bottom: -1px;
margin-left: -2rem;
width: calc(100% + 4rem); /* it needs to occupy the entire width or else the underlying content will see through */
z-index: 999;
}

.bottom-sticker-inner {
position: relative;
padding: 1em 0;
padding: 1em 2rem;
z-index: 0;

&::before {
content: "";
position: absolute;
top: 0;
left: calc(-2rem - 2px);
left: 0;
bottom: 0;
right: 0;
background: var(--background);
opacity: 0;
z-index: -1;
}

&::after {
content: "";
position: absolute;
top: -30px;
left: 0;
right: 0;
background: linear-gradient(rgba(black, 0), rgba(#555566, 0.075) 110%);
max-width: 100%;
height: 30px;
opacity: 0;
transition: var(--standard-transition);
mask-image: linear-gradient(to right, transparent, white 2rem, white calc(100% - 2rem), transparent);
pointer-events: none;
}

&--stuck {
.bottom-sticker-inner {
backdrop-filter: blur(15px);

&::before {
opacity: 0.75 !important;

@supports not (backdrop-filter: blur(15px)) {
opacity: 1 !important;
}
}

&::after {
opacity: 1 !important;
}
}
}

.yui-button {
margin-left: 0;
margin-right: 0.5rem;
}
}

.top-sticker,
Expand Down Expand Up @@ -741,7 +786,7 @@ table.parameters > tbody:hover {

table {
border-radius: 0;
min-width: 450px;
width: 450px;
margin-bottom: 0;
box-sizing: content-box;
padding-bottom: 2px;
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/less/form/layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

&--monospace {
font-family: monospace;
font-family: var(--font-family-mono);
}
}

Expand Down
2 changes: 1 addition & 1 deletion war/src/main/less/modules/panes-and-bigtable.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ table.bigtable {
}

// Keep this for tables still wrapped by .pane-frame
.pane-frame table,
.pane-frame table:not(.jenkins-table),
.pane-frame .bigtable tr {
border: none; /* Border will be provided by the pane-frame */
}
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/less/modules/table.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.jenkins-table {
--table-padding: 0.55rem;

width: calc(100% - 10px);
width: 100%;
background: var(--table-background);
border-radius: calc(var(--table-border-radius) + 2px);
border: 5px solid var(--table-background);
Expand Down
50 changes: 12 additions & 38 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -1428,44 +1428,18 @@ function rowvgStartEachRow(recursive,f) {
});
});

/*
Use on div tag to make it sticky visible on the bottom of the page.
When page scrolls it remains in the bottom of the page
Convenient on "OK" button and etc for a long form page
*/
Behaviour.specify("#bottom-sticker", "-bottom-sticker", ++p, function(sticker) {
var DOM = YAHOO.util.Dom;

var shadow = document.createElement("div");
sticker.parentNode.insertBefore(shadow,sticker);

var edge = document.createElement("div");
edge.className = "bottom-sticker-edge";
sticker.insertBefore(edge,sticker.firstElementChild);

function adjustSticker() {
shadow.style.height = sticker.offsetHeight + "px";

var viewport = DOM.getClientRegion();
var pos = DOM.getRegion(shadow);

sticker.style.position = "fixed";

var bottomPos = Math.max(0, viewport.bottom - pos.bottom);

sticker.style.bottom = bottomPos + "px"
sticker.style.left = Math.max(0,pos.left-viewport.left) + "px"
}

// react to layout change
Element.observe(window,"scroll",adjustSticker);
Element.observe(window,"resize",adjustSticker);
// initial positioning
Element.observe(window,"load",adjustSticker);
Event.observe(window, 'jenkins:bottom-sticker-adjust', adjustSticker);
adjustSticker();
layoutUpdateCallback.add(adjustSticker);
});
window.addEventListener('load', function () {
// Add a class to the bottom bar when it's stuck to the bottom of the screen
const el = document.querySelector("#bottom-sticker")
if (el) {
const observer = new IntersectionObserver(
([e]) => e.target.classList.toggle("bottom-sticker-inner--stuck", e.intersectionRatio < 1),
{threshold: [1]}
);

observer.observe(el);
}
})

Behaviour.specify("#top-sticker", "-top-sticker", ++p, function(sticker) {// legacy
this[".top-sticker"](sticker);
Expand Down