Resolve "Добавление новой конференции" #170

Merged
VladimirZarayskiy merged 1 commits from 55-new-conf into dev 2019-04-08 07:33:41 +04:00
6 changed files with 19 additions and 31 deletions

View File

@ -18,10 +18,10 @@ import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.springframework.util.StringUtils.isEmpty; import static org.springframework.util.StringUtils.isEmpty;
import static ru.ulstu.conference.controller.NavigationController.CONFERENCES_PAGE; import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE;
import static ru.ulstu.conference.controller.NavigationController.CONFERENCE_PAGE; import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE;
import static ru.ulstu.conference.controller.NavigationController.REDIRECT_TO; import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
import static ru.ulstu.grant.controller.Navigation.hasErrors; import static ru.ulstu.core.controller.Navigation.hasErrors;
@Controller() @Controller()
@ -37,8 +37,7 @@ public class ConferenceController {
@GetMapping("/conferences") @GetMapping("/conferences")
public void getConferences(ModelMap modelMap) { public void getConferences(ModelMap modelMap) {
modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto(), modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto()));
null, null));
} }
@GetMapping("/conference") @GetMapping("/conference")

View File

@ -17,6 +17,10 @@ public class ConferenceFilterDto {
this.year = year; this.year = year;
} }
public ConferenceFilterDto(List<ConferenceDto> conferenceDtos) {
this(conferenceDtos, null, null);
}
public List<ConferenceDto> getConferences() { public List<ConferenceDto> getConferences() {
return conferences; return conferences;
} }

View File

@ -1,10 +1,12 @@
package ru.ulstu.conference.controller; package ru.ulstu.core.controller;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
public class NavigationController { public class Navigation {
public static final String REDIRECT_TO = "redirect:%s"; public static final String REDIRECT_TO = "redirect:%s";
public static final String GRANTS_PAGE = "/grants/grants";
public static final String GRANT_PAGE = "/grants/grant";
public static final String CONFERENCES_PAGE = "/conferences/conferences"; public static final String CONFERENCES_PAGE = "/conferences/conferences";
public static final String CONFERENCE_PAGE = "/conferences/conference"; public static final String CONFERENCE_PAGE = "/conferences/conference";
@ -14,5 +16,4 @@ public class NavigationController {
} }
return null; return null;
} }
} }

View File

@ -21,10 +21,10 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.springframework.util.StringUtils.isEmpty; import static org.springframework.util.StringUtils.isEmpty;
import static ru.ulstu.grant.controller.Navigation.GRANTS_PAGE; import static ru.ulstu.core.controller.Navigation.GRANTS_PAGE;
import static ru.ulstu.grant.controller.Navigation.GRANT_PAGE; import static ru.ulstu.core.controller.Navigation.GRANT_PAGE;
import static ru.ulstu.grant.controller.Navigation.REDIRECT_TO; import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
import static ru.ulstu.grant.controller.Navigation.hasErrors; import static ru.ulstu.core.controller.Navigation.hasErrors;
@Controller() @Controller()

View File

@ -1,16 +0,0 @@
package ru.ulstu.grant.controller;
import org.springframework.validation.Errors;
public class Navigation {
public static final String REDIRECT_TO = "redirect:%s";
public static final String GRANTS_PAGE = "/grants/grants";
public static final String GRANT_PAGE = "/grants/grant";
public static String hasErrors(Errors errors, String page) {
if (errors.hasErrors()) {
return page;
}
return null;
}
}

View File

@ -6,7 +6,7 @@
<body> <body>
<div th:fragment="confLine (conference)" class="row text-left paper-row" style="background-color: white;"> <div th:fragment="confLine (conference)" class="row text-left paper-row" style="background-color: white;">
<div class="col"> <div class="col">
<a th:href="@{'conf?id='+${conference.id}}"> <a th:href="@{'conference?id='+${conference.id}}">
<span class="h6" th:text="${conference.title}"/> <span class="h6" th:text="${conference.title}"/>
</a> </a>
<input class="id-class" type="hidden"/> <input class="id-class" type="hidden"/>