#55 added delete input style

This commit is contained in:
Nightblade73 2019-04-14 20:42:11 +04:00
parent 34499abd60
commit 8cfc64ea85
3 changed files with 14 additions and 8 deletions

View File

@ -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;
}

View File

@ -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 {

View File

@ -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 {