До сих пор не сделанно добавление фото. Данная работа вызывает у меня негативные эмоции. надеюсь я больше никогда с таким не столкнусь
This commit is contained in:
parent
0d47401bda
commit
982eaa2916
@ -15,6 +15,7 @@ jar {
|
|||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation(project(':front'))
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'org.springframework.boot:spring-boot-devtools'
|
implementation 'org.springframework.boot:spring-boot-devtools'
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<title>ReManga</title>
|
<title>ReManga</title>
|
||||||
</head>
|
</head>
|
||||||
<body >
|
<body >
|
||||||
<div id="app" class="d-flex flex-column h-100" ></div>
|
<div id="app" className="d-flex flex-column h-100" ></div>
|
||||||
<script type="module" src="/src/main.jsx"></script>
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -6,7 +6,7 @@ import MangaDto from "../Dto/Manga-Dto";
|
|||||||
|
|
||||||
export default function Catalog() {
|
export default function Catalog() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [mangs, setMangs] = useState([]);
|
const [mangs, setMangs] = useState([]);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import EditMangaModal from "../components/Modal/EditMangaModal";
|
|||||||
|
|
||||||
export default function CreatorAction() {
|
export default function CreatorAction() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [creatorData, setCreatorData] = useState([]);
|
const [creatorData, setCreatorData] = useState([]);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ export default function MangaPage() {
|
|||||||
|
|
||||||
const [readerData, setReaderData] = useState([]);
|
const [readerData, setReaderData] = useState([]);
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const quryString = window.location.search;
|
const quryString = window.location.search;
|
||||||
|
@ -6,7 +6,7 @@ import AddMangaReaderModal from "../components/Modal/AddMangaReaderModal";
|
|||||||
|
|
||||||
export default function ReaderAction() {
|
export default function ReaderAction() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [mangaData, setMangaData] = useState([]);
|
const [mangaData, setMangaData] = useState([]);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import MangaDto from '../Dto/Manga-Dto';
|
|||||||
|
|
||||||
export default function Creator() {
|
export default function Creator() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [creatorId, setCreatorId] = useState(0);
|
const [creatorId, setCreatorId] = useState(0);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import TableManga from '../components/Table/TableManga';
|
|||||||
|
|
||||||
export default function Manga() {
|
export default function Manga() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [creatorId, setCreatorId] = useState(0);
|
const [creatorId, setCreatorId] = useState(0);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import EditReaderForm from "../components/Form/EditReaderForm";
|
|||||||
|
|
||||||
export default function ReaderS() {
|
export default function ReaderS() {
|
||||||
|
|
||||||
const host = "http://localhost:8080";
|
const host = "http://localhost:8080/api";
|
||||||
|
|
||||||
const [readerId, setReaderId] = useState(0);
|
const [readerId, setReaderId] = useState(0);
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
rootProject.name = 'app'
|
rootProject.name = 'app'
|
||||||
|
include 'front'
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.LabWork.app.MangaStore.controller;
|
||||||
|
|
||||||
|
import com.LabWork.app.MangaStore.model.Dto.CreatorMangaDto;
|
||||||
|
import com.LabWork.app.MangaStore.model.Dto.SupportDto.MangaDto;
|
||||||
|
import com.LabWork.app.MangaStore.service.CreatorService;
|
||||||
|
import com.LabWork.app.MangaStore.service.MangaService;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/creatorAction")
|
||||||
|
public class CreatorActionMvcController {
|
||||||
|
private final CreatorService creatorService;
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CreatorActionMvcController.class);
|
||||||
|
private final MangaService mangaService;
|
||||||
|
|
||||||
|
public CreatorActionMvcController(CreatorService creatorService, MangaService mangaService) {
|
||||||
|
this.creatorService = creatorService;
|
||||||
|
this.mangaService = mangaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public String getCreators(Model model) {
|
||||||
|
model.addAttribute("creators",
|
||||||
|
creatorService.findAllCreators().stream()
|
||||||
|
.map(CreatorMangaDto::new)
|
||||||
|
.toList());
|
||||||
|
model.addAttribute("creatorId", 0);
|
||||||
|
return "creatorAction";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public String getCreator(@PathVariable Long id, Model model) {
|
||||||
|
model.addAttribute("creator", new CreatorMangaDto(creatorService.findCreator(id)));
|
||||||
|
return "creatorAction";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String editManga(@PathVariable(required = false) Long id, Model model) {
|
||||||
|
model.addAttribute("mangaId", id);
|
||||||
|
model.addAttribute("MangaDto", new MangaDto(mangaService.findManga(id)));
|
||||||
|
return "creatorAction-edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/create/{id}")
|
||||||
|
public String createManga(@PathVariable(required = false) Long id, Model model) {
|
||||||
|
model.addAttribute("creatorId", id);
|
||||||
|
model.addAttribute("MangaDto", new MangaDto());
|
||||||
|
return "creatorAction-edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = {"/{creatorId}/manga/", "/{creatorId}/manga/{mangaId}"})
|
||||||
|
public String saveManga(@PathVariable Long creatorId, @PathVariable(value = "mangaId", required = false) Long mangaId, @RequestParam("image") MultipartFile multipartFile,
|
||||||
|
@ModelAttribute @Valid MangaDto MangaDto,
|
||||||
|
BindingResult bindingResult,
|
||||||
|
Model model) throws IOException {
|
||||||
|
/* if (bindingResult.hasErrors()) {
|
||||||
|
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||||
|
return "creatorAction-edit";
|
||||||
|
}*/
|
||||||
|
String fileName = StringUtils.cleanPath(multipartFile.getOriginalFilename());
|
||||||
|
MangaDto.setImage(new String(multipartFile.getBytes()));
|
||||||
|
log.info(MangaDto.getMangaName());
|
||||||
|
MangaDto.setCreatorId(creatorId);
|
||||||
|
if (mangaId == null || mangaId <= 0) {
|
||||||
|
mangaService.addManga(MangaDto);
|
||||||
|
} else {
|
||||||
|
mangaService.updateManga(mangaId, MangaDto.getChapterCount(), MangaDto.getImage());
|
||||||
|
}
|
||||||
|
return "redirect:/creatorAction/1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete/{id}")
|
||||||
|
public String deleteCreator(@PathVariable Long id) {
|
||||||
|
mangaService.deleteManga(id);
|
||||||
|
return "redirect:/creatorAction/1";
|
||||||
|
}
|
||||||
|
}
|
@ -21,12 +21,12 @@ public class CreatorController {
|
|||||||
return new CreatorMangaDto(creatorService.findCreator(id));
|
return new CreatorMangaDto(creatorService.findCreator(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @GetMapping
|
@GetMapping
|
||||||
public List<CreatorMangaDto> getCreators() {
|
public List<CreatorMangaDto> getCreators() {
|
||||||
return creatorService.findAllCreators().stream()
|
return creatorService.findAllCreators().stream()
|
||||||
.map(CreatorMangaDto::new)
|
.map(CreatorMangaDto::new)
|
||||||
.toList();
|
.toList();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CreatorMangaDto createCreator(@RequestParam("creatorName") String creatorName,
|
public CreatorMangaDto createCreator(@RequestParam("creatorName") String creatorName,
|
||||||
|
@ -32,12 +32,11 @@ public class Manga {
|
|||||||
public Manga() {
|
public Manga() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Manga(Creator creator, String mangaName, Integer chapterCount) {
|
public Manga(Creator creator, String mangaName, Integer chapterCount, String image) {
|
||||||
this.creator = creator;
|
this.creator = creator;
|
||||||
this.creatorId = creatorId;
|
|
||||||
this.mangaName = mangaName;
|
this.mangaName = mangaName;
|
||||||
this.chapterCount = chapterCount;
|
this.chapterCount = chapterCount;
|
||||||
this.image = image;
|
this.image = image.getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Manga(Creator creator, MangaDto mangaDto) {
|
public Manga(Creator creator, MangaDto mangaDto) {
|
||||||
|
@ -44,4 +44,17 @@ public class MangaDto {
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setrMangaName(String mangaName) {
|
||||||
|
this.mangaName = mangaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChapterCount(Integer chapterCount) {
|
||||||
|
this.chapterCount = chapterCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatorId(Long creatorId) {
|
||||||
|
this.creatorId = creatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {this.image = image;}
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,12 @@ public class ReaderDto {
|
|||||||
public String getReaderName() { return readerName; }
|
public String getReaderName() { return readerName; }
|
||||||
|
|
||||||
public String getHashedPassword() { return hashedPassword; }
|
public String getHashedPassword() { return hashedPassword; }
|
||||||
|
|
||||||
|
public void setrRaderName(String readerName) {
|
||||||
|
this.readerName = readerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHashedPassword(String hashedPassword) {
|
||||||
|
this.hashedPassword = hashedPassword;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ public class MangaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Manga addManga(Long creatorId, Integer chapterCount, String mangaName) {
|
public Manga addManga(Long creatorId, Integer chapterCount, String mangaName, String Image) {
|
||||||
final Creator currentCreator = findCreator(creatorId);
|
final Creator currentCreator = findCreator(creatorId);
|
||||||
final Manga manga = new Manga(currentCreator, mangaName, chapterCount);
|
final Manga manga = new Manga(currentCreator, mangaName, chapterCount, Image);
|
||||||
validatorUtil.validate(manga);
|
validatorUtil.validate(manga);
|
||||||
return mangaRepository.save(manga);
|
return mangaRepository.save(manga);
|
||||||
}
|
}
|
||||||
@ -72,9 +72,10 @@ public class MangaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Manga updateManga(Long id, Integer chapterCount) {
|
public Manga updateManga(Long id, Integer chapterCount, String Image) {
|
||||||
final Manga currentManga = findManga(id);
|
final Manga currentManga = findManga(id);
|
||||||
currentManga.setChapterCount(chapterCount);
|
currentManga.setChapterCount(chapterCount);
|
||||||
|
currentManga.setImage(Image.getBytes());
|
||||||
validatorUtil.validate(currentManga);
|
validatorUtil.validate(currentManga);
|
||||||
return currentManga;
|
return currentManga;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
spring.main.banner-mode=off
|
spring.main.banner-mode=off
|
||||||
server.port=8079
|
server.port=8080
|
||||||
spring.datasource.url=jdbc:h2:file:./data
|
spring.datasource.url=jdbc:h2:file:./data
|
||||||
spring.datasource.driverClassName=org.h2.Driver
|
spring.datasource.driverClassName=org.h2.Driver
|
||||||
spring.datasource.username=sa
|
spring.datasource.username=sa
|
||||||
|
@ -1,4 +1,37 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg"
|
<?xml version="1.0" standalone="no"?>
|
||||||
viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||||
<path d="M448 48V384c-63.09 22.54-82.34 32-119.5 32c-62.82 0-86.6-32-149.3-32C158.6 384 142.6 387.6 128 392.2v-64C142.6 323.6 158.6 320 179.2 320c62.73 0 86.51 32 149.3 32C348.9 352 364.1 349 384 342.7v-208C364.1 141 348.9 144 328.5 144c-62.82 0-86.6-32-149.3-32C128.4 112 104.3 132.6 64 140.7v307.3C64 465.7 49.67 480 32 480S0 465.7 0 448V63.1C0 46.33 14.33 32 31.1 32S64 46.33 64 63.1V76.66C104.3 68.63 128.4 48 179.2 48c62.73 0 86.51 32 149.3 32C365.7 80 384.9 70.54 448 48z"/>
|
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||||
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1280.000000pt" height="1280.000000pt" viewBox="0 0 1280.000000 1280.000000"
|
||||||
|
preserveAspectRatio="xMidYMid meet">
|
||||||
|
<metadata>
|
||||||
|
Created by potrace 1.15, written by Peter Selinger 2001-2017
|
||||||
|
</metadata>
|
||||||
|
<g transform="translate(0.000000,1280.000000) scale(0.100000,-0.100000)"
|
||||||
|
fill="#000000" stroke="none">
|
||||||
|
<path d="M6090 12534 c-883 -44 -1693 -246 -2418 -604 -635 -313 -1146 -683
|
||||||
|
-1683 -1220 -1069 -1067 -1655 -2308 -1794 -3795 -22 -238 -30 -735 -16 -980
|
||||||
|
78 -1331 506 -2470 1306 -3470 280 -349 669 -743 1015 -1026 886 -725 1894
|
||||||
|
-1159 3035 -1308 299 -39 429 -46 870 -46 460 1 593 9 955 61 1137 162 2166
|
||||||
|
630 3055 1390 193 164 595 566 759 759 605 708 1027 1507 1251 2368 309 1191
|
||||||
|
269 2518 -110 3662 -317 956 -904 1845 -1705 2581 -1050 964 -2228 1484 -3640
|
||||||
|
1609 -167 15 -721 27 -880 19z m-141 -848 c-2 -2 -53 -25 -114 -50 -560 -238
|
||||||
|
-1123 -701 -1404 -1153 -235 -379 -358 -823 -380 -1369 -32 -790 142 -1362
|
||||||
|
564 -1852 156 -181 413 -398 660 -558 228 -147 595 -288 1140 -439 704 -195
|
||||||
|
876 -254 1145 -391 69 -35 159 -85 200 -112 41 -27 116 -72 165 -102 395 -233
|
||||||
|
696 -560 910 -987 122 -245 201 -498 247 -793 18 -114 18 -599 0 -740 -23
|
||||||
|
-182 -62 -360 -113 -516 -190 -578 -549 -979 -1124 -1255 -378 -182 -772 -281
|
||||||
|
-1360 -341 -73 -8 -274 -13 -515 -13 -415 0 -507 7 -785 56 -678 122 -1390
|
||||||
|
456 -1991 934 -1176 936 -1894 2146 -2088 3518 -44 309 -51 415 -51 792 0 377
|
||||||
|
7 487 51 793 137 964 544 1858 1207 2652 909 1089 2055 1733 3377 1899 91 11
|
||||||
|
181 22 200 24 19 2 41 5 49 5 8 1 12 0 10 -2z m576 -1850 c126 -41 218 -98
|
||||||
|
316 -195 74 -73 93 -100 132 -181 25 -52 51 -120 58 -150 20 -82 17 -300 -5
|
||||||
|
-380 -55 -201 -203 -378 -391 -470 -100 -49 -182 -69 -310 -76 -220 -12 -403
|
||||||
|
54 -568 206 -91 84 -156 184 -193 296 -27 83 -29 100 -29 239 1 143 2 154 32
|
||||||
|
232 87 228 281 414 508 486 77 24 90 26 235 23 114 -3 148 -8 215 -30z"/>
|
||||||
|
<path d="M6130 4301 c-162 -35 -293 -106 -419 -225 -116 -112 -199 -251 -242
|
||||||
|
-411 -32 -115 -32 -345 0 -460 85 -311 327 -549 639 -627 121 -31 313 -30 427
|
||||||
|
1 255 69 477 256 595 503 145 302 87 700 -137 939 -131 138 -252 215 -420 265
|
||||||
|
-120 36 -317 43 -443 15z"/>
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
Before Width: | Height: | Size: 727 B After Width: | Height: | Size: 2.2 KiB |
36
src/main/resources/templates/creatorAction-edit.html
Normal file
36
src/main/resources/templates/creatorAction-edit.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||||
|
<form action="#" th:action="@{/creatorAction/1/manga/{id}(id=${mangaId})}" th:object="${MangaDto}" enctype="multipart/form-data" method="post">
|
||||||
|
<div class="mb-3" th:if="${creatorId != null}">
|
||||||
|
<label for="chapterCount" class="form-label">mangaName</label>
|
||||||
|
<input id="mangaName" type='text' value class="form-control" th:field="${MangaDto.mangaName}" required="true"/>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="chapterCount" class="form-label">chapterCount</label>
|
||||||
|
<input id="chapterCount" type='number' value class="form-control" th:field="${MangaDto.chapterCount}" required="true"/>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="image" class="form-label">image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/png, image/jpeg" />
|
||||||
|
<!--<input id="image" type="file" name="image" class="form-control text-white" accept="image/png, image/jpeg" th:field="${MangaDto.image}" required="true"/>-->
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<button type="submit" class="btn btn-primary button-fixed">
|
||||||
|
<span th:if="${creatorId != null}">Добавить</span>
|
||||||
|
<span th:if="${creatorId == null}">Обновить</span>
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/creator}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
83
src/main/resources/templates/creatorAction.html
Normal file
83
src/main/resources/templates/creatorAction.html
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container" id="root-div" layout:fragment="content">
|
||||||
|
<div class="content">
|
||||||
|
<h1>Creator</h1>
|
||||||
|
<form id="form">
|
||||||
|
<div class="d-flex mt-3">
|
||||||
|
<div class="d-grid col-sm-2">
|
||||||
|
<a class="btn btn-success"
|
||||||
|
th:href="@{/creatorAction/create/1}">
|
||||||
|
<i class="fa-solid fa-plus"></i> Добавить
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="row table-responsive text-white">
|
||||||
|
<div th:each="manga, iterator: ${creator?.mangas}" class="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||||
|
<div class="me-3">
|
||||||
|
<a th:href="@{/mangapage/{id}(id=${manga.id})}"><img th:src="${manga.image}" th:alt="${manga.mangaName}" class="slideshow"/></a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="pt-3 description d-flex flex-column justify-content-start mb-3 fs-6 fw-bold">
|
||||||
|
<h4>Название манги: <a class="text-white fs-5 unic_class fw-bold pt-3 mb-3" th:href="@{/mangapage/{id}(id=${manga.id})}" th:text="${manga.mangaName}"></a></h4>
|
||||||
|
<h4>
|
||||||
|
Количество глав:
|
||||||
|
<span th:text="${manga.chapterCount}"/>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-primary" th:href="@{/creatorAction/edit/{id}(id=${manga.id})}">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
</button>
|
||||||
|
<button class="delete bg-danger p-2 px-2 mx-2 border border-0 rounded text-white fw-bold" type="button">Удалить</button>
|
||||||
|
|
||||||
|
<button type="button" class="delete bg-danger p-2 px-2 mx-2 border border-0 rounded text-white fw-bold"
|
||||||
|
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${manga.id}').click()|">
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||||
|
</button>
|
||||||
|
<form th:action="@{/creatorAction/delete/{id}(id=${manga.id})}" method="post">
|
||||||
|
<button th:id="'remove-' + ${manga.id}" type="submit" style="display: none">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<!--<th:block layout:fragment="scripts">
|
||||||
|
<script>
|
||||||
|
let buttonAdd = document.getElementById("buttonAdd");
|
||||||
|
let selectCreatorId = document.getElementById("creatorId");
|
||||||
|
const host = "http://localhost:8080";
|
||||||
|
|
||||||
|
buttonAdd.addEventListener('click', function (event){
|
||||||
|
event.preventDefault();
|
||||||
|
create(selectCreatorId.value);
|
||||||
|
});
|
||||||
|
const create = async function (creatorId) {
|
||||||
|
const requestParams = {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
console.log(creatorId);
|
||||||
|
|
||||||
|
const response = await fetch(host + `/creatorAction?creatorId=${creatorId}`, requestParams);
|
||||||
|
return await response.json();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</th:block>-->
|
||||||
|
</html>
|
@ -4,10 +4,10 @@
|
|||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<title>IP Example</title>
|
<title>ReManga</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<link rel="icon" href="/favicon.svg">
|
|
||||||
<script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
|
<script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<link rel="icon" href="/favicon.svg">
|
||||||
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/>
|
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/>
|
||||||
<link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/>
|
<link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/>
|
||||||
<link rel="stylesheet" href="/css/style.css"/>
|
<link rel="stylesheet" href="/css/style.css"/>
|
||||||
@ -16,8 +16,8 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="/">
|
<a class="navbar-brand" href="/">
|
||||||
<i class="fa-solid fa-font-awesome"></i>
|
<i class="fa-solid fa-yin-yang"></i>
|
||||||
IP Example
|
ReManga
|
||||||
</a>
|
</a>
|
||||||
<button class="navbar-toggler" type="button"
|
<button class="navbar-toggler" type="button"
|
||||||
data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<a class="nav-link" href="/">Index</a>
|
<a class="nav-link" href="/">Index</a>
|
||||||
<a class="nav-link" th:href="@{/creator}">Creator</a>
|
<a class="nav-link" th:href="@{/creator}">Creator</a>
|
||||||
<a class="nav-link" href="/reader">Reader</a>
|
<a class="nav-link" href="/reader">Reader</a>
|
||||||
<a class="nav-link" href="/creatorAction">CreatorAction</a>
|
<a class="nav-link" href="/creatorAction/1">CreatorAction</a>
|
||||||
<a class="nav-link" href="/readerAction">ReaderAction</a>
|
<a class="nav-link" href="/readerAction">ReaderAction</a>
|
||||||
<a class="nav-link" href="/catalog">Catalog</a>
|
<a class="nav-link" href="/catalog">Catalog</a>
|
||||||
<a class="nav-link" href="/mangaPage">MangaPage</a>
|
<a class="nav-link" href="/mangaPage">MangaPage</a>
|
||||||
|
@ -32,8 +32,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
|
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
@ -54,7 +54,7 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "vagabond", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
Reader r2 = readerService.addReader("2", "2");
|
Reader r2 = readerService.addReader("2", "2");
|
||||||
Reader r3 = readerService.addReader("3", "3");
|
Reader r3 = readerService.addReader("3", "3");
|
||||||
@ -93,9 +93,9 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Manga m3 = mangaService.addManga(c1.getId(), 0, "Manga_3");
|
Manga m3 = mangaService.addManga(c1.getId(), 0, "Manga_3", "1");
|
||||||
Creator c2 = creatorService.findCreator(c1.getId());
|
Creator c2 = creatorService.findCreator(c1.getId());
|
||||||
Assertions.assertEquals(3, c2.getMangas().size());
|
Assertions.assertEquals(3, c2.getMangas().size());
|
||||||
readerService.deleteAllReaders();
|
readerService.deleteAllReaders();
|
||||||
@ -187,8 +187,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
creatorService.deleteCreator(c1.getId());
|
creatorService.deleteCreator(c1.getId());
|
||||||
log.info(mangaService.findAllMangas().toString());
|
log.info(mangaService.findAllMangas().toString());
|
||||||
Assertions.assertEquals(0, mangaService.findAllMangas().size());
|
Assertions.assertEquals(0, mangaService.findAllMangas().size());
|
||||||
@ -217,8 +217,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("1", "1");
|
Reader r1 = readerService.addReader("1", "1");
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
readerService.addManga(m2.getId(), r1.getId());
|
readerService.addManga(m2.getId(), r1.getId());
|
||||||
@ -236,8 +236,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
c1 = creatorService.findCreator(c1.getId());
|
c1 = creatorService.findCreator(c1.getId());
|
||||||
m1 = mangaService.findManga(m1.getId());
|
m1 = mangaService.findManga(m1.getId());
|
||||||
log.info(c1.getMangas().toString());
|
log.info(c1.getMangas().toString());
|
||||||
@ -254,8 +254,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.updateManga(m1.getId(), 10);
|
Manga m2 = mangaService.updateManga(m1.getId(), 10, "1");
|
||||||
m2 = mangaService.findManga(m2.getId());
|
m2 = mangaService.findManga(m2.getId());
|
||||||
c1 = creatorService.findCreator(c1.getId());
|
c1 = creatorService.findCreator(c1.getId());
|
||||||
log.info(m2.toString());
|
log.info(m2.toString());
|
||||||
@ -274,8 +274,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("reader1", "password1");
|
Reader r1 = readerService.addReader("reader1", "password1");
|
||||||
|
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
@ -299,8 +299,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first", "1");
|
Creator c1 = creatorService.addCreator("first", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
Assertions.assertEquals(0, mangaService.findAllMangas().size());
|
Assertions.assertEquals(0, mangaService.findAllMangas().size());
|
||||||
readerService.deleteAllReaders();
|
readerService.deleteAllReaders();
|
||||||
@ -314,8 +314,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
|
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
@ -358,8 +358,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
|
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
@ -384,8 +384,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
Reader r2 = readerService.addReader("2_R", "2");
|
Reader r2 = readerService.addReader("2_R", "2");
|
||||||
|
|
||||||
@ -410,8 +410,8 @@ public class ReMangaTest {
|
|||||||
mangaService.deleteAllMangas();
|
mangaService.deleteAllMangas();
|
||||||
creatorService.deleteAllCreators();
|
creatorService.deleteAllCreators();
|
||||||
Creator c1 = creatorService.addCreator("first_C", "1");
|
Creator c1 = creatorService.addCreator("first_C", "1");
|
||||||
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond");
|
Manga m1 = mangaService.addManga(c1.getId(), 0, "Vagabond", "1");
|
||||||
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk");
|
Manga m2 = mangaService.addManga(c1.getId(), 10, "Berserk", "1");
|
||||||
Reader r1 = readerService.addReader("first_R", "1");
|
Reader r1 = readerService.addReader("first_R", "1");
|
||||||
|
|
||||||
readerService.addManga(m1.getId(), r1.getId());
|
readerService.addManga(m1.getId(), r1.getId());
|
||||||
|
Loading…
Reference in New Issue
Block a user