Skip to content

Commit

Permalink
Merge branch 'advanced-auto-expand-JENKINS-3107'
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Aug 27, 2013
2 parents 99f84bc + 554d0a0 commit 5c6044c
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 6 deletions.
10 changes: 10 additions & 0 deletions core/src/main/resources/lib/form/advanced.jelly
Expand Up @@ -45,12 +45,22 @@ THE SOFTWARE.
<st:adjunct includes="lib.form.advanced.advanced"/>

<div class="advancedLink" style="${attrs.align!=null?('text-align:'+attrs.align):''}">
<j:set var="id" value="${h.generateId()}"/>
<span style="display: none" id="${id}">
<img src="${imagesURL}/16x16/document_edit.png" style="vertical-align: super" alt="${%customizedFields}" tooltip="${%customizedFields}"/>
</span>
<input type="button" value="${attrs.title?:'%Advanced'}..." class="advanced-button advancedButton" /><!-- advancedButton is legacy -->
</div>
<j:new var="customizedFields" className="java.util.TreeSet"/>
<table class="advancedBody"><tbody>
<!-- this is the hidden portion that hosts the "advanced" part. Contents will be moved to the master table when "advanced..." is clicked -->
<d:invokeBody/>
</tbody></table>
<j:if test="${!customizedFields.isEmpty()}">
<script>
$$('${id}').style.display = '';
</script>
</j:if>
</td>
</tr>
</j:jelly>
23 changes: 23 additions & 0 deletions core/src/main/resources/lib/form/advanced.properties
@@ -0,0 +1,23 @@
# The MIT License
#
# Copyright 2013 Jesse Glick.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

customizedFields=One or more fields in this block have been edited.
10 changes: 8 additions & 2 deletions core/src/main/resources/lib/form/checkbox.jelly
Expand Up @@ -56,15 +56,21 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
<j:set var="name" value="${attrs.name ?: '_.'+attrs.field}"/>
<j:set var="default" value="${attrs.default ?: false}"/>
<j:set var="value" value="${attrs.checked ?: instance[attrs.field] ?: default}"/>
<input type="checkbox"
name="${attrs.name?:'_.'+attrs.field}"
name="${name}"
value="${attrs.value}"
title="${attrs.tooltip}"
onclick="${attrs.onclick}" id="${attrs.id}" class="${attrs.negative!=null ? 'negative' : null} ${attrs.checkUrl!=null?'validated':''}"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}" json="${attrs.json}"
checked="${(attrs.checked ?: instance[attrs.field] ?: attrs.default) ? 'true' : null}"/>
checked="${value ? 'true' : null}"/>
<j:if test="${attrs.title!=null}">
<label class="attach-previous"
title="${attrs.tooltip}">${attrs.title}</label>
</j:if>
<j:if test="${customizedFields != null and value != default}">
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
</j:jelly>
3 changes: 3 additions & 0 deletions core/src/main/resources/lib/form/expandableTextbox.jelly
Expand Up @@ -71,6 +71,9 @@ THE SOFTWARE.
<input class="setting-input" type="text"
name="${name}" value="${value}"
id="textarea.${name}" />
<j:if test="${customizedFields != null and (value ?: '') != ''}">
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
</td><td width="1">
<input type="button" value="&#x25BC;" onclick="expandTextArea(this,'textarea.${name}')"
tooltip="${%tooltip}"/>
Expand Down
9 changes: 7 additions & 2 deletions core/src/main/resources/lib/form/textarea.jelly
Expand Up @@ -70,7 +70,8 @@ THE SOFTWARE.
</st:documentation>

<f:prepareDatabinding />
<j:set var="value" value="${attrs.value ?: instance[attrs.field] ?: attrs.default}" />
<j:set var="default" value="${attrs.default ?: ''}"/>
<j:set var="value" value="${attrs.value ?: instance[attrs.field] ?: default}" />
<j:if test="${attrs['previewEndpoint']!=null || attrs['codemirror-mode']!=null}">
<st:adjunct includes="lib.form.textarea.textarea"/>
</j:if>
Expand All @@ -79,8 +80,9 @@ THE SOFTWARE.
org.kohsuke.stapler.codemirror.mode.${attrs['codemirror-mode']}.${attrs['codemirror-mode']},
org.kohsuke.stapler.codemirror.theme.default"/>
</j:if>
<j:set var="name" value="${attrs.name ?: '_.'+attrs.field}"/>
<textarea id="${attrs.id}" style="${attrs.style}"
name ="${attrs.name ?: '_.'+attrs.field}"
name ="${name}"
class="setting-input ${attrs.checkUrl!=null?'validated':''} ${attrs['codemirror-mode']!=null?'codemirror':''} ${attrs.class}"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}" checkMethod="${attrs.checkMethod}"
rows="${h.determineRows(value)}"
Expand All @@ -89,6 +91,9 @@ THE SOFTWARE.
codemirror-config="${attrs['codemirror-config']}">
<st:out value="${value}" />
</textarea>
<j:if test="${customizedFields != null and value != default}">
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
<!-- resize handle -->
<div class="textarea-handle"/>
<j:if test="${attrs.previewEndpoint!=null}">
Expand Down
10 changes: 8 additions & 2 deletions core/src/main/resources/lib/form/textbox.jelly
Expand Up @@ -75,10 +75,16 @@ THE SOFTWARE.
${descriptor.calcAutoCompleteSettings(autoCompleteField?:field,attrs)} <!-- this figures out the 'autoCompleteUrl' attribute -->

<!-- mostly pass-through all the attributes -->
<j:set var="name" value="${attrs.name ?: '_.'+attrs.field}"/>
<j:set var="default" value="${attrs.default ?: ''}"/>
<j:set var="value" value="${attrs.value ?: instance[attrs.field] ?: default}"/>
<m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary"
class="setting-input ${attrs.checkUrl!=null?'validated':''} ${attrs.autoCompleteUrl!=null?'auto-complete':null} ${attrs.clazz}"
name="${attrs.name ?: '_.'+attrs.field}"
value="${attrs.value ?: instance[attrs.field] ?: attrs.default}"
name="${name}"
value="${value}"
type="text"
ATTRIBUTES="${attrs}" EXCEPT="field clazz" />
<j:if test="${customizedFields != null and value != default}">
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
</j:jelly>

0 comments on commit 5c6044c

Please sign in to comment.