mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-08-13 07:01:13 +00:00
Removed FragmentContext
and instead created multiple versions of input fields fragments for different contexts (search, create)
This commit is contained in:
@@ -90,7 +90,7 @@
|
||||
<option th:value="${op}" th:each="op : ${field.getType().getCompareOperators()}"
|
||||
th:text="${op.getDisplayName()}">
|
||||
</select>
|
||||
<input th:replace="~{fragments/inputs ::
|
||||
<input th:replace="~{fragments/search_inputs ::
|
||||
__${field.getFragmentName()}__(
|
||||
field=${field},
|
||||
create=${create},
|
||||
|
75
src/main/resources/templates/fragments/search_inputs.html
Normal file
75
src/main/resources/templates/fragments/search_inputs.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
|
||||
|
||||
<input placeholder="NULL" th:fragment="textarea(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="char(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' : ''}|"
|
||||
maxlength="1"
|
||||
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
|
||||
></input>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user