#62 remove verification of empty deadline list
This commit is contained in:
parent
d1813f656e
commit
b4a2a8086d
@ -19,9 +19,7 @@ import java.io.IOException;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.springframework.util.StringUtils.isEmpty;
|
import static org.springframework.util.StringUtils.isEmpty;
|
||||||
import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE;
|
import static ru.ulstu.core.controller.Navigation.*;
|
||||||
import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE;
|
|
||||||
import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
|
||||||
|
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@ -52,9 +50,6 @@ public class ConferenceController {
|
|||||||
@PostMapping(value = "/conference", params = "save")
|
@PostMapping(value = "/conference", params = "save")
|
||||||
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||||
filterEmptyDeadlines(conferenceDto);
|
filterEmptyDeadlines(conferenceDto);
|
||||||
if (conferenceDto.getDeadlines().isEmpty()) {
|
|
||||||
errors.rejectValue("deadlines", "errorCode", "Не может быть пустым");
|
|
||||||
}
|
|
||||||
if (errors.hasErrors())
|
if (errors.hasErrors())
|
||||||
return CONFERENCE_PAGE;
|
return CONFERENCE_PAGE;
|
||||||
conferenceService.save(conferenceDto);
|
conferenceService.save(conferenceDto);
|
||||||
@ -69,6 +64,8 @@ public class ConferenceController {
|
|||||||
return CONFERENCE_PAGE;
|
return CONFERENCE_PAGE;
|
||||||
conferenceDto.getDeadlines().add(new Deadline());
|
conferenceDto.getDeadlines().add(new Deadline());
|
||||||
return CONFERENCE_PAGE;
|
return CONFERENCE_PAGE;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
private void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
||||||
|
@ -11,11 +11,7 @@ import ru.ulstu.user.model.UserDto;
|
|||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||||
|
|
||||||
@ -36,7 +32,6 @@ public class ConferenceDto {
|
|||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date endDate = new Date();
|
private Date endDate = new Date();
|
||||||
@NotEmpty
|
|
||||||
private List<Deadline> deadlines = new ArrayList<>();
|
private List<Deadline> deadlines = new ArrayList<>();
|
||||||
private Set<Integer> userIds = new HashSet<>();
|
private Set<Integer> userIds = new HashSet<>();
|
||||||
private Set<Integer> paperIds = new HashSet<>();
|
private Set<Integer> paperIds = new HashSet<>();
|
||||||
@ -45,7 +40,6 @@ public class ConferenceDto {
|
|||||||
private Integer filterUserId;
|
private Integer filterUserId;
|
||||||
|
|
||||||
public ConferenceDto() {
|
public ConferenceDto() {
|
||||||
deadlines.add(new Deadline());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
|
@ -60,9 +60,7 @@
|
|||||||
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
||||||
<img class="icon icon-delete grey-border" src="/img/conference/delete.png"
|
<img class="icon icon-delete grey-border" src="/img/conference/delete.png"
|
||||||
alt="Удалить"
|
alt="Удалить"
|
||||||
th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
|
th:onclick="|$(this).parent().remove();|"/>
|
||||||
$('#deadlines${rowStat.index}\\.date').val('');
|
|
||||||
$('#addDeadline').click();|"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user