forked from jenkinsci/design-library-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jelly
More file actions
224 lines (215 loc) · 9.53 KB
/
index.jelly
File metadata and controls
224 lines (215 loc) · 9.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:s="/lib/samples" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<s:layout>
<s:section title="Alerts">
<s:group>
<s:preview>
<dialog class="jenkins-dialog">
<div class="jenkins-dialog__title">Example alert</div>
<div class="jenkins-dialog__contents">I'm an example of an error alert.</div>
<div class="jenkins-buttons-row jenkins-buttons-row--equal-width jenkins-dialog__buttons">
<button data-id="ok" type="button"
class="jenkins-button jenkins-button--primary jenkins-!-destructive-color">OK
</button>
<button data-id="cancel" class="jenkins-button" style="display: none;">Cancel</button>
</div>
</dialog>
</s:preview>
<s:code language="java" file="alert.js" callback="showAlert"/>
</s:group>
<p class="jdl-paragraph">${%alerts}</p>
</s:section>
<s:section title="${%Prompts}">
<s:group>
<s:preview>
<dialog class="jenkins-dialog">
<div class="jenkins-dialog__title">Welcome to the Dialog demo</div>
<div class="jenkins-dialog__contents">How should I call you?</div>
<div class="jenkins-dialog__input">
<input data-id="input" type="text" class="jenkins-input"/>
</div>
<div class="jenkins-buttons-row jenkins-buttons-row--equal-width jenkins-dialog__buttons">
<button data-id="ok" type="button" class="jenkins-button jenkins-button--primary " disabled="">OK</button>
<button data-id="cancel" class="jenkins-button">Cancel</button>
</div>
</dialog>
</s:preview>
<s:code language="java" file="prompt.js" callback="showPrompt"/>
</s:group>
<p class="jdl-paragraph">${%prompts}</p>
</s:section>
<s:section title="${%Confirmations}">
<s:group>
<s:preview>
<dialog class="jenkins-dialog" open="" style="max-width: 475px; min-width: 450px;">
<div class="jenkins-dialog__title">Do it</div>
<div class="jenkins-dialog__contents">Are you sure?</div>
<div class="jenkins-buttons-row jenkins-buttons-row--equal-width jenkins-dialog__buttons">
<button data-id="ok" type="button" class="jenkins-button jenkins-button--primary ">Yes</button>
<button data-id="cancel" class="jenkins-button">No</button>
</div>
</dialog>
</s:preview>
<s:code language="java" file="confirm.js" code="showConfirm()" callback="showConfirm"/>
</s:group>
<p class="jdl-paragraph">${%confirmations}</p>
</s:section>
<s:section title="${%Modals}">
<s:group>
<s:preview>
<dialog class="jenkins-dialog" open="" style="max-width: 550px; min-width: 450px;">
<div class="jenkins-dialog__title">Modal</div>
<div class="jenkins-dialog__contents jenkins-dialog__contents--modal">
<div>
<h2 class="jenkins-dialog__subtitle">Behaviour</h2>
Click on the "X" in the top right or outside to close me.
<h2 class="jenkins-dialog__subtitle jenkins-!-margin-top-3">You can include icons</h2>
<svg class="icon-sm" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 512 512">
<title></title>
<path
d="M408 64H104a56.16 56.16 0 00-56 56v192a56.16 56.16 0 0056 56h40v80l93.72-78.14a8 8 0 015.13-1.86H408a56.16 56.16 0 0056-56V120a56.16 56.16 0 00-56-56z"
fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"></path>
</svg>
Dialogs are cool.
</div>
</div>
<button class="jenkins-dialog__close-button jenkins-button">
<span class="jenkins-visually-hidden">Close</span>
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"
d="M368 368L144 144M368 144L144 368"></path>
</svg>
</button>
</dialog>
</s:preview>
<s:code-panes>
<s:code-pane title="JavaScript">
<s:code language="java" file="modal.js" code="showModal()" callback="showModal"/>
</s:code-pane>
<s:code-pane title="Jelly">
<s:code file="modal.jelly"/>
</s:code-pane>
</s:code-panes>
</s:group>
<p class="jdl-paragraph">${%modals}</p>
</s:section>
<s:section title="${%Forms}">
<s:group>
<s:preview>
<dialog class="jenkins-dialog" style="max-width: 900px; min-width: 600px;" open="">
<div class="jenkins-dialog__title">Order your ice cream</div>
<div class="jenkins-dialog__contents">
<div width="100%">
<f:entry title="${%Name}">
<f:textbox name="name"/>
</f:entry>
<f:entry title="${%Quantity}">
<f:number name="quantity" min="1" max="9"/>
</f:entry>
<f:entry title="${%Choose flavor}" class="jdl-dialog-form--last">
<f:select field="flavor"/>
</f:entry>
</div>
<div class="jenkins-buttons-row jenkins-buttons-row--equal-width jenkins-dialog__buttons">
<button data-id="ok" type="submit" class="jenkins-button jenkins-button--primary ">Order</button>
<button data-id="cancel" class="jenkins-button">Cancel</button>
</div>
</div>
</dialog>
</s:preview>
<s:code-panes>
<s:code-pane title="JavaScript">
<s:code language="java" file="form.js" code="showForm()" callback="showForm"/>
</s:code-pane>
<s:code-pane title="Jelly">
<s:code file="form.jelly"/>
</s:code-pane>
</s:code-panes>
</s:group>
<f:toggleSwitch id="formsubmit" checkedTitle="${%Submit form}" checked="true"
title="${%Handle form in javascript}."
/>
<p class="jdl-paragraph">${%forms}</p>
</s:section>
<template id="demo-template" data-title="${%Modal}">
<div>
<h2 class="jenkins-dialog__subtitle">${%Behaviour}</h2>
${%closeme}
<h2 class="jenkins-dialog__subtitle jenkins-!-margin-top-3">${%You can include icons}</h2>
<l:icon src="symbol-chatbox-outline plugin-ionicons-api" class="icon-sm"/>
${%Dialogs are cool}.
</div>
</template>
<div id="demo-form" class="jenkins-hidden" data-title="${%Order your ice cream}">
<f:form action="form" method="post">
<f:entry title="${%Name}">
<f:textbox name="name"/>
</f:entry>
<f:entry title="${%Quantity}">
<f:number name="quantity" min="1" max="9" default="1"/>
</f:entry>
<f:entry title="${%Choose flavor}">
<f:select field="flavor"/>
</f:entry>
</f:form>
</div>
<s:section title="Customizing the appearance and behaviour">
<div class="jdl-paragraph">All dialogs take a second optional parameter with options that allow to change certain
aspects.
</div>
<ul class="jdl-list">
<li><code>message</code>: Adds a message to the dialog
</li>
<li><code>okText</code>: Adjust the text of the OK button, the default depends on the type of dialog
</li>
<li><code>cancelText</code>: Adjust the text of the Cancel button, defaults to
<code>Cancel</code>
</li>
<li><code>type</code>: Change the color of the <code>OK</code> button. Allowed values:
<code>destructive</code>
</li>
<li><code>minWidth</code>: Set the minimum width of the dialog, the default depends on the type of dialog
</li>
<li><code>maxWidth</code>: Set the maximum width of the dialog, defaults to
<code>475px</code>
</li>
<li><code>hideCloseButton</code>: Hides the close button in modal dialogs, defaults to
<code>false</code>
</li>
<li><code>allowEmpty</code>: When set to <code>false</code> the <code>OK</code> button will be disabled in the
prompt dialog as long as the input field is empty or contains only whitespace, defaults to
<code>false</code>
</li>
<li><code>submitButton</code>: Change the behaviour of the submit button in a form dialog. When
<code>true</code>
the form will be submitted to the <code>action</code> attribute of the form. When <code>false</code>, a
<code>FormData</code>
object is passed to the <code>resolve</code> method of the <code>Promise</code>.
Defaults to
<code>true</code>
</li>
</ul>
</s:section>
<s:section title="${%OK Button texts}">
<div class="jdl-paragraph">${%buttontexts}</div>
<ul class="jdl-list">
<li><code>ok</code>: OK
</li>
<li><code>cancel</code>: Cancel
</li>
<li><code>yes</code>: Yes
</li>
<li><code>no</code>: No
</li>
<li><code>add</code>: Add
</li>
<li><code>save</code>: Save
</li>
<li><code>apply</code>: Apply
</li>
<li><code>submit</code>: Submit
</li>
</ul>
</s:section>
</s:layout>
</j:jelly>