@ReadOnly fields (#4)

This commit is contained in:
Francesco
2023-10-03 11:16:05 +02:00
parent 76a99be813
commit aeac9c10b6
4 changed files with 51 additions and 4 deletions

View File

@@ -56,6 +56,7 @@
class="form-control" th:id="|__id_${field.getName()}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
rows="5"
th:classAppend="${field.isReadOnly() && !create ? 'disable' : ''}"
></textarea>
</th:block>
<th:block th:if="${!field.isText()}">
@@ -65,7 +66,8 @@
${create ? (params != null ? params.getOrDefault(field.getName(), '') : '')
: (object != null ? object.get(field).getValue() : '' )}
"
class="form-control" th:id="|__id_${field.getName()}|"
th:class="|form-control ${field.isReadOnly() && !create ? 'disable' : ''}|"
th:id="|__id_${field.getName()}|"
th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any"
@@ -81,17 +83,21 @@
th:data-fieldname="${field.getName()}"
th:id="|__keep_${field.getName()}|"
checked
th:classAppend="${field.isReadOnly() && !create ? 'disable' : ''}"
th:name="|__keep_${field.getName()}|">
<span>Keep current data</span>
<div th:if="${field.isImage()}" class="mb-2">
<img class="thumb-image" th:id="|__thumb_${field.getName()}|"
<img class="thumb-image"
th:id="|__thumb_${field.getName()}|"
th:src="|/${baseUrl}/download/${schema.getClassName()}/${field.getJavaName()}/${object.getPrimaryKeyValue()}/image|">
</div>
</div>
<!--/*--> File input <!--*/-->
<input th:if="${field.isBinary()}" placeholder="NULL" th:type="${field.getType().getHTMLName()}"
<input
th:if="${field.isBinary()}" placeholder="NULL" th:type="${field.getType().getHTMLName()}"
th:name="${field.getName()}"
class="form-control mt-2" th:id="|__id_${field.getName()}|"
th:class="|form-control mt-2 ${field.isReadOnly() && !create ? 'disable' : ''}|"
th:id="|__id_${field.getName()}|"
th:required="${!field.isNullable()}"
>
</th:block>