#65 added delete method of article, fixed copyFromDto method
This commit is contained in:
parent
3facc0c26e
commit
81d07645c2
@ -94,6 +94,16 @@ public class ConferenceController {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "removePaper")
|
||||
public String removePaper(@Valid ConferenceDto conferenceDto, Errors errors,
|
||||
@RequestParam(value = "removePaper") Integer paperIndex) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
conferenceService.removePaper(conferenceDto, paperIndex);
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
public List<Paper> getNotSelectPapers(List<Integer> paperIds) {
|
||||
return conferenceService.getConferencePapers(paperIds);
|
||||
}
|
||||
|
@ -83,6 +83,11 @@ public class ConferenceService {
|
||||
conferenceDto.getDeadlines().remove((int) deadlineIndex);
|
||||
}
|
||||
|
||||
public void removePaper(ConferenceDto conferenceDto, Integer paperIndex) throws IOException {
|
||||
Paper removedPaper = conferenceDto.getPapers().remove((int) paperIndex);
|
||||
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
||||
}
|
||||
|
||||
public List<Paper> getConferencePapers(List<Integer> paperIds) {
|
||||
return paperService.findAllNotSelect(paperIds);
|
||||
}
|
||||
@ -94,6 +99,7 @@ public class ConferenceService {
|
||||
conference.setPing(0);
|
||||
conference.setBeginDate(conferenceDto.getBeginDate());
|
||||
conference.setEndDate(conferenceDto.getEndDate());
|
||||
conference.setPapers(conferenceDto.getPapers());
|
||||
conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));
|
||||
if (conferenceDto.getPaperIds() != null && !conferenceDto.getPaperIds().isEmpty()) {
|
||||
conferenceDto.getPaperIds().forEach(paperId ->
|
||||
|
@ -60,8 +60,7 @@
|
||||
<input class="list-group-item" type="date" name="deadline"
|
||||
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
||||
<input type="submit" class="icon icon-delete grey-border"
|
||||
alt="Удалить" name="removeDeadline" th:value="${rowStat.index}"
|
||||
/>
|
||||
alt="Удалить" name="removeDeadline" th:value="${rowStat.index}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -146,7 +145,7 @@
|
||||
<img class="icon-paper" src="/img/conference/paper.png"/>
|
||||
</a>
|
||||
<input type="submit" class="icon icon-delete grey-border"
|
||||
alt="Удалить"/>
|
||||
alt="Удалить" name="removePaper" th:value="${rowStat.index}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user