From eb524d49d055dc436f47803f6dcacf6a7975ba96 Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Fri, 5 Apr 2019 18:01:43 +0400 Subject: [PATCH] #55 added html side, don't work, because can't parse date, like in deadlines --- .../controller/ConferenceController.java | 9 +++--- .../ru/ulstu/conference/model/Conference.java | 9 ++++-- .../templates/conferences/conference.html | 30 ++++++++++++------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java index 0da8d8d..f3c4864 100644 --- a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java +++ b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java @@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestParam; import ru.ulstu.conference.model.ConferenceDto; import ru.ulstu.conference.model.ConferenceFilterDto; import ru.ulstu.conference.service.ConferenceService; -import ru.ulstu.paper.model.PaperDto; import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; @@ -27,8 +26,8 @@ public class ConferenceController { private final ConferenceService conferenceService; - public ConferenceController(ConferenceService paperService) { - this.conferenceService = paperService; + public ConferenceController(ConferenceService conferenceService) { + this.conferenceService = conferenceService; } @GetMapping("/conferences") @@ -42,7 +41,7 @@ public class ConferenceController { if (id != null && id > 0) { modelMap.put("conferenceDto", conferenceService.findOneDto(id)); } else { - modelMap.put("conferenceDto", new PaperDto()); + modelMap.put("conferenceDto", new ConferenceDto()); } } @@ -53,10 +52,12 @@ public class ConferenceController { errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } if (errors.hasErrors()) { + System.out.println("я здесь 2"); return "/conferences/conference"; } conferenceService.save(conferenceDto); return "redirect:/conferences/conferences"; + } private void filterEmptyDeadlines(ConferenceDto conferenceDto) { diff --git a/src/main/java/ru/ulstu/conference/model/Conference.java b/src/main/java/ru/ulstu/conference/model/Conference.java index 8cb1c64..1c824b3 100644 --- a/src/main/java/ru/ulstu/conference/model/Conference.java +++ b/src/main/java/ru/ulstu/conference/model/Conference.java @@ -3,6 +3,7 @@ package ru.ulstu.conference.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.validator.constraints.NotBlank; +import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.paper.model.Paper; @@ -41,11 +42,13 @@ public class Conference extends BaseEntity { @Column(name = "begin_date") @Temporal(TemporalType.TIMESTAMP) - private Date beginDate = new Date(); - + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date beginDate; + @Column(name = "end_date") @Temporal(TemporalType.TIMESTAMP) - private Date endDate = new Date(); + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date endDate; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "conference_id", unique = true) diff --git a/src/main/resources/templates/conferences/conference.html b/src/main/resources/templates/conferences/conference.html index 7e8d0b7..3330bed 100644 --- a/src/main/resources/templates/conferences/conference.html +++ b/src/main/resources/templates/conferences/conference.html @@ -28,36 +28,44 @@
-
-
-
- -
+
+ - + placeholder="Описание" + th:field="*{deadlines[__${rowStat.index}__].description}"/> + Удалить + alt="Удалить" + th:onclick="|$('#deadlines${rowStat.index}\\.description').val(''); + $('#deadlines${rowStat.index}\\.date').val(''); + $('#addDeadline').click();|"/>
+

Incorrect title

- +
- +