#66 fixed bug, when attach-article lose what needed to attach after add or remove deadline

This commit is contained in:
Nightblade73 2019-04-16 13:22:15 +04:00
parent dca644eba1
commit d4b38d314f
4 changed files with 32 additions and 10 deletions

View File

@ -48,11 +48,12 @@ public class ConferenceController {
public void getConference(ModelMap modelMap, @RequestParam(value = "id") Integer id) { public void getConference(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
if (id != null && id > 0) { if (id != null && id > 0) {
ConferenceDto conferenceDto = conferenceService.findOneDto(id); ConferenceDto conferenceDto = conferenceService.findOneDto(id);
conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds()));
modelMap.put("conferenceDto", conferenceDto); modelMap.put("conferenceDto", conferenceDto);
modelMap.put("allPapers", getAllPapers(conferenceDto.getPaperIds()));
} else { } else {
modelMap.put("conferenceDto", new ConferenceDto()); ConferenceDto conferenceDto = new ConferenceDto();
modelMap.put("allPapers", getAllPapers(new ArrayList<Integer>())); conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList<Integer>()));
modelMap.put("conferenceDto", conferenceDto);
} }
} }
@ -93,7 +94,7 @@ public class ConferenceController {
return CONFERENCE_PAGE; return CONFERENCE_PAGE;
} }
public List<Paper> getAllPapers(List<Integer> paperIds) { public List<Paper> getNotSelectPapers(List<Integer> paperIds) {
return conferenceService.getConferencePapers(paperIds); return conferenceService.getConferencePapers(paperIds);
} }

View File

@ -41,6 +41,9 @@ public class ConferenceDto {
private Set<Integer> userIds = new HashSet<>(); private Set<Integer> userIds = new HashSet<>();
private List<Integer> paperIds = new ArrayList<>(); private List<Integer> paperIds = new ArrayList<>();
private List<Paper> papers = new ArrayList<>(); private List<Paper> papers = new ArrayList<>();
private List<Paper> notSelectedPapers = new ArrayList<>();
private Set<UserDto> users = new HashSet<>(); private Set<UserDto> users = new HashSet<>();
private Integer filterUserId; private Integer filterUserId;
@ -59,7 +62,8 @@ public class ConferenceDto {
@JsonProperty("userIds") Set<Integer> userIds, @JsonProperty("userIds") Set<Integer> userIds,
@JsonProperty("paperIds") List<Integer> paperIds, @JsonProperty("paperIds") List<Integer> paperIds,
@JsonProperty("users") Set<UserDto> users, @JsonProperty("users") Set<UserDto> users,
@JsonProperty("papers") List<Paper> papers) { @JsonProperty("papers") List<Paper> papers,
@JsonProperty("notSelectedPapers") List<Paper> notSelectedPapers) {
this.id = id; this.id = id;
this.title = title; this.title = title;
this.description = description; this.description = description;
@ -72,6 +76,7 @@ public class ConferenceDto {
this.paperIds = paperIds; this.paperIds = paperIds;
this.users = users; this.users = users;
this.papers = papers; this.papers = papers;
this.notSelectedPapers = notSelectedPapers;
} }
public ConferenceDto(Conference conference) { public ConferenceDto(Conference conference) {
@ -202,4 +207,12 @@ public class ConferenceDto {
this.removedDeadlineIds = removedDeadlineIds; this.removedDeadlineIds = removedDeadlineIds;
} }
public List<Paper> getNotSelectedPapers() {
return notSelectedPapers;
}
public void setNotSelectedPapers(List<Paper> notSelectedPapers) {
this.notSelectedPapers = notSelectedPapers;
}
} }

View File

@ -7,6 +7,10 @@ body {
border-radius: .25rem; border-radius: .25rem;
} }
.filter-option-inner-inner {
color: white;
}
@ -49,6 +53,8 @@ body {
.paper { .paper {
margin: 0; margin: 0;
min-height: 40px;
height: 40px;
} }
.paper-name { .paper-name {
@ -104,13 +110,14 @@ body {
float: right; float: right;
} }
@media (max-width: 1199px) { @media (max-width: 1199px) and (min-width: 768px){
.paper-control { .paper-control {
display: block!important; display: block!important;
} }
} }
@media (max-width: 991px) { @media (max-width: 991px) {
.dates-panel { .dates-panel {
display: block!important; display: block!important;
} }

View File

@ -62,7 +62,6 @@
<input type="submit" class="icon icon-delete grey-border" <input type="submit" class="icon icon-delete grey-border"
alt="Удалить" name="removeDeadline" th:value="${rowStat.index}" alt="Удалить" name="removeDeadline" th:value="${rowStat.index}"
/> />
<!--th:onclick="|$(this).parent().remove();|"-->
</div> </div>
</div> </div>
</div> </div>
@ -136,6 +135,7 @@
<div class="form-group"> <div class="form-group">
<label for="papers">Статьи:</label> <label for="papers">Статьи:</label>
<div class="paper-list form-control list-group" id="papers"> <div class="paper-list form-control list-group" id="papers">
<input th:type="hidden" th:field="*{papers}"/>
<div class="paper d-flex list-group-item p-0" <div class="paper d-flex list-group-item p-0"
th:each="paper, rowStat : *{papers}"> th:each="paper, rowStat : *{papers}">
<a class="paper-name" <a class="paper-name"
@ -145,16 +145,17 @@
</span> </span>
<img class="icon-paper" src="/img/conference/paper.png"/> <img class="icon-paper" src="/img/conference/paper.png"/>
</a> </a>
<img class="icon grey-border icon-delete" src="/img/conference/delete.png" <input type="submit" class="icon icon-delete grey-border"
alt="Удалить"/> alt="Удалить"/>
</div> </div>
</div> </div>
</div> </div>
<div class="paper-control form-group d-flex justify-content-end"> <div class="paper-control form-group d-flex justify-content-end">
<input th:type="hidden" th:field="*{notSelectedPapers}"/>
<select class="selectpicker form-control" multiple="true" data-live-search="true" <select class="selectpicker form-control" multiple="true" data-live-search="true"
title="Прикрепить статью" data-style="btn-primary" data-size="5" title="Прикрепить статью" data-style="btn-primary" data-size="5"
th:field="*{paperIds}"> th:field="*{paperIds}">
<option th:each="paper: ${allPapers}" th:value="${paper.id}" <option th:each="paper: *{notSelectedPapers}" th:value="${paper.id}"
th:text="${paper.title}">Status th:text="${paper.title}">Status
</option> </option>
</select> </select>