Add support for duplicating assets
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
<td>
|
||||
<a th:href="'/view/'+${a.getQr()}">View</a>
|
||||
<a th:href="'/edit/'+${a.getQr()}">Edit</a>
|
||||
<a th:href="'/duplicate/'+${a.getQr()}">Duplicate</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
|
||||
<div th:fragment="content">
|
||||
<h2>Create a <span th:text="${descriptor.displayName}"></span></h2>
|
||||
<form th:action="'/'+${action}+'/'+${asset != null ? asset.getQr() : descriptor.getType()}" method="post">
|
||||
<form th:action="'/'+${(action == 'duplicate') ? 'create' : action}+'/'+${(asset != null && action != 'duplicate') ? asset.getQr() : descriptor.getType()}" method="post">
|
||||
<div th:each="d : ${descriptors}">
|
||||
<h2 th:text="${d.displayName}"></h2>
|
||||
<table border="1" cellpadding="4">
|
||||
@@ -17,7 +17,7 @@
|
||||
<input type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
|
||||
</span>
|
||||
<input th:case="STRING" type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" 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:value="${p.getValue(asset)}" th:required="${p.required}"/>
|
||||
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${(p.name == 'qr' && action == 'duplicate') ? null : p.getValue(asset)}" th:required="${p.required}"/>
|
||||
<!-- <input th:case="BOOLEAN" type="checkbox" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="true" th:checked="${asset != null ? p.getValue(asset) : p.defaultValue}"/>-->
|
||||
<span th:case="BOOLEAN">
|
||||
<input th:name="${d.asString(p)}" th:id="${d.asString(p)}+'-null'" type="radio" value="null" th:checked="${asset == null || (p.getValue(asset) == null)}">
|
||||
@@ -50,7 +50,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<p>
|
||||
<input th:if="${action == 'create'}" type="submit" value="Create">
|
||||
<input th:if="${action == 'create' || action == 'duplicate'}" type="submit" value="Create">
|
||||
<input th:if="${action == 'edit'}" type="submit" value="Save Changes">
|
||||
</p>
|
||||
</form>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<ul th:if="${action == 'view'}">
|
||||
<li><a th:href="'/edit/'+${asset.getQr()}">Edit</a></li>
|
||||
<li><a th:href="'/delete/'+${asset.getQr()}">Delete</a></li>
|
||||
<li><a th:href="'/create/'+${asset.getAsset().type}">Create another <span th:text="${descriptor.displayName}">Hard Drive</span> </a></li>
|
||||
<li><a th:href="'/create/'+${asset.getAsset().type}">Create another <span th:text="${descriptor.displayName}">Hard Drive</span></a></li>
|
||||
<li><a th:href="'/duplicate/'+${asset.getQr()}">Duplicate this <span th:text="${descriptor.displayName}">Hard Drive</span></a></li>
|
||||
<li><a th:href="'/browse/'+${descriptor.type}">Browse all <span th:text="${descriptor.pluralName}">Hard Drives</span></a></li>
|
||||
</ul>
|
||||
<ul th:if="${action == 'delete'}">
|
||||
|
||||
Reference in New Issue
Block a user