Рефакторинг
This commit is contained in:
parent
f1666446aa
commit
a28e35797b
@ -26,9 +26,9 @@ import java.util.Objects;
|
||||
|
||||
@RequestMapping(AdminUserController.URL)
|
||||
public class AdminUserController {
|
||||
public static final String URL = Constants.ADMIN_PREFIX + "/user";
|
||||
private static final String USER_VIEW = "user";
|
||||
private static final String USER_EDIT_VIEW = "user-edit";
|
||||
public static final String URL = Constants.ADMIN_PREFIX + "/users";
|
||||
private static final String USER_VIEW = "admin/users";
|
||||
private static final String USER_EDIT_VIEW = "admin/user";
|
||||
private static final String PAGE_ATTRIBUTE = "page";
|
||||
private static final String USER_ATTRIBUTE = "user";
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{/admin/user/edit(page=${page})}" th:object="${user}" method="post">
|
||||
<form action="#" th:action="@{/admin/users/edit(page=${page})}" th:object="${user}" method="post">
|
||||
<input type="hidden" th:field="*{id}" id="id" class="form-control" readonly>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Имя пользователя</label>
|
||||
@ -35,7 +35,7 @@
|
||||
<div th:if="${#fields.hasErrors('passwordConfirm')}" th:errors="*{passwordConfirm}" class="invalid-feedback"></div>
|
||||
</div>
|
||||
<button class="btn btn-success me-3" type="submit">Применить</button>
|
||||
<a th:href="@{/admin/user(page=${page})}" class="btn btn-danger" >Отмена</a>
|
||||
<a th:href="@{/admin/users(page=${page})}" class="btn btn-danger" >Отмена</a>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
@ -12,7 +12,7 @@
|
||||
<th:block th:case="*">
|
||||
<h2>Пользователи</h2>
|
||||
<div>
|
||||
<a th:href="@{/admin/user/create}" class="btn btn-primary">Добавить пользователя</a>
|
||||
<a th:href="@{/admin/users/create}" class="btn btn-primary">Добавить пользователя</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
@ -29,7 +29,7 @@
|
||||
<th scope="row" th:text="${user.id}"></th>
|
||||
<td th:text="${user.username}"></td>
|
||||
<td>
|
||||
<form th:action="@{/admin/user/edit/{id}(id=${user.id})}" method="get">
|
||||
<form th:action="@{/admin/users/edit/{id}(id=${user.id})}" method="get">
|
||||
<input type="hidden" th:name="page" th:value="${page}">
|
||||
<button type="submit" class="btn btn-link button-link">
|
||||
<i class="bi bi-pencil text-warning-emphasis"></i>
|
||||
@ -37,7 +37,7 @@
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/admin/user/delete/{id}(id=${user.id})}" method="post">
|
||||
<form th:action="@{/admin/users/delete/{id}(id=${user.id})}" method="post">
|
||||
<input type="hidden" th:name="page" th:value="${page}">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">
|
||||
@ -50,7 +50,7 @@
|
||||
</table>
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'admin/user'},
|
||||
url=${'admin/users'},
|
||||
totalPages=${totalPages},
|
||||
currentPage=${currentPage}) }" />
|
||||
</th:block>
|
@ -32,8 +32,7 @@
|
||||
<div class="collapse navbar-collapse" id="main-navbar">
|
||||
<ul class="navbar-nav me-auto link" th:with="activeLink=${#objects.nullSafe(servletPath, '')}">
|
||||
<th:block sec:authorize="hasRole('ADMIN')">
|
||||
<a class="nav-link" href="/admin/user"
|
||||
th:classappend="${activeLink.startsWith('/admin/user') ? 'active' : ''}">
|
||||
<a class="nav-link" href="/admin/users" th:classappend="${activeLink.startsWith('/admin/users') ? 'active' : ''}">
|
||||
Пользователи
|
||||
</a>
|
||||
<a class="nav-link" href="/h2-console/" target="_blank">Консоль H2</a>
|
||||
@ -53,7 +52,7 @@
|
||||
<main class="container-fluid p-2 d-flex flex-column flex-fill" layout:fragment="content">
|
||||
</main>
|
||||
<footer class="my-footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
Автор, [[${#dates.year(#dates.createNow())}]]
|
||||
Потапов Н.С. ПИбд-21, [[${#dates.year(#dates.createNow())}]]
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user