Use morph tag library for f:file
@@ -23,13 +23,24 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
-<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form"
+ xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary">
<st:documentation>
Generates an input field <code>&lt;input type="file" ... /></code>
+ All unknown attributes are passed through to the field.
<st:attribute name="field">
Used for databinding.
</st:attribute>
+ <st:attribute name="clazz">
+ Additional CSS class(es) to add.
+ </st:attribute>
+ <st:attribute name="name"> <![CDATA[
+ This becomes @name of the <input> tag.
+ If @field is specified, this value is inferred from it.
+ ]]>
+ </st:attribute>
+ <!-- the below fields are passed through using the morph tag library but defined here for documentation -->
<st:attribute name="jsonAware">
Enable structured form submission.
</st:attribute>
@@ -42,10 +53,9 @@ THE SOFTWARE.
<j:set var="name" value="${attrs.name ?: attrs.field}"/>
- <input name="${name}"
+ <m:input name="${name}"
type="file"
- jsonAware="${attrs.jsonAware}"
- class="jenkins-file-upload"
- accept="${attrs.accept}"
+ class="jenkins-file-upload${attrs.clazz == null ? '' : ' ' + attrs.clazz}"
+ ATTRIBUTES="${attrs}" EXCEPT="field clazz"
/>
</j:jelly>
