Готовая 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.addAllAttributes(attributes);
|
||||||
model.addAttribute(PAGE_ATTRIBUTE, page);
|
model.addAttribute(PAGE_ATTRIBUTE, page);
|
||||||
model.addAttribute(DESCRIPTION_ATTRIBUTE, description);
|
model.addAttribute(DESCRIPTION_ATTRIBUTE, description);
|
||||||
model.addAttribute("departmentId", departmentId);
|
|
||||||
model.addAttribute(DEPARTMENT_ATTRIBUTE, getDepartment(departmentId));
|
|
||||||
if(departmentId != null){
|
if(departmentId != null){
|
||||||
|
model.addAttribute("departmentId", departmentId);
|
||||||
model.addAttribute(DEPARTMENT_ITEM_ATTRIBUTE, departmentService.get(departmentId));
|
model.addAttribute(DEPARTMENT_ITEM_ATTRIBUTE, departmentService.get(departmentId));
|
||||||
}
|
}
|
||||||
|
model.addAttribute(DEPARTMENT_ATTRIBUTE, getDepartments());
|
||||||
return NEWS_VIEW;
|
return NEWS_VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,31 +21,29 @@
|
|||||||
<i class="fa fa-search">Поиск</i>
|
<i class="fa fa-search">Поиск</i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="input-group d-flex justify-content-center">
|
||||||
</div>
|
<div class="input-group-append">
|
||||||
<div class="d-flex justify-content-center">
|
<label for="departmentId" class="form-label" />
|
||||||
<form class="w-25 mt-2" method="get">
|
|
||||||
<div class="input-group">
|
|
||||||
<label for="departmentId" class="form-label"></label>
|
|
||||||
<select id="departmentId" class="form-control" name="departmentId">
|
<select id="departmentId" class="form-control" name="departmentId">
|
||||||
<option th:if="${departmentId} == null" value="">Выберите кафедру</option>
|
<option th:if="${departmentId} == null" value="" selected>Без фильтра</option>
|
||||||
<option th:unless="${departmentId} == null" th:value="${departmentId}"
|
|
||||||
th:text="${department.name}" />
|
|
||||||
<option th:each="departmentItem : ${departments}" th:value="${departmentItem.id}"
|
<option th:each="departmentItem : ${departments}" th:value="${departmentItem.id}"
|
||||||
th:text="${departmentItem.name}" th:selected="${departmentId} == ${departmentItem.id}">
|
th:text="${departmentItem.name}" th:selected="${departmentId} == ${departmentItem.id}">
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="input-group-append">
|
||||||
<button class="btn btn-primary" type="submit">
|
<button class="btn btn-primary" type="submit">
|
||||||
<i class="fa fa-check">Выбрать</i>
|
<i class="fa fa-check">Выбрать</i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</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>
|
<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>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col mt-4 colStyle" th:each="newItem : ${items}">
|
<div class="col mt-4 colStyle" th:each="newItem : ${items}">
|
||||||
|
Loading…
Reference in New Issue
Block a user