Skip to content

Commit

Permalink
[FIXED JENKINS-17858] allow <f:dropdownDescriptorSelector> to be defa…
Browse files Browse the repository at this point in the history
…ulting to a specifig instance
  • Loading branch information
imod committed May 5, 2013
1 parent 4e37084 commit 961f691
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -39,7 +39,8 @@ THE SOFTWARE.
If unspecified, inferred from the type of the field.
</st:attribute>
<st:attribute name="default">
If specified, this will be chosen as the default value in case the current selection is null.
If specified, this will be chosen as the default value in case the current selection is null. The default can be an specific instance or a descriptor e.g.
${descriptor.defaultSettingsProvider} or ${descriptor.defaultSettingsProvider.descriptor}. In the later case, the from input fields will be empty.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
Expand All @@ -49,6 +50,7 @@ THE SOFTWARE.
<d:invokeBody />

<j:set var="current" value="${instance[attrs.field]}"/>
<j:set var="current" value="${current!=null ? current : (default.descriptor!=null ? default : null)}"/>
<j:forEach var="descriptor" items="${attrs.descriptors}" varStatus="loop">
<f:dropdownListBlock value="${loop.index}" title="${descriptor.displayName}"
selected="${current.descriptor==descriptor || (current==null and descriptor==attrs.default)}" staplerClass="${descriptor.clazz.name}"
Expand Down

0 comments on commit 961f691

Please sign in to comment.