Support for char and short field types; Improved UI on create/edit form, now showing the type for each input element

This commit is contained in:
Francesco
2023-10-08 10:41:29 +02:00
parent e1010a6c86
commit bf7a4c8956
3 changed files with 132 additions and 42 deletions

View File

@@ -8,37 +8,75 @@
rows="5"
th:classAppend="|${field.isReadOnly() && !create ? 'disable' : ''}|"
></textarea>
<input placeholder="NULL" th:fragment="text(field, create, name, value)"
type="text"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
<input placeholder="NULL" th:fragment="number(field, create, name, value)"
type="number"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any"
></input>
<input placeholder="NULL" th:fragment="datetime(field, create, name, value)"
type="datetime-local"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
<th:block th:fragment="char(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="text"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
maxlength="1"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:fragment="text(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="text"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:fragment="number(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="number"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any"
></input>
</div>
</th:block>
<th:block th:fragment="datetime(field, create, name, value)"
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<div class="input-group">
<input placeholder="NULL"
type="datetime-local"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<!--
<th:block th:fragment="offset_datetime(field, create, name, value)">
<div class="form-group">
@@ -65,16 +103,23 @@
</div>
</th:block>
-->
<input placeholder="NULL" th:fragment="date(field, create, name, value)"
type="date"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
<th:block th:fragment="date(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="date"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:if="${field.isBinary()}" th:fragment="file(field, create, name, value)" >
<!--/*--> Edit options <!--*/-->
<div th:if="${!create && object.get(field).getValue() != null}">