81 lines
3.7 KiB
HTML
81 lines
3.7 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en"
|
||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||
|
layout:decorate="~{feed}" xmlns:th="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div layout:fragment="contentFeed">
|
||
|
|
||
|
<div class='h3 mb-3 mx-auto w-25'>
|
||
|
<p class="text-end" th:text="${selectedProfile.login}"></p>
|
||
|
</div>
|
||
|
<div class='h3 m-3 d-flex justify-content-between text-center mx-auto w-25'>
|
||
|
|
||
|
Лента
|
||
|
<button type='button' class="btn btn-primary ms-5 mb-3 " data-bs-toggle="modal" data-bs-target="#postCreate">
|
||
|
Добавить новый пост
|
||
|
</button>
|
||
|
</div>
|
||
|
|
||
|
<form th:action="@{/feed/filter/{id}/{text} (id=${selectedProfile.id}, text=${searchField}) }" method="get">
|
||
|
<input th:value="${searchField}" id="searchField" name="searchField" type="text" class="mb-2" style="width: 20%" placeholder="Поиск...">
|
||
|
<button type='submit' class="btn btn-primary mb-2" style="width: 5%">
|
||
|
Найти
|
||
|
</button>
|
||
|
</form>
|
||
|
|
||
|
|
||
|
<div th:each="post: ${posts}" class="text-center mx-auto w-25 mb-3">
|
||
|
<div class="border p-2">
|
||
|
<p th:text="${post.text}" class="h4 text-start"></p>
|
||
|
<div class="d-flex justify-content-between fst-italic">
|
||
|
<div>
|
||
|
Автор:
|
||
|
<a th:text="${post.getAuthor()}" class="text-start fst-italic" ></a>
|
||
|
</div>
|
||
|
<div th:if="${selectedProfile.getLogin() == post.getAuthor()}" class="d-flex justify-content-between fst-italic">
|
||
|
<form th:action="@{/feed/deletePost/{id}/{authorId} (id=${post.id}, authorId=${selectedProfile.id})}" method="post" >
|
||
|
<button type="submit" class="btn btn-danger me-1 mb-1 ms-2" >
|
||
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||
|
</button>
|
||
|
</form>
|
||
|
<form th:action="@{/feed/postModal/{id}/{authorId} (id=${post.id}, authorId=${selectedProfile.id})}" method="get">
|
||
|
<button type="submit" class="btn btn-warning mb-1" data-bs-toggle="modal" data-bs-target="#postEdit" >
|
||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||
|
</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="modal fade" id="postCreate" tabindex="-1" role="dialog" aria-labelledby="postCreateLabel" aria-hidden="true">
|
||
|
<div class="modal-dialog" role="document">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h5 class="modal-title" id="postCreateLabel">Создать пост</h5>
|
||
|
</div>
|
||
|
<form th:action="@{/feed/post/{id}/{text} (id=${selectedProfile.id}, text=${postInputField}) }" method="post" class="modal-body text-center">
|
||
|
<p>Текст поста:</p>
|
||
|
<input th:value="${postInputField}" id="postInputField" name="postInputField" type="text" class="mb-2">
|
||
|
<br>
|
||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
|
||
|
<button type="submit" class="btn btn-primary" >Сохранить</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div layout:fragment="modalFeed"></div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
|
<script type="text/javascript">
|
||
|
window.onload = () => {
|
||
|
$('#postEdit').modal('show');
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
</html>
|