fix template crashing when defaultAddr == null

This commit is contained in:
CodeSteak 2020-06-21 16:28:00 +02:00
parent c1a0ecdcf3
commit 62df2346c3
3 changed files with 7 additions and 5 deletions

View File

@ -41,7 +41,7 @@
</tr>
<tr>
<th>Name</th>
<td th:text="${user.defaultDeliveryAddress.name}"></td>
<td th:text="${user.defaultDeliveryAddress != null ? user.defaultDeliveryAddress.name : '-'}"></td>
</tr>
<tr>
<th>E-Mail</th>
@ -56,7 +56,7 @@
</tr>
<tr>
<th>Adresse</th>
<td th:Text="${user.defaultDeliveryAddress}"></td>
<td th:Text="${user.defaultDeliveryAddress != null ? user.defaultDeliveryAddress : ''}"></td>
</tr>
</table>
</p>

View File

@ -42,7 +42,7 @@
<tr th:each="user: ${users}">
<td th:text="${user.id}"></td>
<td th:text="${user.created.toString().substring(0, 10)}"></td>
<td th:text="${user.defaultDeliveryAddress.name}"></td>
<td th:text="${user.defaultDeliveryAddress != null ? user.defaultDeliveryAddress.name : ''}"></td>
<td th:text="${user.email}"></td>
<td>
<span th:text="${user.isActive} ? 'Aktiv,' : 'Inaktiv,'"></span>

View File

@ -73,7 +73,8 @@
</div>
<div>
<label for="name">Name</label>
<input class="full-width" type="text" name="name" id="name" placeholder="Nachname Vorname" th:value="${user.defaultDeliveryAddress.name}"
<input class="full-width" type="text" name="name" id="name" placeholder="Nachname Vorname"
th:value="${user.defaultDeliveryAddress != null ? user.defaultDeliveryAddress.name : ''}"
required/>
</div>
</div>
@ -81,7 +82,8 @@
<div>
<label for="address">Anschrift</label>
<textarea rows="5" class="full-width" type="text" name="address" id="address"
placeholder="Optional: Zusatz&#10;Optional: Unternehmen&#10;Straße Hausnummer&#10;Postleitzeit Ort&#10;Land" th:text="${user.defaultDeliveryAddress.addressString}"/>
placeholder="Optional: Zusatz&#10;Optional: Unternehmen&#10;Straße Hausnummer&#10;Postleitzeit Ort&#10;Land"
th:text="${user.defaultDeliveryAddress != null ? user.defaultDeliveryAddress.addressString : ''}"/>
</div>
<div>
<button> Lieferinformation ändern</button>