#55 added transition to the page new conference
This commit is contained in:
parent
9d69f75530
commit
d6b7fe790a
@ -5,8 +5,10 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.conference.model.ConferenceFilterDto;
|
||||
import ru.ulstu.conference.service.ConferenceService;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@Controller()
|
||||
@ -22,6 +24,16 @@ public class ConferenceController {
|
||||
|
||||
@GetMapping("/conferences")
|
||||
public void getConferences(ModelMap modelMap) {
|
||||
modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto(), null, null));
|
||||
modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto(),
|
||||
null, null));
|
||||
}
|
||||
|
||||
@GetMapping("/conference")
|
||||
public void getConference(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
|
||||
if (id != null && id > 0) {
|
||||
modelMap.put("conferenceDto", conferenceService.findOneDto(id));
|
||||
} else {
|
||||
modelMap.put("conferenceDto", new PaperDto());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,9 @@ public class ConferenceService {
|
||||
return conferences;
|
||||
}
|
||||
|
||||
// private List<Paper> sortPapers(List<Conference> conferences) {
|
||||
// return conferences.stream().sorted((paper1, paper2) -> {
|
||||
// int statusCompareResult =
|
||||
// Integer.valueOf(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper1.getStatus()))
|
||||
// .compareTo(Arrays.asList(Paper.PaperStatus.values()).indexOf(paper2.getStatus()));
|
||||
// if (statusCompareResult != 0) {
|
||||
// return statusCompareResult;
|
||||
// }
|
||||
// return paper1.getTitle().compareTo(paper2.getTitle());
|
||||
// }).collect(toList());
|
||||
// }
|
||||
public ConferenceDto findOneDto(Integer id) {
|
||||
return new ConferenceDto(conferenceRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,11 +18,13 @@
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="conference-form" method="post">
|
||||
<form id="conference-form" method="post"
|
||||
th:action="@{'/conferences/conference?id='+ *{id == null ? '' : id} + ''}"
|
||||
th:object="${conferenceDto}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-sm-12">
|
||||
<input type="hidden" name="id"/>
|
||||
<input type="hidden" name="id" th:field="*{id}"/>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Название:</label>
|
||||
|
Loading…
Reference in New Issue
Block a user