From b7226870509aae5dedc8da7bf984008041af5997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BD=20=D0=90=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=BD?= Date: Thu, 18 Apr 2019 10:32:43 +0300 Subject: [PATCH] #96 edit project page --- .../java/ru/ulstu/project/model/Project.java | 34 +++++++-- .../ru/ulstu/project/model/ProjectDto.java | 41 ++++++++-- .../fragments/projectLineFragment.html | 2 +- .../resources/templates/projects/project.html | 74 ++++++++++++++++++- 4 files changed, 134 insertions(+), 17 deletions(-) diff --git a/src/main/java/ru/ulstu/project/model/Project.java b/src/main/java/ru/ulstu/project/model/Project.java index 4432224..0db475d 100644 --- a/src/main/java/ru/ulstu/project/model/Project.java +++ b/src/main/java/ru/ulstu/project/model/Project.java @@ -3,6 +3,7 @@ package ru.ulstu.project.model; import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.grant.model.Grant; import javax.persistence.*; import javax.validation.constraints.NotNull; @@ -37,12 +38,19 @@ public class Project extends BaseEntity { private ProjectStatus status = ProjectStatus.APPLICATION; @NotNull - private String comment; + private String description; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name = "project_id") private List deadlines = new ArrayList<>(); + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "grant_id") + private Grant grant; + + @NotNull + private String repository; + public String getTitle() { return title; } @@ -59,12 +67,28 @@ public class Project extends BaseEntity { this.status = status; } - public String getComment() { - return comment; + public String getDescription() { + return description; } - public void setComment(String comment) { - this.comment = comment; + public void setDescription(String description) { + this.description = description; + } + + public Grant getGrant() { + return grant; + } + + public void setGrant(Grant grant) { + this.grant = grant; + } + + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; } public List getDeadlines() { diff --git a/src/main/java/ru/ulstu/project/model/ProjectDto.java b/src/main/java/ru/ulstu/project/model/ProjectDto.java index 237be0f..6c83d59 100644 --- a/src/main/java/ru/ulstu/project/model/ProjectDto.java +++ b/src/main/java/ru/ulstu/project/model/ProjectDto.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.grant.model.GrantDto; import java.util.ArrayList; import java.util.List; @@ -14,8 +15,10 @@ public class ProjectDto { @NotEmpty private String title; private Project.ProjectStatus status; - private String comment; + private String description; private List deadlines = new ArrayList<>(); + private GrantDto grant; + private String repository; public ProjectDto() { } @@ -28,12 +31,16 @@ public class ProjectDto { public ProjectDto(@JsonProperty("id") Integer id, @JsonProperty("title") String title, @JsonProperty("status") Project.ProjectStatus status, - @JsonProperty("comment") String comment, + @JsonProperty("description") String description, + @JsonProperty("grant") GrantDto grant, + @JsonProperty("repository") String repository, @JsonProperty("deadlines") List deadlines) { this.id = id; this.title = title; this.status = status; - this.comment = comment; + this.description = description; + this.grant = grant; + this.repository = repository; this.deadlines = deadlines; } @@ -42,7 +49,9 @@ public class ProjectDto { this.id = project.getId(); this.title = project.getTitle(); this.status = project.getStatus(); - this.comment = project.getComment(); + this.description = project.getDescription(); + this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant()); + this.repository = project.getRepository(); this.deadlines = project.getDeadlines(); } @@ -70,12 +79,28 @@ public class ProjectDto { this.status = status; } - public String getComment() { - return comment; + public String getDescription() { + return description; } - public void setComment(String comment) { - this.comment = comment; + public void setDescription(String description) { + this.description = description; + } + + public GrantDto getGrant() { + return grant; + } + + public void setGrant(GrantDto grant) { + this.grant = grant; + } + + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; } public List getDeadlines() { diff --git a/src/main/resources/templates/projects/fragments/projectLineFragment.html b/src/main/resources/templates/projects/fragments/projectLineFragment.html index ad517f1..3605273 100644 --- a/src/main/resources/templates/projects/fragments/projectLineFragment.html +++ b/src/main/resources/templates/projects/fragments/projectLineFragment.html @@ -9,7 +9,7 @@ - + diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html index 8374df1..3d356a7 100644 --- a/src/main/resources/templates/projects/project.html +++ b/src/main/resources/templates/projects/project.html @@ -44,9 +44,59 @@
- - + + +
+ +
+ +
+ +
+ +
+ +
+ + +

Incorrect repository link

+

+
+ +
+ +
+ +
+ +
+
+ +
+
+ + +
+
+

Incorrect title

+
+
+ +
+ +
+ +
+ +
@@ -68,6 +118,24 @@ + +