merge-requests/47/head
ASH 5 years ago
parent f019806a8e
commit 5eae7305c4

@ -11,6 +11,7 @@ import ru.ulstu.tags.model.Tag;
import ru.ulstu.tags.model.TagDto;
import springfox.documentation.annotations.ApiIgnore;
import ru.ulstu.students.service.TaskService;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
@ -55,7 +56,7 @@ public class TaskController {
if (taskDto.getDeadlines().isEmpty()) {
errors.rejectValue("deadlines", "errorCode", "Не может быть пустым");
}
if(errors.hasErrors())
if (errors.hasErrors())
return TASK_PAGE;
taskService.save(taskDto);
return String.format(REDIRECT_TO, TASKS_PAGE);
@ -64,7 +65,7 @@ public class TaskController {
@PostMapping(value = "/task", params = "addDeadline")
public String addDeadline(@Valid TaskDto taskDto, Errors errors) {
filterEmptyDeadlines(taskDto);
if(errors.hasErrors())
if (errors.hasErrors())
return TASK_PAGE;
taskDto.getDeadlines().add(new Deadline());
return TASK_PAGE;

@ -36,14 +36,14 @@ public class TaskDto {
@JsonCreator
public TaskDto(@JsonProperty("id") Integer id,
@JsonProperty("title") String title,
@JsonProperty("description") String description,
@JsonProperty("createDate") Date createDate,
@JsonProperty("updateDate") Date updateDate,
@JsonProperty("status") Task.TaskStatus status,
@JsonProperty("deadlines") List<Deadline> deadlines,
@JsonProperty("tagIds") Set<Integer> tagIds,
@JsonProperty("tags") Set<TagDto> tags){
@JsonProperty("title") String title,
@JsonProperty("description") String description,
@JsonProperty("createDate") Date createDate,
@JsonProperty("updateDate") Date updateDate,
@JsonProperty("status") Task.TaskStatus status,
@JsonProperty("deadlines") List<Deadline> deadlines,
@JsonProperty("tagIds") Set<Integer> tagIds,
@JsonProperty("tags") Set<TagDto> tags) {
this.id = id;
this.title = title;
this.status = status;
@ -142,6 +142,6 @@ public class TaskDto {
return StringUtils.abbreviate(tags
.stream()
.map(tag -> tag.getTagName())
.collect(Collectors.joining(", ")), MAX_TAGS_LENGTH );
.collect(Collectors.joining(", ")), MAX_TAGS_LENGTH);
}
}

@ -28,7 +28,7 @@ public class TaskService {
private final TagService tagService;
public TaskService(TaskRepository grantRepository,
DeadlineService deadlineService, TagService tagService){
DeadlineService deadlineService, TagService tagService) {
this.taskRepository = grantRepository;
this.deadlineService = deadlineService;
this.tagService = tagService;

@ -3,6 +3,6 @@ package ru.ulstu.tags.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.ulstu.tags.model.TagDto;
public interface TagRepository extends JpaRepository<TagDto, Integer>{
public interface TagRepository extends JpaRepository<TagDto, Integer> {
}

@ -5,6 +5,7 @@ import org.springframework.stereotype.Service;
import ru.ulstu.tags.model.TagDto;
import ru.ulstu.tags.repository.TagRepository;
import javax.transaction.Transactional;
import java.util.Set;
import java.util.stream.Collectors;

@ -6,12 +6,12 @@
<body>
<div th:fragment="taskLine (task)" class="row text-left task-row" style="background-color: white;">
<div class="col">
<span th:replace="students/fragments/taskStatusFragment :: taskStatus(taskStatus=${task.status})" />
<a th:href="@{'task?id='+${task.id}}">
<span th:replace="students/fragments/taskStatusFragment :: taskStatus(taskStatus=${task.status})"/>
<a th:href="@{'task?id='+${task.id}}">
<span class="h6" th:text="${task.title}"></span>
<span class="text-muted" th:text="${task.tagsString}" />
<span class="text-muted" th:text="${task.tagsString}"/>
</a>
<input class="id-class" type="hidden" th:value="${task.id}" />
<input class="id-class" type="hidden" th:value="${task.id}"/>
<a class="remove-task pull-right d-none" th:href="@{'/students/delete/'+${task.id}}"
data-confirm="Удалить задачу?">
<i class="fa fa-trash" aria-hidden="true"></i>

@ -16,7 +16,7 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
<a href="./task?id=0" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle"
aria-hidden="true"></i>
aria-hidden="true"></i>
Добавить задачу</a>
</div>

@ -7,7 +7,7 @@
<span th:fragment="taskStatus (taskStatus)" class="fa-stack fa-1x">
<th:block th:switch="${taskStatus.name()}">
<!--<div th:case="'ATTENTION'">-->
<!--<i class="fa fa-circle fa-stack-2x text-warning"></i>-->
<!--<i class="fa fa-circle fa-stack-2x text-warning"></i>-->
<!--</div>-->
<div th:case="'IN_WORK'">
<i class="fa fa-circle fa-stack-2x text-primary"></i>

@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css"/>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css"/>
<link rel="stylesheet" href="../css/tasks.css"/>
</head>
<body>

Loading…
Cancel
Save