From 8cfc64ea85044ad88403a595b0a8726163ce37d5 Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Sun, 14 Apr 2019 20:42:11 +0400 Subject: [PATCH] #55 added delete input style --- .../conference/controller/ConferenceController.java | 13 ++++++------- .../ulstu/conference/service/ConferenceService.java | 5 ++++- src/main/resources/public/css/conference.css | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java index 61456c6..7a229ca 100644 --- a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java +++ b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java @@ -52,8 +52,9 @@ public class ConferenceController { @PostMapping(value = "/conference", params = "save") public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException { filterEmptyDeadlines(conferenceDto); - if (errors.hasErrors()) + if (errors.hasErrors()) { return CONFERENCE_PAGE; + } conferenceService.save(conferenceDto); return String.format(REDIRECT_TO, CONFERENCES_PAGE); @@ -62,8 +63,9 @@ public class ConferenceController { @PostMapping(value = "/conference", params = "addDeadline") public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) { filterEmptyDeadlines(conferenceDto); - if (errors.hasErrors()) + if (errors.hasErrors()) { return CONFERENCE_PAGE; + } conferenceDto.getDeadlines().add(new Deadline()); return CONFERENCE_PAGE; } @@ -71,13 +73,10 @@ public class ConferenceController { @PostMapping(value = "/conference", params = "removeDeadline") public String removeDeadline(@Valid ConferenceDto conferenceDto, Errors errors, @RequestParam(value = "removeDeadline") Integer deadlineIndex) throws IOException { - if (errors.hasErrors()) + if (errors.hasErrors()) { return CONFERENCE_PAGE; - conferenceService.removeDeadline(conferenceDto, deadlineIndex); - if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) { - conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId()); } - conferenceDto.getDeadlines().remove(conferenceDto.getDeadlines().get(deadlineIndex)); + conferenceService.removeDeadline(conferenceDto, deadlineIndex); return CONFERENCE_PAGE; } diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index ac44d4b..13ce1d5 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -65,7 +65,10 @@ public class ConferenceService { } public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException { - + if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) { + conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId()); + } + conferenceDto.getDeadlines().remove(conferenceDto.getDeadlines().get(deadlineIndex)); } private Conference copyFromDto(Conference conference, ConferenceDto conferenceDto) throws IOException { diff --git a/src/main/resources/public/css/conference.css b/src/main/resources/public/css/conference.css index ec88796..004fe8c 100644 --- a/src/main/resources/public/css/conference.css +++ b/src/main/resources/public/css/conference.css @@ -19,6 +19,7 @@ body { .deadline { margin: 0; height: 40px; + min-height: 40px; } .deadline-text { @@ -63,6 +64,9 @@ body { .icon-delete { background-color: #f44; + background-image: url(/img/conference/delete.png); + background-repeat: round; + color: transparent !important; } .icon-delete:hover {