sdano
This commit is contained in:
parent
7a77cb66e0
commit
e59eb6ae41
@ -28,7 +28,7 @@ import jakarta.validation.Valid;
|
||||
public class CommentController {
|
||||
public static final String URL = Constants.ADMIN_PREFIX + "/comment";
|
||||
private static final String COMMENT_VIEW = "comment";
|
||||
private static final String COMMENT_EDIT_VIEW = "comment-edit-admin ";
|
||||
private static final String COMMENT_EDIT_VIEW = "comment-edit-admin";
|
||||
private static final String PAGE_ATTRIBUTE = "page";
|
||||
private static final String COMMENT_ATTRIBUTE = "comment";
|
||||
|
||||
@ -44,8 +44,15 @@ public class CommentController {
|
||||
modelMapper = model;
|
||||
}
|
||||
|
||||
private CommentDto toDto(CommentEntity entity) {
|
||||
return modelMapper.map(entity, CommentDto.class);
|
||||
private CommentUserVideoTitleDto toDto(CommentEntity entity) {
|
||||
CommentUserVideoTitleDto dto = new CommentUserVideoTitleDto();
|
||||
dto.setId(entity.getId());
|
||||
dto.setText(entity.getText());
|
||||
dto.setUserId(entity.getUser().getId());
|
||||
dto.setVideoId(entity.getVideo().getId());
|
||||
dto.setUser(entity.getUser().getLogin());
|
||||
dto.setTitle(entity.getVideo().getTitle());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private CommentEntity toEntity(CommentDto dto) {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.example.demo.comments.api;
|
||||
|
||||
public class CommentUserVideoTitleDto extends CommentDto {
|
||||
private String title;
|
||||
private String user;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ package com.example.demo.core.configuration;
|
||||
public class Constants {
|
||||
public static final String SEQUENCE_NAME = "hibernate_sequence";
|
||||
|
||||
public static final int DEFUALT_PAGE_SIZE = 5;
|
||||
public static final int DEFUALT_PAGE_SIZE = 4;
|
||||
|
||||
public static final String REDIRECT_VIEW = "redirect:";
|
||||
|
||||
|
22
src/main/java/com/example/demo/likes/api/LikeTitleDto.java
Normal file
22
src/main/java/com/example/demo/likes/api/LikeTitleDto.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.example.demo.likes.api;
|
||||
|
||||
public class LikeTitleDto extends LikeDto {
|
||||
private String user;
|
||||
private String title;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.example.demo.comments.api.CommentDto;
|
||||
import com.example.demo.comments.api.CommentUserVideoTitleDto;
|
||||
import com.example.demo.comments.model.CommentEntity;
|
||||
import com.example.demo.comments.service.CommentService;
|
||||
import com.example.demo.core.api.PageAttributesMapper;
|
||||
@ -57,8 +58,15 @@ public class VideoListController {
|
||||
return dto;
|
||||
}
|
||||
|
||||
private CommentDto toDto(CommentEntity entity) {
|
||||
return modelMapper.map(entity, CommentDto.class);
|
||||
private CommentUserVideoTitleDto toDto(CommentEntity entity) {
|
||||
CommentUserVideoTitleDto dto = new CommentUserVideoTitleDto();
|
||||
dto.setId(entity.getId());
|
||||
dto.setText(entity.getText());
|
||||
dto.setUserId(entity.getUser().getId());
|
||||
dto.setVideoId(entity.getVideo().getId());
|
||||
dto.setUser(entity.getUser().getLogin());
|
||||
dto.setTitle(entity.getVideo().getTitle());
|
||||
return dto;
|
||||
}
|
||||
|
||||
@GetMapping("/video")
|
||||
|
@ -15,11 +15,13 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.example.demo.comments.api.CommentDto;
|
||||
import com.example.demo.comments.api.CommentUserVideoTitleDto;
|
||||
import com.example.demo.comments.model.CommentEntity;
|
||||
import com.example.demo.comments.service.CommentService;
|
||||
import com.example.demo.core.api.PageAttributesMapper;
|
||||
import com.example.demo.core.configuration.Constants;
|
||||
import com.example.demo.likes.api.LikeDto;
|
||||
import com.example.demo.likes.api.LikeTitleDto;
|
||||
import com.example.demo.likes.model.LikeEntity;
|
||||
import com.example.demo.likes.service.LikeService;
|
||||
import com.example.demo.videos.model.VideoEntity;
|
||||
@ -63,12 +65,25 @@ public class VideoUserController {
|
||||
return modelMapper.map(entity, VideoDto.class);
|
||||
}
|
||||
|
||||
private LikeDto toDto(LikeEntity entity) {
|
||||
return modelMapper.map(entity, LikeDto.class);
|
||||
private LikeTitleDto toDto(LikeEntity entity) {
|
||||
LikeTitleDto dto = new LikeTitleDto();
|
||||
dto.setId(entity.getId());
|
||||
dto.setUserId(entity.getUser().getId());
|
||||
dto.setVideoId(entity.getVideo().getId());
|
||||
dto.setTitle(entity.getVideo().getTitle());
|
||||
dto.setUser(entity.getUser().getLogin());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private CommentDto toDto(CommentEntity entity) {
|
||||
return modelMapper.map(entity, CommentDto.class);
|
||||
private CommentUserVideoTitleDto toDto(CommentEntity entity) {
|
||||
CommentUserVideoTitleDto dto = new CommentUserVideoTitleDto();
|
||||
dto.setId(entity.getId());
|
||||
dto.setText(entity.getText());
|
||||
dto.setUserId(entity.getUser().getId());
|
||||
dto.setVideoId(entity.getVideo().getId());
|
||||
dto.setUser(entity.getUser().getLogin());
|
||||
dto.setTitle(entity.getVideo().getTitle());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private VideoEntity toEntity(VideoDto dto) {
|
||||
|
@ -9,6 +9,7 @@ h1 {
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
color: black;
|
||||
}
|
||||
|
||||
h3 {
|
||||
@ -21,6 +22,23 @@ td form {
|
||||
margin-top: -.25em;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #D9D9D9;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.table1 {
|
||||
color: #D9D9D9;
|
||||
background-color: #D9D9D9;
|
||||
}
|
||||
|
||||
.text-big {
|
||||
font-size: 30;
|
||||
}
|
||||
|
||||
.button-fixed-width {
|
||||
width: 150px;
|
||||
}
|
||||
@ -38,7 +56,7 @@ td form {
|
||||
}
|
||||
|
||||
.my-navbar {
|
||||
background-color: #3c3c3c !important;
|
||||
background-color: #87B650 !important;
|
||||
}
|
||||
|
||||
.my-navbar .link a:hover {
|
||||
@ -51,7 +69,7 @@ td form {
|
||||
}
|
||||
|
||||
.my-footer {
|
||||
background-color: #2c2c2c;
|
||||
background-color: #FFA367;
|
||||
height: 32px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
3
src/main/resources/public/favicon.svg
Normal file
3
src/main/resources/public/favicon.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-camera-video" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M0 5a2 2 0 0 1 2-2h7.5a2 2 0 0 1 1.983 1.738l3.11-1.382A1 1 0 0 1 16 4.269v7.462a1 1 0 0 1-1.406.913l-3.111-1.382A2 2 0 0 1 9.5 13H2a2 2 0 0 1-2-2zm11.5 5.175 3.5 1.556V4.269l-3.5 1.556zM2 4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h7.5a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 427 B |
BIN
src/main/resources/public/maxresdefault.jpg
Normal file
BIN
src/main/resources/public/maxresdefault.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
@ -8,18 +8,9 @@
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{/video/comment/edit/add}" th:object="${comment}" 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>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID пользователя</label>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID видео</label>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly>
|
||||
</div>
|
||||
<input type="text" th:value="*{id}" id="id" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly hidden>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Текст комментария</label>
|
||||
<input type="text" th:field="*{text}" id="text" class="form-control">
|
||||
|
@ -7,19 +7,10 @@
|
||||
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{admin/comment/edit/{id}(id=${comment.id})}" th:object="${comment}" 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>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID пользователя</label>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID видео</label>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly>
|
||||
</div>
|
||||
<form action="#" th:action="@{/admin/comment/edit/{id}(id=${comment.id})}" th:object="${comment}" method="post">
|
||||
<input type="text" th:value="*{id}" id="id" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly hidden>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Текст комментария</label>
|
||||
<input type="text" th:field="*{text}" id="text" class="form-control">
|
||||
|
@ -8,18 +8,9 @@
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{/video/comment/edit/{id}(id=${comment.id})}" th:object="${comment}" 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>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID пользователя</label>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID видео</label>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly>
|
||||
</div>
|
||||
<input type="text" th:value="*{id}" id="id" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly hidden>
|
||||
<input type="number" th:field="*{videoId}" id="videoId" class="form-control" readonly hidden>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Текст комментария</label>
|
||||
<input type="text" th:field="*{text}" id="text" class="form-control">
|
||||
|
@ -10,39 +10,32 @@
|
||||
<th:block th:switch="${items.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<h2>Видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-10">ID Видео</th>
|
||||
<th scope="col" class="w-auto">ID пользователя</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="comment : ${items}">
|
||||
<th scope="row" th:text="${comment.id}"></th>
|
||||
<th scope="row" th:text="${comment.videoId}"></th>
|
||||
<th scope="row" th:text="${comment.userId}"></th>
|
||||
<td>
|
||||
<form th:action="@{/video/comment/edit/{id}(id=${comment.id})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/video/comment/delete/{id}(id=${comment.id})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>Мои комментарии</h2>
|
||||
<div style="display: flex; ">
|
||||
<div th:each="comment : ${items}"
|
||||
style="background-color: #FFA367; border: 1px solid black; max-width: 400px; margin-bottom: 10px; padding: 10px; margin: 10px 10px 10px 10px;">
|
||||
<div style="color: black; overflow-wrap: break-word; margin-bottom: 5px;">
|
||||
Видео:
|
||||
<span th:text="${comment.title}"></span>
|
||||
</div>
|
||||
<div style="color: black; overflow-wrap: break-word;">
|
||||
Комментарий:
|
||||
<span th:text="${comment.text}"></span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<form th:action="@{/video/comment/edit/{id}(id=${comment.id}, page=${page})}" method="get">
|
||||
<button type="submit" class="btn btn-success"
|
||||
style="padding-right: 10px;">Редактировать</button>
|
||||
</form>
|
||||
<form th:action="@{/video/comment/delete/{id}(id=${comment.id}, page=${page})}"
|
||||
method="post">
|
||||
<button type="submit" class="btn btn-success"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
|
@ -11,38 +11,30 @@
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<h2>Видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-10">ID Видео</th>
|
||||
<th scope="col" class="w-auto">ID пользователя</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="comment : ${items}">
|
||||
<th scope="row" th:text="${comment.id}"></th>
|
||||
<th scope="row" th:text="${comment.videoId}"></th>
|
||||
<th scope="row" th:text="${comment.userId}"></th>
|
||||
<th:block sec:authorize="hasRole('ADMIN')">
|
||||
<td>
|
||||
<form th:action="@{/admin/comment/edit/{id}(id=${comment.id})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/admin/comment/delete/{id}(id=${comment.id})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</th:block>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="display: flex; ">
|
||||
<div th:each="comment : ${items}"
|
||||
style="background-color: #FFA367; border: 1px solid black; max-width: 400px; margin-bottom: 10px; padding: 10px; margin: 10px 10px 10px 10px;">
|
||||
<div style="color: black; overflow-wrap: break-word; margin-bottom: 5px;">
|
||||
Пользователь
|
||||
<span th:text="${comment.user}"></span>
|
||||
</div>
|
||||
<div style="color: black; overflow-wrap: break-word;">
|
||||
Комментарий
|
||||
<span th:text="${comment.text}"></span>
|
||||
</div>
|
||||
<div sec:authorize="hasRole('ADMIN')" style="display: flex;">
|
||||
<form th:action="@{/admin/comment/edit/{id}(id=${comment.id}, page=${page})}" method="get"
|
||||
style="display: inline-block; margin-right: 5px;">
|
||||
<button type="submit" class="btn btn-success">Редактировать</button>
|
||||
</form>
|
||||
<form th:action="@{/admin/comment/delete/{id}(id=${comment.id}, page=${page})}"
|
||||
method="post" style="display: inline-block;">
|
||||
<button type="submit" class="btn btn-success"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'admin/comment'},
|
||||
|
@ -1,10 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru" data-bs-theme="dark" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
<html lang="ru" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title layout:title-pattern="$LAYOUT_TITLE - $CONTENT_TITLE">Тарелька</title>
|
||||
<script type="text/javascript" src="/webjars/bootstrap/5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
@ -17,7 +17,7 @@
|
||||
<nav class="navbar navbar-expand-md my-navbar" data-bs-theme="dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">
|
||||
<i class="bi bi-cart2 d-inline-block align-top me-1 logo"></i>
|
||||
<i class="bi bi-camera-video"></i>
|
||||
Тарелька
|
||||
</a>
|
||||
<th:block sec:authorize="isAuthenticated()" th:with="userName=${#authentication.name}">
|
||||
|
@ -10,43 +10,34 @@
|
||||
<th:block th:switch="${items.size()}">
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<h2>Видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-10">ID Видео</th>
|
||||
<th scope="col" class="w-auto">ID пользователя</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="comment : ${items}">
|
||||
<th scope="row" th:text="${comment.id}"></th>
|
||||
<th scope="row" th:text="${comment.videoId}"></th>
|
||||
<th scope="row" th:text="${comment.userId}"></th>
|
||||
<td>
|
||||
<form th:action="@{/video/comment/edit/{id}(id=${video.id})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/video/comment/delete/{id}(id=${video.id})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
<h2>Мои комментарии</h2>
|
||||
<div style="display: flex; ">
|
||||
<div th:each="comment : ${items}"
|
||||
style="background-color: #FFA367; border: 1px solid black; max-width: 400px; margin-bottom: 10px; padding: 10px; margin: 10px 10px 10px 10px;">
|
||||
<div style="color: black; overflow-wrap: break-word; margin-bottom: 5px;">
|
||||
Видео
|
||||
<span th:text="${comment.title}"></span>
|
||||
</div>
|
||||
<div style="color: black; overflow-wrap: break-word;">
|
||||
Комментарий
|
||||
<span th:text="${comment.text}"></span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<form th:action="@{/video/comment/edit/{id}(id=${video.id}, page=${page})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
<form th:action="@{/video/comment/delete/{id}(id=${video.id}, page=${page})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'video/comment'},
|
||||
totalPages=${totalPages},
|
||||
currentPage=${currentPage}) }" />
|
||||
</th:block>
|
||||
</th:block>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
|
@ -14,34 +14,25 @@
|
||||
</div>
|
||||
<th:block th:case="*">
|
||||
<h2>Видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-auto">Название видео</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="video : ${items}">
|
||||
<th scope="row" th:text="${video.id}"></th>
|
||||
<td th:text="${video.title}"></td>
|
||||
<td>
|
||||
<form th:action="@{/video/edit/{id}(id=${video.id})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
<div style="display: flex; flex-wrap: wrap;">
|
||||
<div th:each="video : ${items}" style="padding: 10px 10px 10px 10px; justify-content: center;">
|
||||
<div th:text="${video.title}" style="color: black;"></div>
|
||||
<div>
|
||||
<img src="https://static.tildacdn.com/tild6635-3637-4461-b131-303637663064/maxresdefault.jpg"
|
||||
alt="IMAGE" width="300" />
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<form th:action="@{/admin/video/edit/{id}(id=${video.id})}" method="get">
|
||||
<button type="submit" class="btn btn-dark">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/video/delete/{id}(id=${video.id})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
<form th:action="@{/admin/video/delete/{id}(id=${video.id})}" method="post">
|
||||
<button type="submit" class="btn btn-dark"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'video'},
|
||||
|
@ -29,13 +29,13 @@
|
||||
<th scope="row" th:text="${user.id}"></th>
|
||||
<td th:text="${user.login}"></td>
|
||||
<td>
|
||||
<form th:action="@{/admin/user/edit/{id}(id=${user.id})}" method="get">
|
||||
<form th:action="@{/admin/user/edit/{id}(id=${user.id}, page=${page})}" method="get">
|
||||
<input type="hidden" th:name="page" th:value="${page}">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/admin/user/delete/{id}(id=${user.id})}" method="post">
|
||||
<form th:action="@{/admin/user/delete/{id}(id=${user.id}, page=${page})}" method="post">
|
||||
<input type="hidden" th:name="page" th:value="${page}">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
|
@ -8,14 +8,8 @@
|
||||
<body>
|
||||
<main layout:fragment="content">
|
||||
<form action="#" th:action="@{/video/edit/{id}(id=${video.id})}" th:object="${video}" 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>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userId" class="form-label">ID пользователя</label>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly>
|
||||
</div>
|
||||
<input type="text" th:value="*{id}" id="id" class="form-control" readonly disabled hidden>
|
||||
<input type="number" th:field="*{userId}" id="userId" class="form-control" readonly hidden>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Название видео</label>
|
||||
<input type="text" th:field="*{title}" id="title" class="form-control">
|
||||
|
@ -11,30 +11,22 @@
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<h2>Понравившиеся видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-10">ID автора</th>
|
||||
<th scope="col" class="w-auto">ID видео</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="like : ${items}">
|
||||
<th scope="row" th:text="${like.id}"></th>
|
||||
<th scope="row" th:text="${like.userId}"></th>
|
||||
<td th:text="${like.videoId}"></td>
|
||||
<td>
|
||||
<form th:action="@{/video/dislike2/{id}(id=${like.videoId})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
<div style="display: flex; flex-wrap: wrap;">
|
||||
<div th:each="like : ${items}" style="padding: 10px 10px 10px 10px; justify-content: center;">
|
||||
<div th:text="${like.title}" style="color: black;"></div>
|
||||
<div>
|
||||
<img src="https://static.tildacdn.com/tild6635-3637-4461-b131-303637663064/maxresdefault.jpg"
|
||||
alt="IMAGE" width="300" />
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<form th:action="@{/video/dislike2/{id}(id=${like.videoId}, page=${page})}"
|
||||
method="post">
|
||||
<button type="submit" class="btn btn-dark"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'video/like'},
|
||||
|
@ -11,63 +11,44 @@
|
||||
<h2 th:case="0">Данные отсутствуют</h2>
|
||||
<th:block th:case="*">
|
||||
<h2>Видео</h2>
|
||||
<table class="table">
|
||||
<caption></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-10">ID</th>
|
||||
<th scope="col" class="w-10">ID пользователя</th>
|
||||
<th scope="col" class="w-auto">Название видео</th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th:block sec:authorize="hasRole('ADMIN')">
|
||||
<th scope="col" class="w-10"></th>
|
||||
<th scope="col" class="w-10"></th>
|
||||
</th:block>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="video : ${items}">
|
||||
<th scope="row" th:text="${video.id}"></th>
|
||||
<th scope="row" th:text="${video.userId}"></th>
|
||||
<td th:text="${video.title}"></td>
|
||||
<td>
|
||||
<div style="display: flex; flex-wrap: wrap;">
|
||||
<div th:each="video : ${items}"
|
||||
style="padding: 10px 10px 10px 10px; justify-content: center; flex-wrap: wrap;">
|
||||
<div th:text="${video.title}" style="color: black;"></div>
|
||||
<div>
|
||||
<img src="/maxresdefault.jpg" alt="IMAGE" width="300" />
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<form
|
||||
th:action="${video.isLiked} ? @{/video/dislike1/{id}(id=${video.id})} : @{/video/like/{id}(id=${video.id})}"
|
||||
th:action="${video.isLiked} ? @{/video/dislike1/{id}(id=${video.id}, page=${page})} : @{/video/like/{id}(id=${video.id}, page=${page})}"
|
||||
method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
th:text="${video.isLiked} ? 'Удалить лайк' : 'Поставить лайк'"></button>
|
||||
<button type="submit" class="btn btn-dark text-big"
|
||||
th:text="${video.isLiked} ? '👎🏻' : '👍🏻'"></button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/video/comment/edit/add/{videoId}(videoId=${video.id})}"
|
||||
method="get">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Добавить комментарий</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/list/comment/{videoId}(page=${page}, videoId=${video.id})}"
|
||||
method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Список комментариев</button>
|
||||
<button type="submit" class="btn btn-dark">💬</button>
|
||||
</form>
|
||||
</td>
|
||||
<th:block sec:authorize="hasRole('ADMIN')">
|
||||
<td>
|
||||
<form th:action="@{/admin/video/edit/{id}(id=${video.id})}" method="get">
|
||||
<button type="submit" class="btn btn-link button-link">Редактировать</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/admin/video/delete/{id}(id=${video.id})}" method="post">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</th:block>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<form
|
||||
th:action="@{/video/comment/edit/add/{videoId}(videoId=${video.id}, page=${page})}"
|
||||
method="get">
|
||||
<button type="submit" class="btn btn-dark">+💬</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div:block sec:authorize="hasRole('ADMIN')">
|
||||
<form th:action="@{/admin/video/edit/{id}(id=${video.id}, page=${page})}"
|
||||
style="display: flex; justify-content: center" method="get">
|
||||
<button type="submit" class="btn btn-dark">Редактировать</button>
|
||||
</form>
|
||||
<form th:action="@{/admin/video/delete/{id}(id=${video.id}, page=${page})}"
|
||||
style="display: flex; justify-content: center" method="post">
|
||||
<button type="submit" class="btn btn-dark"
|
||||
onclick="return confirm('Вы уверены?')">Удалить</button>
|
||||
</form>
|
||||
</div:block>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
<th:block th:replace="~{ pagination :: pagination (
|
||||
url=${'list/video'},
|
||||
|
Loading…
Reference in New Issue
Block a user