@DisableDelete WIP

This commit is contained in:
Francesco
2023-10-06 12:46:11 +02:00
parent 5fdf7e18e7
commit 7e7089ea72
9 changed files with 153 additions and 5 deletions

View File

@@ -5,14 +5,15 @@
<tr th:fragment="data_row(row, selectable)" class="table-data-row">
<td th:if=${selectable} class="table-checkbox">
<input type="checkbox" class="form-check-input" name="ids"
th:value="${row.getPrimaryKeyValue()}" form="multi-delete-form">
th:value="${row.getPrimaryKeyValue()}" form="multi-delete-form"
th:classAppend="|${!schema.isDeleteEnabled() ? 'disable' : ''}|">
</td>
<td class="text-center row-icons">
<a class="ps-1" th:href="|/${baseUrl}/model/${schema.getJavaClass().getName()}/edit/${row.getPrimaryKeyValue()}|">
<i class="bi bi-pencil-square"></i></a>
<form class="delete-form" method="POST"
th:action="|/${baseUrl}/model/${schema.getJavaClass().getName()}/delete/${row.getPrimaryKeyValue()}|">
<button><i class="bi bi-trash"></i></button>
<button th:class="|${!schema.isDeleteEnabled() ? 'disable' : ''}|"><i class="bi bi-trash"></i></button>
</form>
</td>
<td th:each="field : ${schema.getSortedFields()}"

View File

@@ -19,7 +19,9 @@
</a>
</th:block>
</th:block>
<div class="table-selectable table-responsive" th:fragment="table(results, schema)">
<div class="table-selectable table-responsive" th:fragment="table(results, schema)"
th:data-deleteenabled="${schema.isDeleteEnabled()}"
th:data-editenabled="${schema.isEditEnabled()}">
<div th:if="${results.isEmpty()}">
<p>This table contains no data.</p>
</div>
@@ -30,7 +32,8 @@
</nav>
<table class="table table-striped align-middle mt-3">
<tr class="table-data-row">
<th class="table-checkbox"><input type="checkbox" class="form-check-input check-all"></th>
<th class="table-checkbox"><input type="checkbox" class="form-check-input check-all"
th:classAppend="|${!schema.isDeleteEnabled() ? 'disable' : ''}|"></th>
<th></th>
<th class="table-data-row" th:each="field : ${schema.getSortedFields()}">
<div class="m-0 p-0 d-flex justify-content-between">