From 49a71d3aabf32bff8cec1cf5c0766906d5967075 Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:39:47 +0000 Subject: [PATCH] Reduce checkbox padding significantly (this was v painful) --- .../config.groovy | 27 +++++++------------ .../jenkins/model/Jenkins/configure.jelly | 2 +- .../resources/lib/form/optionalBlock.jelly | 5 ++-- core/src/main/resources/lib/form/rowSet.jelly | 7 +++-- core/src/main/resources/lib/form/section_.js | 2 -- war/src/main/less/modules/form.less | 2 +- .../main/webapp/scripts/hudson-behavior.js | 9 +++++++ 7 files changed, 26 insertions(+), 28 deletions(-) diff --git a/core/src/main/resources/jenkins/management/AdministrativeMonitorsConfiguration/config.groovy b/core/src/main/resources/jenkins/management/AdministrativeMonitorsConfiguration/config.groovy index 70b2cf800c90..931f78b3ed2f 100644 --- a/core/src/main/resources/jenkins/management/AdministrativeMonitorsConfiguration/config.groovy +++ b/core/src/main/resources/jenkins/management/AdministrativeMonitorsConfiguration/config.groovy @@ -32,23 +32,16 @@ st = namespace("jelly:stapler") f.section(title: _("Administrative monitors configuration")) { f.advanced(title: _("Administrative monitors")) { f.entry(title: _("Enabled administrative monitors")) { - p(_("blurb")) - div(width: "100%") { - for (AdministrativeMonitor am : new ArrayList<>(AdministrativeMonitor.all()) - .sort({ o1, o2 -> o1.getDisplayName() <=> o2.getDisplayName() })) { - div(class: "jenkins-checkbox-help-wrapper", style: "margin-bottom: 0.75rem;") { - f.checkbox(name: "administrativeMonitor", - title: am.displayName, - checked: am.enabled, - json: am.id) - if (am.isSecurity()) { - span(style: 'margin-left: 0.5rem', class: 'am-badge', _("Security")) - } - } - div(class: "tr") { - div(class: "setting-description") { - st.include(from: am, page: "description", optional: true) - } + p(class: "jenkins-form-description", _("blurb")) + for (AdministrativeMonitor am : new ArrayList<>(AdministrativeMonitor.all()) + .sort({ o1, o2 -> o1.getDisplayName() <=> o2.getDisplayName() })) { + div(class: "jenkins-checkbox-help-wrapper", style: "margin-bottom: 0.75rem;") { + f.checkbox(name: "administrativeMonitor", + title: am.displayName, + checked: am.enabled, + json: am.id) + if (am.isSecurity()) { + span(style: 'margin-left: 0.5rem', class: 'am-badge', _("Security")) } } } diff --git a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly index 05c95c0f7ca5..76c911903901 100644 --- a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly +++ b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly @@ -55,7 +55,7 @@ THE SOFTWARE. - + diff --git a/core/src/main/resources/lib/form/optionalBlock.jelly b/core/src/main/resources/lib/form/optionalBlock.jelly index 45d037005494..d3cd5bec93bd 100644 --- a/core/src/main/resources/lib/form/optionalBlock.jelly +++ b/core/src/main/resources/lib/form/optionalBlock.jelly @@ -66,7 +66,7 @@ THE SOFTWARE. -
+
- hello - + diff --git a/core/src/main/resources/lib/form/rowSet.jelly b/core/src/main/resources/lib/form/rowSet.jelly index 6558e243b75b..94468d70a689 100644 --- a/core/src/main/resources/lib/form/rowSet.jelly +++ b/core/src/main/resources/lib/form/rowSet.jelly @@ -35,8 +35,8 @@ THE SOFTWARE. id of the thing that serves as the group head, if that's available separately - - Classes to apply to the row set + + Removes the "jenkins-form-item" class if false @@ -46,8 +46,7 @@ THE SOFTWARE. -

asda

-
+
diff --git a/core/src/main/resources/lib/form/section_.js b/core/src/main/resources/lib/form/section_.js index ebdcc91f5d44..a0c177c24726 100644 --- a/core/src/main/resources/lib/form/section_.js +++ b/core/src/main/resources/lib/form/section_.js @@ -55,8 +55,6 @@ var section = (function (){ if (e.className == "jenkins-section__title" && isVisible(e)) { var child = new SectionNode(e); - console.log(e.className) - parent.children.push(child); // The next line seems to be unnecessary, as there are no children inside the section header itself. // So this code will always returns a flat list of section headers. diff --git a/war/src/main/less/modules/form.less b/war/src/main/less/modules/form.less index f2556c485fe4..fbcf210daa56 100644 --- a/war/src/main/less/modules/form.less +++ b/war/src/main/less/modules/form.less @@ -16,7 +16,7 @@ } &--tight + .jenkins-form-item--tight { - background: red; + margin-top: -0.9rem; } &--small { diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 5d10fa86da42..2174329378b0 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -2346,6 +2346,15 @@ var hoverNotification = (function() { }; })(); +// Decrease vertical padding for checkboxes +window.addEventListener('load', function () { + document.querySelectorAll(".jenkins-form-item").forEach(function (element) { + if (element.querySelector("input[type='checkbox']") != null && element.querySelector(".advancedLink") == null) { + element.classList.add("jenkins-form-item--tight") + } + }); +}) + /** * Loads the script specified by the URL. *