Skip to content

Commit

Permalink
Merge pull request #1926 from rsandell/rsandell-enum-default
Browse files Browse the repository at this point in the history
Added default attribute to enum.jelly
  • Loading branch information
rsandell committed Nov 30, 2015
2 parents 5b667c0 + 78bf63d commit 6641190
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/resources/lib/form/enum.jelly
Expand Up @@ -32,10 +32,13 @@ THE SOFTWARE.
<st:attribute name="field">
Used for databinding. TBD.
</st:attribute>
<st:attribute name="default">
The name of the enum to set as default value for the first configuration.
</st:attribute>
</st:documentation>
<select class="setting-input" name="${field}">
<j:forEach var="it" items="${descriptor.getPropertyType(instance,field).enumConstants}">
<f:option value="${it.name()}" selected="${it==instance[field]}">
<f:option value="${it.name()}" selected="${instance != null ? it==instance[field] : it.name()==default}">
<d:invokeBody />
</f:option>
</j:forEach>
Expand Down

0 comments on commit 6641190

Please sign in to comment.