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