This commit is contained in:
40
src/main/resources/templates/create_asset.html
Normal file
40
src/main/resources/templates/create_asset.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<body th:replace="fragments :: base(title='Select type to create', content=~{::content})">
|
||||
<div th:fragment="content">
|
||||
Create a <span th:text="${descriptor.displayName}"></span>
|
||||
<form th:action="'/asset/'+${descriptor.getType()}" method="post">
|
||||
<div th:each="d : ${descriptors}">
|
||||
<h2 th:text="${d.displayName}"></h2>
|
||||
<table border="1">
|
||||
<tr th:each="p : ${d.getProperties()}">
|
||||
<td><label th:text="${p.displayName}" th:for="${d.asString(p)}"></label></td>
|
||||
<td th:switch="${p.type.nameOrEnum()}">
|
||||
<input th:case="STRING" type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
|
||||
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:required="${p.required}"/>
|
||||
<select th:case="enum" th:id="${d.asString(p)}" th:name="${d.asString(p)}">
|
||||
<option th:each="o : ${p.options}" th:value="${o.value}" th:text="${o.displayName}" th:selected="${o.defaultValue}">Good</option>
|
||||
</select>
|
||||
<span th:case="CAPACITY">
|
||||
<input type="number" th:id="${d.asString(p)+'-value'}" th:name="${d.asString(p)+'-value'}" th:required="${p.required}"/>
|
||||
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
|
||||
<option value="1">Bytes</option>
|
||||
<option th:if="${p.capacityAsSI}" value="1000">kB</option>
|
||||
<option th:if="${p.capacityAsIEC}" value="1024">KiB</option>
|
||||
<option th:if="${p.capacityAsSI}" value="1000000">MB</option>
|
||||
<option th:if="${p.capacityAsIEC}" value="1048576">MiB</option>
|
||||
<option th:if="${p.capacityAsSI}" value="1000000000">GB</option>
|
||||
<option th:if="${p.capacityAsIEC}" value="1073741824">GiB</option>
|
||||
<option th:if="${p.capacityAsSI}" value="1000000000000">TB</option>
|
||||
<option th:if="${p.capacityAsIEC}" value="1099511627776">TiB</option>
|
||||
</select>
|
||||
</span>
|
||||
<b th:case="*">Bad input type for <span th:text="${d.type}+'-'+${p.type}"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p>
|
||||
<input type="submit" value="Create">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
Reference in New Issue
Block a user