Skip to content

Commit

Permalink
Merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuznik committed Nov 24, 2024
2 parents 6cd918b + 0e0e324 commit ca179d0
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 65 deletions.
17 changes: 4 additions & 13 deletions src/main/resources/templates/addDisaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<body class="bg-body-tertiary">
<nav th:replace="~{fragments :: nav}"></nav>
<div class="px-4 py-5 mt-5 text-center bg-white shadow-sm">

<div class="px-4 py-5 mt-md-5 text-center bg-white shadow-sm">
<h1 class="display-5 fw-bold text-body-emphasis">Dodaj <span class="text-primary">Zdarzenie</span></h1>
<div class="col-lg-6 mx-auto">
<p class="lead">Wprowadź informacje o nowym zdarzeniu. Pamiętaj, że fałszywe zgłoszenia zostaną wykryte.</p>
Expand All @@ -14,7 +15,7 @@ <h1 class="display-5 fw-bold text-body-emphasis">Dodaj <span class="text-primary
<div>
<div class="container col-xl-10 col-xxl-10 px-4 ">
<div class="row g-lg-5 py-5">
<div class="col-md-10 mx-auto col-lg-10">
<div class="col-md-10 mx-auto col-lg-8">
<form action="/disasters/add" method="post" th:object="${disasterAddDTO}" class="p-4 p-md-2 rounded-3 bg-body-tertiary">
<div class="form-floating mb-3">
<select th:value="${disasterTypSelected}" name="type" class="form-select" id="type" required>
Expand All @@ -38,17 +39,7 @@ <h1 class="display-5 fw-bold text-body-emphasis">Dodaj <span class="text-primary
</div>

<button class="w-100 btn btn-lg btn-primary" type="submit">Dodaj Zdarzenie</button>
<div id="toastMessage" class="toast rounded align-items-center border-0 position-fixed bottom-0 end-0 m-3 show" role="alert" aria-live="assertive" aria-atomic="true" th:if="${message}">
<div class="toast-header">
<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"/></svg>
<strong class="me-auto">Udało się!</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="d-flex text-secondary bg-light px-3 py-1 fw-light">
<div th:replace="~{fragments :: message}" class="toast-body text-white">
</div>
</div>
</div>
<div th:replace="~{fragments :: toast}"></div>
</form>
</div>
</div>
Expand Down
72 changes: 44 additions & 28 deletions src/main/resources/templates/fragments.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</head>
<body>

<nav th:fragment="nav" class="navbar navbar-expand-sm bg-dark navbar-dark" aria-label="First navbar example">
<nav th:fragment="nav" class="navbar navbar-expand-lg bg-dark navbar-dark" aria-label="First navbar example">
<div class="container-fluid">
<a sec:authorize="isAnonymous()" class="navbar-brand" href="/">
<img class="d-inline-block me-3" style="max-height: 3.5em;" src="/images/disaster_alerts_logo.bmp"
Expand All @@ -32,42 +32,58 @@
</button>
<div class="collapse navbar-collapse nav justify-content-end" id="collapsibleNavbar">
<div sec:authorize="isAnonymous()">
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link text-light" href="/">Login</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/signup">Register</a>
</li>
</ul>
</div>
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link text-light" href="/">Login</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/signup">Register</a>
</li>
</ul>
</div>
<div sec:authorize="isAuthenticated()">
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link text-light" href="/disasters/add">Dodaj zdarzenie</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/disasters/list">Sprawdź zdarzenia</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/users/edit">Edytuj dane</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/logout">Logout</a>
</li>
</ul>
</div>
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link text-light" href="/disasters/add">Dodaj zdarzenie</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/disasters/list">Sprawdź zdarzenia</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/users/edit">Edytuj dane</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="/logout">Logout</a>
</li>
</ul>
</div>
</div>
</div>
</nav>

<div th:fragment="message" class="px-2 text-center">
<p class="h5 text-center" th:if="${message} != null" th:text="${message}"></p>
<div th:fragment="message">
<p class="h6 " th:if="${message} != null" th:text="${message}"></p>
</div>

<div th:fragment="toast" class="toast rounded align-items-center border-0 position-fixed bottom-0 end-0 m-3 show"
role="alert" aria-live="assertive" aria-atomic="true" th:if="${message}">
<div class="toast-header">
<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg"
aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false">
<rect width="100%" height="100%" fill="#007aff"/>
</svg>
<strong class="me-auto">Udało się!</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="d-flex text-secondary bg-light px-3 py-1 fw-light">
<div th:replace="~{fragments :: message}" class="toast-body text-white">
</div>
</div>
</div>

<div th:fragment="citiesList" class="col-12">
<div class="text-danger" th:if="${#fields.errors('location')}" th:errors="*{location}"></div>
<h4 class="text-center">Wybierz miejsce:</h4>
<h2>Wybierz miejscowość:</h2>
<div class="form-group">
<input th:value="${selectedLocation}" type="text" class="form-control my-2" id="cityInput"
placeholder="Zacznij wpisywać" onkeyup="filterCities()">
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ <h1 class="display-4 fw-bold lh-1 text-body-emphasis mb-3"><span class="text-pri
<h4 class="fw-light">Spokój zaczyna się od ostrzeżenia</h4>
</div>
<div class="col-md-10 mx-auto col-lg-5">

