Готовая 4 лаба
This commit is contained in:
parent
abc103ea52
commit
b75177292e
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@ -74,11 +74,11 @@ public class NewsController {
|
||||
model.addAllAttributes(attributes);
|
||||
model.addAttribute(PAGE_ATTRIBUTE, page);
|
||||
model.addAttribute(DESCRIPTION_ATTRIBUTE, description);
|
||||
model.addAttribute("departmentId", departmentId);
|
||||
model.addAttribute(DEPARTMENT_ATTRIBUTE, getDepartment(departmentId));
|
||||
if(departmentId != null){
|
||||
model.addAttribute("departmentId", departmentId);
|
||||
model.addAttribute(DEPARTMENT_ITEM_ATTRIBUTE, departmentService.get(departmentId));
|
||||
}
|
||||
model.addAttribute(DEPARTMENT_ATTRIBUTE, getDepartments());
|
||||
return NEWS_VIEW;
|
||||
}
|
||||
|
||||
|
@ -21,31 +21,29 @@
|
||||
<i class="fa fa-search">Поиск</i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<form class="w-25 mt-2" method="get">
|
||||
<div class="input-group">
|
||||
<label for="departmentId" class="form-label"></label>
|
||||
<div class="input-group d-flex justify-content-center">
|
||||
<div class="input-group-append">
|
||||
<label for="departmentId" class="form-label" />
|
||||
<select id="departmentId" class="form-control" name="departmentId">
|
||||
<option th:if="${departmentId} == null" value="">Выберите кафедру</option>
|
||||
<option th:unless="${departmentId} == null" th:value="${departmentId}"
|
||||
th:text="${department.name}" />
|
||||
<option th:if="${departmentId} == null" value="" selected>Без фильтра</option>
|
||||
<option th:each="departmentItem : ${departments}" th:value="${departmentItem.id}"
|
||||
th:text="${departmentItem.name}" th:selected="${departmentId} == ${departmentItem.id}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<i class="fa fa-check">Выбрать</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:switch="${items.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<div>
|
||||
<a href="/news/edit/(page=${page})" class="btn btn-danger mt-4">Добавить новость</a>
|
||||
<a th:href="@{/news/edit/(page=${page})}" class="btn btn-danger mt-4">Добавить новость</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col mt-4 colStyle" th:each="newItem : ${items}">
|
||||
|
Loading…
Reference in New Issue
Block a user