ordered label fields

master
Josha von Gizycki 2 weeks ago
parent c83b11d558
commit 19d9ed1da9

@ -23,6 +23,9 @@ data class Document(
val labelFields: Set<LabelField> = emptySet(), val labelFields: Set<LabelField> = emptySet(),
val dateFields: Set<DateField> = emptySet(), val dateFields: Set<DateField> = emptySet(),
) { ) {
fun labelFieldsSorted() =
labelFields.sortedBy { it.order }
fun withLabel(field: LabelField) = fun withLabel(field: LabelField) =
copy( copy(
labelFields = labelFields + field, labelFields = labelFields + field,

@ -63,7 +63,7 @@
</a> </a>
</h3> </h3>
<dl> <dl>
<th:block th:each="field : ${document.labelFields}"> <th:block th:each="field : ${document.labelFieldsSorted()}">
<dt> <dt>
<th:block th:text="${field.name}" /> <th:block th:text="${field.name}" />
<form class="form-inline" th:action="@{/document/{id}/field/label/delete(id=${document.id})}" method="post"> <form class="form-inline" th:action="@{/document/{id}/field/label/delete(id=${document.id})}" method="post">

Loading…
Cancel
Save