#55 added transition to the page new conference

This commit is contained in:
Nightblade73 2019-04-05 13:21:15 +04:00
parent 9d69f75530
commit d6b7fe790a
3 changed files with 20 additions and 14 deletions

View File

@ -5,8 +5,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ru.ulstu.conference.model.ConferenceFilterDto; import ru.ulstu.conference.model.ConferenceFilterDto;
import ru.ulstu.conference.service.ConferenceService; import ru.ulstu.conference.service.ConferenceService;
import ru.ulstu.paper.model.PaperDto;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@Controller() @Controller()
@ -22,6 +24,16 @@ public class ConferenceController {
@GetMapping("/conferences") @GetMapping("/conferences")
public void getConferences(ModelMap modelMap) { 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());
}
} }
} }

View File

@ -34,17 +34,9 @@ public class ConferenceService {
return conferences; return conferences;
} }
// private List<Paper> sortPapers(List<Conference> conferences) { public ConferenceDto findOneDto(Integer id) {
// return conferences.stream().sorted((paper1, paper2) -> { return new ConferenceDto(conferenceRepository.findOne(id));
// 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());
// }
} }

View File

@ -18,11 +18,13 @@
<hr/> <hr/>
<div class="row"> <div class="row">
<div class="col-lg-12"> <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="row">
<div class="col-md-7 col-sm-12"> <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"> <div class="form-group">
<label for="title">Название:</label> <label for="title">Название:</label>