From 5baf1be02def138708f3c4f83a8c19618d5d8d43 Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 7 Oct 2021 22:29:18 +0100 Subject: [PATCH] Add toggle switch, add title --- .../jenkins/model/Jenkins/configure.jelly | 5 ++ .../resources/lib/form/toggleSwitch.jelly | 87 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 core/src/main/resources/lib/form/toggleSwitch.jelly diff --git a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly index 444b2bef4c84..fb961fd258a3 100644 --- a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly +++ b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly @@ -31,6 +31,11 @@ THE SOFTWARE. +
+
+

Configure System

+
+
${%LOADING}
diff --git a/core/src/main/resources/lib/form/toggleSwitch.jelly b/core/src/main/resources/lib/form/toggleSwitch.jelly new file mode 100644 index 000000000000..137f96aea4a0 --- /dev/null +++ b/core/src/main/resources/lib/form/toggleSwitch.jelly @@ -0,0 +1,87 @@ + + + + + + <input type="checkbox"> tag that takes true/false for @checked, which is more Jelly friendly. + + + + + + Normally, the submitted JSON will be boolean indicating whether the checkbox was checked or not. + This is sometimes inconvenient if you have a UI that lets user select a subset of a set. + If this attribute is present, the submitted JSON will have this as a string value if the checkbox is checked, + and none otherwise, making the subset selection easier. + + + The default value of the check box, in case both @checked and @instance are null. + If this attribute is unspecified or null, it defaults to unchecked, otherwise checked. + + + + + + + If set to true, this will take precedence over the onclick attribute and prevent the state of the checkbox from being changed. + + Note: if you want an actual read only checkbox then add: + <j:set var="readOnlyMode" value="true"/> inside your entry tag + See https://www.jenkins.io/doc/developer/views/read-only/#enabling-read-only-view-support + + + Used for databinding. TBD. + + + If specified, this human readable text will follow the checkbox, and clicking this text also + toggles the checkbox. + + + Used as tooltip of the checkbox, and, if a title is specified, of the title + + + + + + + + + + + + ${attrs.description} + + + \ No newline at end of file