Don’t use messages

The system won’t be multilingual anyway, so this just adds complexity
and things to trip over.

Closes #25
This commit is contained in:
Simon Bruder 2023-11-16 13:11:49 +01:00
parent 7dfc7f66f9
commit 32f997464e
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
7 changed files with 12 additions and 56 deletions

View file

@ -6,16 +6,3 @@
# HINT:
# Values from here will be used as a default if no entry was found in the language specific
# message file or if a language specific file could not be found.
welcome.title = Welcome back!
welcome.text = If umlauts such as äöü are not displayed correctly, something is broken
profile.title = Dein Profil
profile.danger_zone = Danger Zone
profile.edit = Bearbeiten
profile.delete = Account löschen
profile.username = Nutzername
profile.password = Passwort
profile.address = Adresse
profile.authentification = Authentifikation
profile.userinformation = Nutzerinformationen

View file

@ -1,17 +0,0 @@
# ATTENTION:
# Spring Boot expects this file to be UTF-8 encoded 👍 However, some IDEs will open it in
# the wrong mode. For example, IntelliJ users must go to Preferences > Editor > File Encodings
# and set "Default encoding for properties files" to "UTF-8".
#
# HINT: Entries that are missing here are looked up in messages.properties
welcome.title = Willkommen zurück!
welcome.text = Wenn Umlaute (äöü) falsch dargestellt werden, ist irgendwas kaputt
nav.register=Registrierung
nav.login=Login
nav.inventory=Inventar
nav.employee=Angestellte
nav.customer=Kunden
nav.orders=Bestellungen
nav.orders.calender=Kalender

View file

@ -1,14 +0,0 @@
# ATTENTION:
# Spring Boot expects this file to be UTF-8 encoded 👍 However, some IDEs will open it in
# the wrong mode. For example, IntelliJ users must go to Preferences > Editor > File Encodings
# and set "Default encoding for properties files" to "UTF-8".
#
# HINT: Entries that are missing here are looked up in messages.properties
nav.register=Register
nav.login=Login
nav.inventory=Inventory
nav.employee=Employee
nav.customer=Customer
nav.orders=Orders
nav.orders.calender=Calender

View file

@ -9,12 +9,12 @@
<link rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}">
<link rel="stylesheet" th:href="@{/resources/css/style.css}">
<title th:text="${#strings.isEmpty(title)} ? #{home.title} : ${title}">Catering</title>
<title th:text="${#strings.concat((#strings.isEmpty(title) ? '' : title + ' | ') + 'Catering Mampf')}"></title>
</head>
<body>
<nav th:replace="~{navigation :: navigation}"></nav>
<main class="container py-4">
<h1 class="mb-4" th:text="${#strings.isEmpty(title)} ? #{home.title} : ${title}"></h1>
<h1 class="mb-4" th:text="${#strings.isEmpty(title)} ? 'Willkommen bei Catering Mampf' : ${title}"></h1>
<div layout:fragment="content"></div>
</main>
<div class="container">

View file

@ -9,31 +9,31 @@
<div layout:fragment="content">
<div class="mb-4">
<form th:action="@{/profile}" method="post">
<h2 th:text="#{profile.authentification}"></h2>
<h2>Authentifizierung</h2>
<div class="mb-3">
<label class="form-label" for="username" th:text="#{profile.username}"></label>
<label class="form-label" for="username">Nutzername</label>
<input class="form-control" name="username" th:value="${user.username}" type="text">
</div>
<div class="mb-3">
<label class="form-label" for="password" th:text="#{profile.password}"></label>
<label class="form-label" for="password" th:text="Passwort"></label>
<input class="form-control" name="password" type="password">
</div>
<h2 th:text="#{profile.userinformation}"></h2>
<h2>Nutzerinformationen</h2>
<div class="mb-3">
<label class="form-label" for="address" th:text="#{profile.address}"></label>
<label class="form-label" for="address">Adresse</label>
<input class="form-control" name="address" th:value="${user.address}" type="text">
</div>
<button class="btn btn-primary" th:text="#{profile.edit}" type="submit"></button>
<button class="btn btn-primary" type="submit">Bearbeiten</button>
</form>
</div>
<div th:if="${user.hasRole('CUSTOMER')}" class="card">
<div class="card-header text-danger" th:text="#{profile.danger_zone}"></div>
<div class="card-header text-danger">Danger Zone</div>
<div class="card-body">
<a th:href="@{/profile/disable}">
<button class="btn btn-danger" th:text="#{profile.delete}" type="button"></button>
<button class="btn btn-danger" type="button">Account löschen</button>
</a>
</div>
</div>

View file

@ -2,7 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout.html(title='Wilkommen bei Wursts Catering')}">
layout:decorate="~{layout.html}">
<body>
<div layout:fragment="content">

View file

@ -35,6 +35,6 @@ class WelcomeControllerIntegrationTests {
void showsWelcomeMessage() throws Exception {
mvc.perform(get("/")) //
.andExpect(status().isOk())
.andExpect(content().string(containsString("Wilkommen bei Wursts Catering")));
.andExpect(content().string(containsString("Catering Mampf")));
}
}