Skip to content

Commit

Permalink
Merge pull request #771 from imod/dropdownDescriptorSelector-defaulti…
Browse files Browse the repository at this point in the history
…ng-to-instance

[FIXED JENKINS-17858] allow <f:dropdownDescriptorSelector> to be defaulting to an instance
  • Loading branch information
olamy committed May 6, 2013
2 parents 4627ec9 + 961f691 commit 1182fe4
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 1182fe4

Please sign in to comment.