#55 added method in controller
This commit is contained in:
parent
518f587eed
commit
689a7799e3
@ -11,6 +11,7 @@ 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.deadline.model.Deadline;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -61,6 +62,14 @@ public class ConferenceController {
|
||||
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "addDeadline")
|
||||
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
hasErrors(errors, CONFERENCE_PAGE);
|
||||
conferenceDto.getDeadlines().add(new Deadline());
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
||||
conferenceDto.setDeadlines(conferenceDto.getDeadlines().stream()
|
||||
.filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription()))
|
||||
|
@ -68,7 +68,7 @@
|
||||
class="alert alert-danger">Incorrect title</p>
|
||||
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<input type="submit" id="add-deadline" name="add-deadline"
|
||||
<input type="submit" id="addDeadline" name="addDeadline"
|
||||
class="btn btn-primary"
|
||||
value="Добавить дедлайн"/>
|
||||
</div>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./conference?id=0" class="btn btn-light toolbar-button">
|
||||
<i class="fa fa-plus-circle" aria-hidden="true"></i>
|
||||
Добавить конференцию</a>
|
||||
Новая конференцию</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user