Промежуточное
This commit is contained in:
parent
b08c3f8162
commit
b4e93f7719
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@ -25,6 +25,7 @@ import jakarta.validation.Valid;
|
||||
@RequestMapping(NewsAdminController.URL)
|
||||
public class NewsAdminController {
|
||||
public static final String URL = Constants.ADMIN_PREFIX + "/news";
|
||||
private static final String NEWS_URL = NewsController.URL;
|
||||
private static final String NEWS_EDIT_VIEW = "new-edit";
|
||||
private static final String NEWS_ATTRIBUTE = "news";
|
||||
private static final String DEPARTMENT_ATTRIBUTE = "departments";
|
||||
@ -68,14 +69,14 @@ public class NewsAdminController {
|
||||
return NEWS_EDIT_VIEW;
|
||||
}
|
||||
newsService.create(toEntity(newItem));
|
||||
return Constants.REDIRECT_VIEW + URL;
|
||||
return Constants.REDIRECT_VIEW + NEWS_URL;
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public String delete(
|
||||
@PathVariable(name = "id") Long id) {
|
||||
newsService.delete(id);
|
||||
return Constants.REDIRECT_VIEW + URL;
|
||||
return Constants.REDIRECT_VIEW + NEWS_URL;
|
||||
}
|
||||
|
||||
@GetMapping("/edit/{id}")
|
||||
@ -103,6 +104,6 @@ public class NewsAdminController {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
newsService.update(id, toEntity(newItem));
|
||||
return Constants.REDIRECT_VIEW + URL;
|
||||
return Constants.REDIRECT_VIEW + NEWS_URL;
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,16 @@
|
||||
|
||||
<body>
|
||||
<main class="text-center" layout:fragment="content">
|
||||
<span class="mainSt">
|
||||
<b>Кафедры</b>
|
||||
</span>
|
||||
<div>
|
||||
<a href="/admin/departments/edit/" class="btn btn-danger">Добавить кафедру</a>
|
||||
</div>
|
||||
<th:block th:switch="${departments.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<span class="mainSt">
|
||||
<b>Кафедры</b>
|
||||
</span>
|
||||
<div>
|
||||
<a href="/admin/departments/edit/" class="btn btn-danger">Добавить кафедру</a>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
|
@ -23,13 +23,12 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<a th:href="@{/admin/directions/edit/(page=${page})}" class="btn btn-danger mt-4">Добавить направление</a>
|
||||
</div>
|
||||
<th:block th:switch="${items.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<div>
|
||||
<a th:href="@{/admin/directions/edit/(page=${page})}" class="btn btn-danger mt-4">Добавить
|
||||
направление</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{/news/edit/{id}(id=${news.id},(page=${page}))}" th:object="${news}" method="post">
|
||||
<form action="#" th:action="@{/admin/news/edit/{id}(id=${news.id},(page=${page}))}" th:object="${news}"
|
||||
method="post">
|
||||
<div class="mb-3">
|
||||
<label for="id" class="form-label">ID</label>
|
||||
<input type="text" th:value="*{id}" id="id" class="form-control" readonly disabled>
|
||||
|
@ -9,15 +9,15 @@
|
||||
|
||||
<body>
|
||||
<main class="text-center" layout:fragment="content">
|
||||
<span class="mainSt">
|
||||
<b>Пользователи</b>
|
||||
</span>
|
||||
<div>
|
||||
<a href="/users/edit/" class="btn btn-danger">Добавить пользователя</a>
|
||||
</div>
|
||||
<th:block th:switch="${items.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<span class="mainSt">
|
||||
<b>Пользователи</b>
|
||||
</span>
|
||||
<div>
|
||||
<a href="/users/edit/" class="btn btn-danger">Добавить пользователя</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
|
Loading…
Reference in New Issue
Block a user