#58 added delete method of conference
This commit is contained in:
parent
9e657a7d2d
commit
0cc8de2d32
@ -5,6 +5,7 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -60,6 +61,12 @@ public class ConferenceController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete/{conference-id}")
|
||||||
|
public String delete(@PathVariable("conference-id") Integer conferenceId) throws IOException {
|
||||||
|
conferenceService.delete(conferenceId);
|
||||||
|
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/conference", params = "addDeadline")
|
@PostMapping(value = "/conference", params = "addDeadline")
|
||||||
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
||||||
filterEmptyDeadlines(conferenceDto);
|
filterEmptyDeadlines(conferenceDto);
|
||||||
|
@ -64,6 +64,12 @@ public class ConferenceService {
|
|||||||
return conference.getId();
|
return conference.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void delete(Integer conferenceId) {
|
||||||
|
// Conference conference = conferenceRepository.findOne(conferenceId);
|
||||||
|
conferenceRepository.delete(conferenceId);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
||||||
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
||||||
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div th:fragment="confLine (conference)" class="row text-left paper-row" style="background-color: white;">
|
<div th:fragment="confLine (conference)" class="row text-left conference-row h3" style="background-color: white;">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<a th:href="@{'conference?id='+${conference.id}}">
|
<a th:href="@{'conference?id='+${conference.id}}">
|
||||||
<span class="h6" th:text="${conference.title}"/>
|
<span class="h5" th:text="${conference.title}"/>
|
||||||
</a>
|
</a>
|
||||||
<input class="id-class" type="hidden"/>
|
<input class="id-class" type="hidden" th:value="${conference.id}"/>
|
||||||
<a class="remove-paper pull-right d-none"
|
<a class="remove-paper pull-right" th:href="@{'/conferences/delete/'+${conference.id}}"
|
||||||
data-confirm="Удалить статью?">
|
data-confirm="Удалить статью?">
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user