Resolve "Ping конференции в списке конференций" #196

Merged
VladimirZarayskiy merged 44 commits from 68-ping-conf into dev 2019-04-25 14:00:36 +04:00
4 changed files with 13 additions and 4 deletions
Showing only changes of commit 59887e5141 - Show all commits

View File

@ -71,6 +71,13 @@ public class TaskController {
return TASK_PAGE; return TASK_PAGE;
} }
@GetMapping("/delete/{task-id}")
public String delete(@PathVariable("task-id") Integer taskId) throws IOException {
taskService.delete(taskId);
return String.format(REDIRECT_TO, TASKS_PAGE);
}
@ModelAttribute("allStatuses") @ModelAttribute("allStatuses")
public List<Task.TaskStatus> getTaskStatuses() { public List<Task.TaskStatus> getTaskStatuses() {
return taskService.getTaskStatuses(); return taskService.getTaskStatuses();

View File

@ -76,8 +76,10 @@ public class TaskService {
@Transactional @Transactional
public void delete(Integer taskId) throws IOException { public void delete(Integer taskId) throws IOException {
Task task = taskRepository.findOne(taskId); if (taskRepository.exists(taskId)) {
taskRepository.delete(task); taskRepository.delete(taskId);
}
} }
public void save(TaskDto taskDto) throws IOException { public void save(TaskDto taskDto) throws IOException {

View File

@ -90,7 +90,7 @@ $(document).ready(function () {
' <div class="modal-dialog modal-sm">\n' + ' <div class="modal-dialog modal-sm">\n' +
' <div class="modal-content">\n' + ' <div class="modal-content">\n' +
' <div class="modal-header">\n' + ' <div class="modal-header">\n' +
' <h8 class="modal-title" id="myModalLabel">Удалить статью?</h8>\n' + ' <h8 class="modal-title" id="myModalLabel">Удалить задачу?</h8>\n' +
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' + ' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
' aria-hidden="true">&times;</span></button>\n' + ' aria-hidden="true">&times;</span></button>\n' +
' </div>\n' + ' </div>\n' +

View File

@ -7,7 +7,7 @@
<body> <body>
<div class="container" layout:fragment="content"> <div class="container" layout:fragment="content">
<form id="tasks-form" method="post" th:action="@{'/tasks/tasks'}"> <form id="tasks-form" method="post" th:action="@{'/students/tasks'}">
<input th:type="hidden" name="taskDeleteId" id="taskDeleteId"/> <input th:type="hidden" name="taskDeleteId" id="taskDeleteId"/>
<section id="tasks"> <section id="tasks">
<div class="container"> <div class="container">