<div th:replace="~{fragments :: message}" class="text-success"></div>
<div th:replace="~{fragments :: toast}"></div>
<div class="h4 text-danger text-center" th:if="${param.error}">Niepoprawny login lub hasło</div>
<div class="h4" th:if="${param.logout}">Wylogowano</div>

Expand Down
16 changes: 6 additions & 10 deletions src/main/resources/templates/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@ <h4 class="mb-3">Rejestracja</h4>

<div class="row g-3">
<div class="col-12">
<div class="text-danger" th:if="${#fields.errors('firstName')}"
th:errors="*{firstName}"></div>
<div class="text-danger" th:if="${#fields.errors('firstName')}" th:errors="*{firstName}"></div>
<label for="firstName" class="form-label">Imię</label>
<input th:value="*{firstName}" name="firstName" type="text" class="form-control"
id="firstName">
<input th:value="*{firstName}" name="firstName" type="text" class="form-control" id="firstName">
<div class="invalid-feedback">
Nazwa użytkownika jest wymagana
Imię musi zawierać co najmniej 2 znaki
</div>
</div>

<div class="col-12">
<div class="text-danger" th:if="${#fields.errors('lastName')}"
th:errors="*{lastName}"></div>
<div class="text-danger" th:if="${#fields.errors('lastName')}" th:errors="*{lastName}"></div>
<label for="lastName" class="form-label">Nazwisko</label>
<input th:value="*{lastName}" name="lastName" type="text" class="form-control"
id="lastName">
<input th:value="*{lastName}" name="lastName" type="text" class="form-control" id="lastName">
<div class="invalid-feedback">
Nazwa użytkownika jest wymagana
Nazwisko musi zawierać co najmniej 2 znaki
</div>
</div>

Expand Down
29 changes: 17 additions & 12 deletions src/main/resources/templates/updateUser.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@

<nav th:replace="~{fragments :: nav}"></nav>

<div class="px-4 py-5 mt-md-5 text-center bg-white shadow-sm d-none d-lg-block">
<h1 class="display-5 fw-bold text-body-emphasis">Edycja <span class="text-primary">Profilu</span></h1>
<div class="col-lg-6 mx-auto">
<p class="lead">Zaktualizuj dane. Bądź na bieżąco z doniesieniami ze swojego regionu. Pamiętaj, że usunięcie lub niedodanie numeru telefonu skutkuje rezygnacją z alertów SMS.</p>
</div>
</div>

<div class="d-flex align-items-center justify-content-center bg-body-tertiary">
<div class="container col-xl-10 col-xxl-8 px-4 py-5">
<div class="row align-items-center g-lg-5 py-5">
<div class="col-lg-7 text-center text-lg-start">
<h1 class="display-4 fw-bold lh-1 text-body-emphasis mb-3">Aktualizacja danych</h1>
<p class="col-lg-10 fs-4">Aktualizuj informacje</p>
<div class="col-lg-7 text-center text-lg-start d-lg-none">
<h1 class="display-5 fw-bold lh-1 text-body-emphasis mb-3">Edycja profilu</h1>
<p class="col-lg-10 fs-5 fw-light">Zaktualizuj dane. Bądź na bieżąco z doniesieniami ze swojego regionu</p>
</div>
<div class="col-md-10 mx-auto col-lg-5">
<div th:replace="~{fragments :: message}" class="bg-dark"></div>
<div th:replace="~{fragments :: toast}"></div>
<form th:action="@{/users/update}" method="post" th:object="${userUpdateDto}">
<div class="row g-3">

<div class="col-12">
<div class="text-danger" th:if="${#fields.errors('firstName')}" th:errors="*{firstName}"></div>
<label for="firstName" class="form-label">Nazwa użytkownika</label>
<label for="firstName" class="form-label">Imię</label>
<input th:value="*{firstName}" name="firstName" type="text" class="form-control" id="firstName">
<div class="invalid-feedback">
Nazwa użytkownika jest wymagana
Expand All @@ -28,7 +35,7 @@ <h1 class="display-4 fw-bold lh-1 text-body-emphasis mb-3">Aktualizacja danych</

<div class="col-12">
<div class="text-danger" th:if="${#fields.errors('lastName')}" th:errors="*{lastName}"></div>
<label for="lastName" class="form-label">Nazwa użytkownika</label>
<label for="lastName" class="form-label">Nazwisko</label>
<input th:value="*{lastName}" name="lastName" type="text" class="form-control" id="lastName">
<div class="invalid-feedback">
Nazwa użytkownika jest wymagana
Expand All @@ -55,16 +62,14 @@ <h1 class="display-4 fw-bold lh-1 text-body-emphasis mb-3">Aktualizacja danych</
<a th:if="*{phoneNumber() != ''}" role="button" class="btn btn-danger ms-2" href='/users/removePhoneNumber' methods="POST">
<i class="bi bi-trash"></i> Usuń numer telefonu
</a>
</div>
<div class="invalid-feedback">
Nieprawidłowy format numeru telefonu
<div class="invalid-feedback">
Nieprawidłowy format numeru telefonu
</div>
</div>
</div>

<div th:replace="~{fragments :: citiesList}"></div>
</div>

<button class="w-100 btn btn-primary btn-lg my-md-4" type="submit">Aktualizuj dane</button>
<button class="w-100 btn btn-primary btn-lg my-md-4" type="submit">Zatwierdź</button>
</form>
</div>
</div>
Expand Down

0 comments on commit ca179d0

Please sign in to comment.