Merge remote-tracking branch 'remotes/origin/dev' into 68-ping-conf
# Conflicts: # src/main/java/ru/ulstu/conference/repository/ConferenceRepository.java # src/main/java/ru/ulstu/conference/service/ConferenceService.java # src/main/resources/db/changelog-master.xml
This commit is contained in:
commit
bc73265109
@ -6,7 +6,6 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -70,6 +69,12 @@ public class ConferenceController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conferences", params = "deleteConference")
|
||||
public String delete(@RequestParam("deleteConference") Integer conferenceId) throws IOException {
|
||||
conferenceService.delete(conferenceId);
|
||||
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "save")
|
||||
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
@ -78,17 +83,10 @@ public class ConferenceController {
|
||||
}
|
||||
conferenceService.save(conferenceDto);
|
||||
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{conference-id}")
|
||||
public String delete(@PathVariable("conference-id") Integer conferenceId) throws IOException {
|
||||
conferenceService.delete(conferenceId);
|
||||
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "addDeadline")
|
||||
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
||||
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
@ -107,6 +105,16 @@ public class ConferenceController {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "addPaper")
|
||||
public String addPaper(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
conferenceService.addPaper(conferenceDto);
|
||||
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "removePaper")
|
||||
public String removePaper(@Valid ConferenceDto conferenceDto, Errors errors,
|
||||
@RequestParam(value = "removePaper") Integer paperIndex) throws IOException {
|
||||
|
@ -53,7 +53,7 @@ public class Conference extends BaseEntity {
|
||||
@OrderBy("date")
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER)
|
||||
@ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "paper_conference",
|
||||
joinColumns = {@JoinColumn(name = "conference_id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "paper_id")})
|
||||
|
@ -11,14 +11,14 @@ public class ConferenceFilterDto {
|
||||
public ConferenceFilterDto() {
|
||||
}
|
||||
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferenceDtos, Integer filterUserId, Integer year) {
|
||||
this.conferences = conferenceDtos;
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferences, Integer filterUserId, Integer year) {
|
||||
this.conferences = conferences;
|
||||
this.filterUserId = filterUserId;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferenceDtos) {
|
||||
this(conferenceDtos, null, null);
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferences) {
|
||||
this(conferences, null, null);
|
||||
}
|
||||
|
||||
public List<ConferenceDto> getConferences() {
|
||||
|
@ -18,6 +18,9 @@ public interface ConferenceRepository extends JpaRepository<Conference, Integer>
|
||||
@Query("SELECT c FROM Conference c WHERE c.beginDate > :date")
|
||||
List<Conference> findAllActive(@Param("date") Date date);
|
||||
|
||||
@Query("SELECT case when count(c) > 0 then true else false end FROM Conference c JOIN c.papers p WHERE p.id = :paperId")
|
||||
boolean isPaperAttached(@Param("paperId") Integer paperId);
|
||||
|
||||
@Modifying
|
||||
@Query("UPDATE Conference c SET c.ping = (c.ping + 1) WHERE c.id = :id")
|
||||
int updatePingConference(@Param("id") Integer id);
|
||||
|
@ -116,9 +116,19 @@ public class ConferenceService {
|
||||
conferenceDto.getDeadlines().remove((int) deadlineIndex);
|
||||
}
|
||||
|
||||
public void addPaper(ConferenceDto conferenceDto) {
|
||||
Paper paper = new Paper();
|
||||
paper.setTitle(userService.getCurrentUser().getLastName() + "_" + conferenceDto.getTitle() + "_" + (new Date()).getTime());
|
||||
paper.setStatus(Paper.PaperStatus.DRAFT);
|
||||
|
||||
conferenceDto.getPapers().add(paper);
|
||||
}
|
||||
|
||||
public void removePaper(ConferenceDto conferenceDto, Integer paperIndex) throws IOException {
|
||||
Paper removedPaper = conferenceDto.getPapers().remove((int) paperIndex);
|
||||
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
||||
if (removedPaper.getId() != null) {
|
||||
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
||||
}
|
||||
}
|
||||
|
||||
public void takePart(ConferenceDto conferenceDto) throws IOException {
|
||||
@ -146,15 +156,15 @@ public class ConferenceService {
|
||||
conference.setTitle(conferenceDto.getTitle());
|
||||
conference.setDescription(conferenceDto.getDescription());
|
||||
conference.setUrl(conferenceDto.getUrl());
|
||||
conference.setPing(conference.getPing());
|
||||
conference.setBeginDate(conferenceDto.getBeginDate());
|
||||
conference.setEndDate(conferenceDto.getEndDate());
|
||||
conference.setPapers(conferenceDto.getPapers());
|
||||
conference.getPapers().clear();
|
||||
conferenceDto.getPapers().forEach(paper -> conference.getPapers().add(paper.getId() != null ? paperService.findPaperById(paper.getId()) : paperService.create(paper)));
|
||||
conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));
|
||||
conference.setUsers(conferenceUserService.saveOrCreate(conferenceDto.getUsers()));
|
||||
if (conferenceDto.getPaperIds() != null && !conferenceDto.getPaperIds().isEmpty()) {
|
||||
conferenceDto.getPaperIds().forEach(paperId ->
|
||||
conference.getPapers().add(paperService.findEntityById(paperId)));
|
||||
conference.getPapers().add(paperService.findPaperById(paperId)));
|
||||
}
|
||||
return conference;
|
||||
}
|
||||
@ -179,6 +189,10 @@ public class ConferenceService {
|
||||
return conferenceRepository.findAllActive(new Date());
|
||||
}
|
||||
|
||||
public boolean isAttachedToConference(Integer paperId) {
|
||||
return conferenceRepository.isPaperAttached(paperId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void ping(ConferenceDto conferenceDto) throws IOException {
|
||||
pingService.addPing(findOne(conferenceDto.getId()));
|
||||
|
@ -39,6 +39,11 @@ public class AdviceController {
|
||||
return userService.getCurrentUser().getUserAbbreviate();
|
||||
}
|
||||
|
||||
@ModelAttribute("flashMessage")
|
||||
public String getFlashMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Response<Void> handleException(ErrorConstants error) {
|
||||
log.warn(error.toString());
|
||||
return new Response<>(error);
|
||||
|
@ -13,6 +13,7 @@ import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.grant.model.Grant;
|
||||
import ru.ulstu.grant.model.GrantDto;
|
||||
import ru.ulstu.grant.service.GrantService;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.user.model.User;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@ -50,7 +51,9 @@ public class GrantController {
|
||||
@GetMapping("/grant")
|
||||
public void getGrant(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
|
||||
if (id != null && id > 0) {
|
||||
modelMap.put("grantDto", grantService.findOneDto(id));
|
||||
GrantDto grantDto = grantService.findOneDto(id);
|
||||
attachPaper(grantDto);
|
||||
modelMap.put("grantDto", grantDto);
|
||||
} else {
|
||||
modelMap.put("grantDto", new GrantDto());
|
||||
}
|
||||
@ -78,6 +81,12 @@ public class GrantController {
|
||||
return GRANT_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/grant", params = "attachPaper")
|
||||
public String attachPaper(GrantDto grantDto) {
|
||||
grantService.attachPaper(grantDto);
|
||||
return GRANT_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/grant", params = "addDeadline")
|
||||
public String addDeadline(@Valid GrantDto grantDto, Errors errors) {
|
||||
filterEmptyDeadlines(grantDto);
|
||||
@ -89,7 +98,7 @@ public class GrantController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/grant", params = "createProject")
|
||||
public String createProject(@Valid GrantDto grantDto, Errors errors) {
|
||||
public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
return GRANT_PAGE;
|
||||
}
|
||||
@ -113,6 +122,11 @@ public class GrantController {
|
||||
return grantService.getGrantAuthors(grantDto);
|
||||
}
|
||||
|
||||
@ModelAttribute("allPapers")
|
||||
public List<Paper> getAllPapers() {
|
||||
return grantService.getAllPapers();
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(GrantDto grantDto) {
|
||||
grantDto.setDeadlines(grantDto.getDeadlines().stream()
|
||||
.filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription()))
|
||||
|
@ -5,6 +5,7 @@ import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.core.model.UserContainer;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.file.model.FileData;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.project.model.Project;
|
||||
import ru.ulstu.user.model.User;
|
||||
|
||||
@ -14,6 +15,7 @@ import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
@ -83,6 +85,12 @@ public class Grant extends BaseEntity implements UserContainer {
|
||||
@JoinColumn(name = "leader_id")
|
||||
private User leader;
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "grants_papers",
|
||||
joinColumns = {@JoinColumn(name = "grant_id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "paper_id")})
|
||||
private List<Paper> papers = new ArrayList<>();
|
||||
|
||||
public GrantStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
@ -152,6 +160,14 @@ public class Grant extends BaseEntity implements UserContainer {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
public List<Paper> getPapers() {
|
||||
return papers;
|
||||
}
|
||||
|
||||
public void setPapers(List<Paper> papers) {
|
||||
this.papers = papers;
|
||||
}
|
||||
|
||||
public Optional<Deadline> getNextDeadline() {
|
||||
return deadlines
|
||||
.stream()
|
||||
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.project.model.ProjectDto;
|
||||
import ru.ulstu.user.model.UserDto;
|
||||
|
||||
@ -32,6 +33,8 @@ public class GrantDto {
|
||||
private boolean wasLeader;
|
||||
private boolean hasAge;
|
||||
private boolean hasDegree;
|
||||
private List<Integer> paperIds = new ArrayList<>();
|
||||
private List<Paper> papers = new ArrayList<>();
|
||||
|
||||
public GrantDto() {
|
||||
deadlines.add(new Deadline());
|
||||
@ -49,7 +52,9 @@ public class GrantDto {
|
||||
@JsonProperty("leader") Integer leaderId,
|
||||
@JsonProperty("wasLeader") boolean wasLeader,
|
||||
@JsonProperty("hasAge") boolean hasAge,
|
||||
@JsonProperty("hasDegree") boolean hasDegree) {
|
||||
@JsonProperty("hasDegree") boolean hasDegree,
|
||||
@JsonProperty("paperIds") List<Integer> paperIds,
|
||||
@JsonProperty("papers") List<Paper> papers) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.status = status;
|
||||
@ -62,6 +67,8 @@ public class GrantDto {
|
||||
this.wasLeader = wasLeader;
|
||||
this.hasAge = hasAge;
|
||||
this.hasDegree = hasDegree;
|
||||
this.paperIds = paperIds;
|
||||
this.papers = papers;
|
||||
}
|
||||
|
||||
public GrantDto(Grant grant) {
|
||||
@ -78,6 +85,8 @@ public class GrantDto {
|
||||
this.wasLeader = false;
|
||||
this.hasAge = false;
|
||||
this.hasDegree = false;
|
||||
this.paperIds = convert(grant.getPapers(), paper -> paper.getId());
|
||||
this.papers = grant.getPapers();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@ -190,4 +199,20 @@ public class GrantDto {
|
||||
public void setHasDegree(boolean hasDegree) {
|
||||
this.hasDegree = hasDegree;
|
||||
}
|
||||
|
||||
public List<Integer> getPaperIds() {
|
||||
return paperIds;
|
||||
}
|
||||
|
||||
public void setPaperIds(List<Integer> paperIds) {
|
||||
this.paperIds = paperIds;
|
||||
}
|
||||
|
||||
public List<Paper> getPapers() {
|
||||
return papers;
|
||||
}
|
||||
|
||||
public void setPapers(List<Paper> papers) {
|
||||
this.papers = papers;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import ru.ulstu.file.service.FileService;
|
||||
import ru.ulstu.grant.model.Grant;
|
||||
import ru.ulstu.grant.model.GrantDto;
|
||||
import ru.ulstu.grant.repository.GrantRepository;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
import ru.ulstu.project.model.Project;
|
||||
import ru.ulstu.project.model.ProjectDto;
|
||||
import ru.ulstu.project.service.ProjectService;
|
||||
@ -34,17 +36,20 @@ public class GrantService {
|
||||
private final DeadlineService deadlineService;
|
||||
private final FileService fileService;
|
||||
private final UserService userService;
|
||||
private final PaperService paperService;
|
||||
|
||||
public GrantService(GrantRepository grantRepository,
|
||||
FileService fileService,
|
||||
DeadlineService deadlineService,
|
||||
ProjectService projectService,
|
||||
UserService userService) {
|
||||
UserService userService,
|
||||
PaperService paperService) {
|
||||
this.grantRepository = grantRepository;
|
||||
this.fileService = fileService;
|
||||
this.deadlineService = deadlineService;
|
||||
this.projectService = projectService;
|
||||
this.userService = userService;
|
||||
this.paperService = paperService;
|
||||
}
|
||||
|
||||
public List<Grant> findAll() {
|
||||
@ -86,10 +91,14 @@ public class GrantService {
|
||||
if (grantDto.getLeaderId() != null) {
|
||||
grant.setLeader(userService.findById(grantDto.getLeaderId()));
|
||||
}
|
||||
grant.getPapers().clear();
|
||||
if (grantDto.getPaperIds() != null && !grantDto.getPaperIds().isEmpty()) {
|
||||
grantDto.getPaperIds().forEach(paperIds -> grant.getPapers().add(paperService.findPaperById(paperIds)));
|
||||
}
|
||||
return grant;
|
||||
}
|
||||
|
||||
public void createProject(GrantDto grantDto) {
|
||||
public void createProject(GrantDto grantDto) throws IOException {
|
||||
grantDto.setProject(
|
||||
new ProjectDto(projectService.save(new ProjectDto(grantDto.getTitle()))));
|
||||
}
|
||||
@ -118,7 +127,7 @@ public class GrantService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Grant create(String title, Project projectId, Date deadlineDate, User user) {
|
||||
public Grant create(String title, Project projectId, Date deadlineDate, User user, Paper paper) {
|
||||
Grant grant = new Grant();
|
||||
grant.setTitle(title);
|
||||
grant.setComment("Комментарий к гранту 1");
|
||||
@ -127,6 +136,7 @@ public class GrantService {
|
||||
grant.getDeadlines().add(new Deadline(deadlineDate, "первый дедлайн"));
|
||||
grant.getAuthors().add(user);
|
||||
grant.setLeader(user);
|
||||
grant.getPapers().add(paper);
|
||||
grant = grantRepository.save(grant);
|
||||
return grant;
|
||||
}
|
||||
@ -156,4 +166,22 @@ public class GrantService {
|
||||
.map(Grant::getLeader)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Paper> getGrantPapers(List<Integer> paperIds) {
|
||||
return paperService.findAllSelect(paperIds);
|
||||
|
||||
}
|
||||
|
||||
public List<Paper> getAllPapers() {
|
||||
return paperService.findAll();
|
||||
}
|
||||
|
||||
public void attachPaper(GrantDto grantDto) {
|
||||
if (!grantDto.getPaperIds().isEmpty()) {
|
||||
grantDto.getPapers().clear();
|
||||
grantDto.setPapers(getGrantPapers(grantDto.getPaperIds()));
|
||||
} else {
|
||||
grantDto.getPapers().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.conference.service.ConferenceService;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperFilterDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.service.LatexService;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
import ru.ulstu.user.model.User;
|
||||
@ -38,23 +38,34 @@ import static org.springframework.util.StringUtils.isEmpty;
|
||||
@ApiIgnore
|
||||
public class PaperController {
|
||||
private final PaperService paperService;
|
||||
private final ConferenceService conferenceService;
|
||||
private final LatexService latexService;
|
||||
|
||||
public PaperController(PaperService paperService, LatexService latexService) {
|
||||
public PaperController(PaperService paperService,
|
||||
ConferenceService conferenceService,
|
||||
LatexService latexService) {
|
||||
this.paperService = paperService;
|
||||
this.conferenceService = conferenceService;
|
||||
this.latexService = latexService;
|
||||
}
|
||||
|
||||
@GetMapping("/papers")
|
||||
public void getPapers(ModelMap modelMap) {
|
||||
modelMap.put("filteredPapers", new PaperFilterDto(paperService.findAllDto(), null, null));
|
||||
modelMap.put("filteredPapers", new PaperListDto(paperService.findAllDto(), null, null));
|
||||
}
|
||||
|
||||
@PostMapping("/papers")
|
||||
public void filterPapers(@Valid PaperFilterDto paperFilterDto, ModelMap modelMap) {
|
||||
modelMap.put("filteredPapers", new PaperFilterDto(paperService.filter(paperFilterDto),
|
||||
paperFilterDto.getFilterAuthorId(),
|
||||
paperFilterDto.getYear()));
|
||||
public void listPapers(@Valid PaperListDto paperListDto, ModelMap modelMap) {
|
||||
if (paperListDto.getPaperDeleteId() != null) {
|
||||
if (conferenceService.isAttachedToConference(paperListDto.getPaperDeleteId())) {
|
||||
modelMap.put("flashMessage", "Статью нельзя удалить, она прикреплена к конференции");
|
||||
} else {
|
||||
paperService.delete(paperListDto.getPaperDeleteId());
|
||||
}
|
||||
}
|
||||
modelMap.put("filteredPapers", new PaperListDto(paperService.filter(paperListDto),
|
||||
paperListDto.getFilterAuthorId(),
|
||||
paperListDto.getYear()));
|
||||
}
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
@ -94,12 +105,6 @@ public class PaperController {
|
||||
return "/papers/paper";
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{paper-id}")
|
||||
public String delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
||||
paperService.delete(paperId);
|
||||
return "redirect:/papers/papers";
|
||||
}
|
||||
|
||||
@ModelAttribute("allStatuses")
|
||||
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||
return paperService.getPaperStatuses();
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ulstu.configuration.Constants;
|
||||
import ru.ulstu.core.model.response.Response;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperFilterDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -58,8 +58,8 @@ public class PaperRestController {
|
||||
}
|
||||
|
||||
@PostMapping("/filter")
|
||||
public Response<List<PaperDto>> filter(@RequestBody @Valid PaperFilterDto paperFilterDto) throws IOException {
|
||||
return new Response<>(paperService.filter(paperFilterDto));
|
||||
public Response<List<PaperDto>> filter(@RequestBody @Valid PaperListDto paperListDto) throws IOException {
|
||||
return new Response<>(paperService.filter(paperListDto));
|
||||
}
|
||||
|
||||
@GetMapping("formatted-list")
|
||||
|
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.paper.error;
|
||||
|
||||
public class PaperConferenceRelationExistException extends RuntimeException {
|
||||
public PaperConferenceRelationExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -2,15 +2,16 @@ package ru.ulstu.paper.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PaperFilterDto {
|
||||
public class PaperListDto {
|
||||
private List<PaperDto> papers;
|
||||
private Integer filterAuthorId;
|
||||
private Integer paperDeleteId;
|
||||
private Integer year;
|
||||
|
||||
public PaperFilterDto() {
|
||||
public PaperListDto() {
|
||||
}
|
||||
|
||||
public PaperFilterDto(List<PaperDto> paperDtos, Integer filterAuthorId, Integer year) {
|
||||
public PaperListDto(List<PaperDto> paperDtos, Integer filterAuthorId, Integer year) {
|
||||
this.papers = paperDtos;
|
||||
this.filterAuthorId = filterAuthorId;
|
||||
this.year = year;
|
||||
@ -39,4 +40,12 @@ public class PaperFilterDto {
|
||||
public void setYear(Integer year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public Integer getPaperDeleteId() {
|
||||
return paperDeleteId;
|
||||
}
|
||||
|
||||
public void setPaperDeleteId(Integer paperDeleteId) {
|
||||
this.paperDeleteId = paperDeleteId;
|
||||
}
|
||||
}
|
@ -14,4 +14,6 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
||||
List<Paper> filter(@Param("author") User author, @Param("year") Integer year);
|
||||
|
||||
List<Paper> findByIdNotIn(List<Integer> paperIds);
|
||||
|
||||
List<Paper> findAllByIdIn(List<Integer> paperIds);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import ru.ulstu.file.model.FileDataDto;
|
||||
import ru.ulstu.file.service.FileService;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperFilterDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.repository.PaperRepository;
|
||||
import ru.ulstu.timeline.service.EventService;
|
||||
import ru.ulstu.user.model.User;
|
||||
@ -93,6 +93,14 @@ public class PaperService {
|
||||
return newPaper.getId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Paper create(Paper paper) {
|
||||
Paper newPaper = paperRepository.save(paper);
|
||||
paperNotificationService.sendCreateNotification(newPaper);
|
||||
eventService.createFromPaper(newPaper);
|
||||
return newPaper;
|
||||
}
|
||||
|
||||
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
|
||||
paper.setComment(paperDto.getComment());
|
||||
paper.setUrl(paperDto.getUrl());
|
||||
@ -173,7 +181,7 @@ public class PaperService {
|
||||
return paper;
|
||||
}
|
||||
|
||||
public List<PaperDto> filter(PaperFilterDto filterDto) {
|
||||
public List<PaperDto> filter(PaperListDto filterDto) {
|
||||
return convert(sortPapers(paperRepository.filter(
|
||||
filterDto.getFilterAuthorId() == null ? null : userService.findById(filterDto.getFilterAuthorId()),
|
||||
filterDto.getYear())), PaperDto::new);
|
||||
@ -223,7 +231,7 @@ public class PaperService {
|
||||
return new PaperDto(paperRepository.findOne(paperId));
|
||||
}
|
||||
|
||||
public Paper findEntityById(Integer paperId) {
|
||||
public Paper findPaperById(Integer paperId) {
|
||||
return paperRepository.findOne(paperId);
|
||||
}
|
||||
|
||||
@ -236,6 +244,10 @@ public class PaperService {
|
||||
|
||||
}
|
||||
|
||||
public List<Paper> findAllSelect(List<Integer> paperIds) {
|
||||
return sortPapers(paperRepository.findAllByIdIn(paperIds));
|
||||
}
|
||||
|
||||
public List<User> getPaperAuthors() {
|
||||
return userService.findAll();
|
||||
}
|
||||
|
@ -2,16 +2,25 @@ package ru.ulstu.project.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.project.model.Project;
|
||||
import ru.ulstu.project.model.ProjectDto;
|
||||
import ru.ulstu.project.service.ProjectService;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springframework.util.StringUtils.isEmpty;
|
||||
|
||||
@Controller()
|
||||
@RequestMapping(value = "/projects")
|
||||
@ -46,4 +55,39 @@ public class ProjectController {
|
||||
public List<Project.ProjectStatus> getProjectStatuses() {
|
||||
return projectService.getProjectStatuses();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/project", params = "save")
|
||||
public String save(@Valid ProjectDto projectDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(projectDto);
|
||||
if (projectDto.getDeadlines().isEmpty()) {
|
||||
errors.rejectValue("deadlines", "errorCode", "Не может быть пустым");
|
||||
}
|
||||
if (errors.hasErrors()) {
|
||||
return "/projects/project";
|
||||
}
|
||||
projectService.save(projectDto);
|
||||
return String.format("redirect:%s", "/projects/projects");
|
||||
}
|
||||
|
||||
@PostMapping(value = "/project", params = "addDeadline")
|
||||
public String addDeadline(@Valid ProjectDto projectDto, Errors errors) {
|
||||
filterEmptyDeadlines(projectDto);
|
||||
if (errors.hasErrors()) {
|
||||
return "/projects/project";
|
||||
}
|
||||
projectDto.getDeadlines().add(new Deadline());
|
||||
return "/projects/project";
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{project-id}")
|
||||
public String delete(@PathVariable("project-id") Integer projectId) throws IOException {
|
||||
projectService.delete(projectId);
|
||||
return String.format("redirect:%s", "/projects/projects");
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(ProjectDto projectDto) {
|
||||
projectDto.setDeadlines(projectDto.getDeadlines().stream()
|
||||
.filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ru.ulstu.project.model;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.file.model.FileData;
|
||||
import ru.ulstu.grant.model.Grant;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
@ -57,6 +58,10 @@ public class Project extends BaseEntity {
|
||||
@NotNull
|
||||
private String repository;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "file_id")
|
||||
private FileData application;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
@ -104,4 +109,12 @@ public class Project extends BaseEntity {
|
||||
public void setDeadlines(List<Deadline> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
|
||||
public FileData getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
||||
public void setApplication(FileData application) {
|
||||
this.application = application;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class ProjectDto {
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
private GrantDto grant;
|
||||
private String repository;
|
||||
private String applicationFileName;
|
||||
|
||||
public ProjectDto() {
|
||||
}
|
||||
@ -42,6 +43,7 @@ public class ProjectDto {
|
||||
this.grant = grant;
|
||||
this.repository = repository;
|
||||
this.deadlines = deadlines;
|
||||
this.applicationFileName = null;
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +52,7 @@ public class ProjectDto {
|
||||
this.title = project.getTitle();
|
||||
this.status = project.getStatus();
|
||||
this.description = project.getDescription();
|
||||
this.applicationFileName = project.getApplication() == null ? null : project.getApplication().getName();
|
||||
this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant());
|
||||
this.repository = project.getRepository();
|
||||
this.deadlines = project.getDeadlines();
|
||||
@ -110,4 +113,12 @@ public class ProjectDto {
|
||||
public void setDeadlines(List<Deadline> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
|
||||
public String getApplicationFileName() {
|
||||
return applicationFileName;
|
||||
}
|
||||
|
||||
public void setApplicationFileName(String applicationFileName) {
|
||||
this.applicationFileName = applicationFileName;
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,19 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
import ru.ulstu.deadline.service.DeadlineService;
|
||||
import ru.ulstu.file.service.FileService;
|
||||
import ru.ulstu.grant.repository.GrantRepository;
|
||||
import ru.ulstu.project.model.Project;
|
||||
import ru.ulstu.project.model.ProjectDto;
|
||||
import ru.ulstu.project.repository.ProjectRepository;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.isEmpty;
|
||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||
import static ru.ulstu.project.model.Project.ProjectStatus.APPLICATION;
|
||||
|
||||
@Service
|
||||
public class ProjectService {
|
||||
@ -20,11 +24,17 @@ public class ProjectService {
|
||||
|
||||
private final ProjectRepository projectRepository;
|
||||
private final DeadlineService deadlineService;
|
||||
private final GrantRepository grantRepository;
|
||||
private final FileService fileService;
|
||||
|
||||
public ProjectService(ProjectRepository projectRepository,
|
||||
DeadlineService deadlineService) {
|
||||
DeadlineService deadlineService,
|
||||
GrantRepository grantRepository,
|
||||
FileService fileService) {
|
||||
this.projectRepository = projectRepository;
|
||||
this.deadlineService = deadlineService;
|
||||
this.grantRepository = grantRepository;
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
public List<Project> findAll() {
|
||||
@ -46,19 +56,47 @@ public class ProjectService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Project create(ProjectDto projectDto) {
|
||||
public Project create(ProjectDto projectDto) throws IOException {
|
||||
Project newProject = copyFromDto(new Project(), projectDto);
|
||||
newProject = projectRepository.save(newProject);
|
||||
return newProject;
|
||||
}
|
||||
|
||||
private Project copyFromDto(Project project, ProjectDto projectDto) {
|
||||
project.setTitle(projectDto.getTitle());
|
||||
project.setDeadlines(deadlineService.saveOrCreate(projectDto.getDeadlines()));
|
||||
@Transactional
|
||||
public Project update(ProjectDto projectDto) throws IOException {
|
||||
Project project = projectRepository.findOne(projectDto.getId());
|
||||
if (projectDto.getApplicationFileName() != null && project.getApplication() != null) {
|
||||
fileService.deleteFile(project.getApplication());
|
||||
}
|
||||
projectRepository.save(copyFromDto(project, projectDto));
|
||||
return project;
|
||||
}
|
||||
|
||||
public Project save(ProjectDto projectDto) {
|
||||
@Transactional
|
||||
public void delete(Integer projectId) throws IOException {
|
||||
Project project = projectRepository.findOne(projectId);
|
||||
if (project.getApplication() != null) {
|
||||
fileService.deleteFile(project.getApplication());
|
||||
}
|
||||
projectRepository.delete(project);
|
||||
}
|
||||
|
||||
private Project copyFromDto(Project project, ProjectDto projectDto) throws IOException {
|
||||
project.setDescription(projectDto.getDescription());
|
||||
project.setStatus(projectDto.getStatus() == null ? APPLICATION : projectDto.getStatus());
|
||||
project.setTitle(projectDto.getTitle());
|
||||
if (projectDto.getGrant() != null && projectDto.getGrant().getId() != null) {
|
||||
project.setGrant(grantRepository.findOne(projectDto.getGrant().getId()));
|
||||
}
|
||||
project.setRepository(projectDto.getRepository());
|
||||
project.setDeadlines(deadlineService.saveOrCreate(projectDto.getDeadlines()));
|
||||
if (projectDto.getApplicationFileName() != null) {
|
||||
project.setApplication(fileService.createFileFromTmp(projectDto.getApplicationFileName()));
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
public Project save(ProjectDto projectDto) throws IOException {
|
||||
if (isEmpty(projectDto.getId())) {
|
||||
return create(projectDto);
|
||||
} else {
|
||||
@ -66,10 +104,6 @@ public class ProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
private Project update(ProjectDto projectDto) {
|
||||
throw new RuntimeException("not implemented yet");
|
||||
}
|
||||
|
||||
public Project findById(Integer id) {
|
||||
return projectRepository.findOne(id);
|
||||
}
|
||||
|
@ -5,13 +5,16 @@ import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.students.model.Task;
|
||||
import ru.ulstu.students.model.TaskDto;
|
||||
import ru.ulstu.students.model.TaskFilterDto;
|
||||
import ru.ulstu.students.service.TaskService;
|
||||
import ru.ulstu.tags.model.Tag;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -35,16 +38,16 @@ public class TaskController {
|
||||
this.taskService = taskService;
|
||||
}
|
||||
|
||||
@GetMapping("/tasks")
|
||||
public void getTasks(ModelMap modelMap) {
|
||||
modelMap.put("tasks", taskService.findAllDto());
|
||||
}
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
public void getDashboard(ModelMap modelMap) {
|
||||
modelMap.put("tasks", taskService.findAllDto());
|
||||
}
|
||||
|
||||
@GetMapping("/tasks")
|
||||
public void getTask(ModelMap modelMap) {
|
||||
modelMap.put("filteredTasks", new TaskFilterDto(taskService.findAllDto(), null, null, null));
|
||||
}
|
||||
|
||||
@GetMapping("/task")
|
||||
public void getTask(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
|
||||
if (id != null && id > 0) {
|
||||
@ -54,6 +57,14 @@ public class TaskController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/tasks")
|
||||
public void filterTasks(@Valid TaskFilterDto taskFilterDto, ModelMap modelMap) {
|
||||
modelMap.put("filteredTasks", new TaskFilterDto(taskService.filter(taskFilterDto),
|
||||
taskFilterDto.getStatus(),
|
||||
taskFilterDto.getTag(),
|
||||
taskFilterDto.getOrder()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/task", params = "save")
|
||||
public String save(@Valid TaskDto taskDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(taskDto);
|
||||
@ -77,11 +88,23 @@ public class TaskController {
|
||||
return TASK_PAGE;
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{task-id}")
|
||||
public String delete(@PathVariable("task-id") Integer taskId) throws IOException {
|
||||
taskService.delete(taskId);
|
||||
return String.format(REDIRECT_TO, TASKS_PAGE);
|
||||
}
|
||||
|
||||
|
||||
@ModelAttribute("allStatuses")
|
||||
public List<Task.TaskStatus> getTaskStatuses() {
|
||||
return taskService.getTaskStatuses();
|
||||
}
|
||||
|
||||
@ModelAttribute("allTags")
|
||||
public List<Tag> getTags() {
|
||||
return taskService.getTags();
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(TaskDto taskDto) {
|
||||
taskDto.setDeadlines(taskDto.getDeadlines().stream()
|
||||
.filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription()))
|
||||
|
@ -50,7 +50,7 @@ public class Task extends BaseEntity {
|
||||
private String description;
|
||||
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private ru.ulstu.students.model.Task.TaskStatus status = TaskStatus.IN_WORK;
|
||||
private TaskStatus status = TaskStatus.IN_WORK;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "task_id", unique = true)
|
||||
|
@ -26,7 +26,7 @@ public class TaskDto {
|
||||
private Date createDate;
|
||||
private Date updateDate;
|
||||
private Set<Integer> tagIds;
|
||||
private List<Tag> tags;
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
public TaskDto() {
|
||||
deadlines.add(new Deadline());
|
||||
|
54
src/main/java/ru/ulstu/students/model/TaskFilterDto.java
Normal file
54
src/main/java/ru/ulstu/students/model/TaskFilterDto.java
Normal file
@ -0,0 +1,54 @@
|
||||
package ru.ulstu.students.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TaskFilterDto {
|
||||
|
||||
private List<TaskDto> tasks;
|
||||
private Task.TaskStatus status;
|
||||
private Integer tagId;
|
||||
private String order;
|
||||
|
||||
public TaskFilterDto(List<TaskDto> tasks, Task.TaskStatus status, Integer tagId, String order) {
|
||||
this.tasks = tasks;
|
||||
this.status = status;
|
||||
this.tagId = tagId;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public TaskFilterDto() {
|
||||
|
||||
}
|
||||
|
||||
public List<TaskDto> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(List<TaskDto> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
public Task.TaskStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Task.TaskStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getTag() {
|
||||
return tagId;
|
||||
}
|
||||
|
||||
public void setTag(Integer tagId) {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public String getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(String order) {
|
||||
this.order = order;
|
||||
}
|
||||
}
|
@ -1,7 +1,18 @@
|
||||
package ru.ulstu.students.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import ru.ulstu.students.model.Task;
|
||||
import ru.ulstu.tags.model.Tag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TaskRepository extends JpaRepository<Task, Integer> {
|
||||
|
||||
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date DESC")
|
||||
List<Task> filterNew(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
||||
|
||||
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date ASC")
|
||||
List<Task> filterOld(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package ru.ulstu.students.service;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ru.ulstu.deadline.service.DeadlineService;
|
||||
import ru.ulstu.students.model.Task;
|
||||
import ru.ulstu.students.model.TaskDto;
|
||||
import ru.ulstu.students.model.TaskFilterDto;
|
||||
import ru.ulstu.students.repository.TaskRepository;
|
||||
import ru.ulstu.tags.model.Tag;
|
||||
import ru.ulstu.tags.service.TagService;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -27,15 +30,15 @@ public class TaskService {
|
||||
private final DeadlineService deadlineService;
|
||||
private final TagService tagService;
|
||||
|
||||
public TaskService(TaskRepository grantRepository,
|
||||
public TaskService(TaskRepository taskRepository,
|
||||
DeadlineService deadlineService, TagService tagService) {
|
||||
this.taskRepository = grantRepository;
|
||||
this.taskRepository = taskRepository;
|
||||
this.deadlineService = deadlineService;
|
||||
this.tagService = tagService;
|
||||
}
|
||||
|
||||
public List<Task> findAll() {
|
||||
return taskRepository.findAll();
|
||||
return taskRepository.findAll(new Sort(Sort.Direction.DESC, "createDate"));
|
||||
}
|
||||
|
||||
public List<TaskDto> findAllDto() {
|
||||
@ -48,6 +51,18 @@ public class TaskService {
|
||||
return new TaskDto(taskRepository.findOne(id));
|
||||
}
|
||||
|
||||
public List<TaskDto> filter(TaskFilterDto filterDto) {
|
||||
if (filterDto.getOrder().compareTo("new") == 0) {
|
||||
return convert(taskRepository.filterNew(
|
||||
filterDto.getStatus(),
|
||||
filterDto.getTag() == null ? null : tagService.findById(filterDto.getTag())), TaskDto::new);
|
||||
} else {
|
||||
return convert(taskRepository.filterOld(
|
||||
filterDto.getStatus(),
|
||||
filterDto.getTag() == null ? null : tagService.findById(filterDto.getTag())), TaskDto::new);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer create(TaskDto taskDto) throws IOException {
|
||||
Task newTask = copyFromDto(new Task(), taskDto);
|
||||
@ -76,8 +91,10 @@ public class TaskService {
|
||||
|
||||
@Transactional
|
||||
public void delete(Integer taskId) throws IOException {
|
||||
Task task = taskRepository.findOne(taskId);
|
||||
taskRepository.delete(task);
|
||||
if (taskRepository.exists(taskId)) {
|
||||
taskRepository.delete(taskId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(TaskDto taskDto) throws IOException {
|
||||
@ -92,4 +109,8 @@ public class TaskService {
|
||||
return Arrays.asList(Task.TaskStatus.values());
|
||||
}
|
||||
|
||||
public List<Tag> getTags() {
|
||||
return tagService.getTags();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,4 +50,12 @@ public class TagService {
|
||||
return newTag;
|
||||
}
|
||||
|
||||
public List<Tag> getTags() {
|
||||
return tagRepository.findAll();
|
||||
}
|
||||
|
||||
public Tag findById(Integer tagId) {
|
||||
return tagRepository.findOne(tagId);
|
||||
}
|
||||
|
||||
}
|
||||
|
17
src/main/resources/db/changelog-20190419_000000-schema.xml
Normal file
17
src/main/resources/db/changelog-20190419_000000-schema.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="tanya" id="20190419_000000-1">
|
||||
<createTable tableName="grants_papers">
|
||||
<column name="grant_id" type="integer"/>
|
||||
<column name="paper_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="grants_papers" baseColumnNames="grant_id"
|
||||
constraintName="fk_grants_grants_papers" referencedTableName="grants"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="grants_papers" baseColumnNames="paper_id"
|
||||
constraintName="fk_paper_grants_papers" referencedTableName="paper"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
16
src/main/resources/db/changelog-20190422_000000-schema.xml
Normal file
16
src/main/resources/db/changelog-20190422_000000-schema.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190418_000000-1">
|
||||
<addColumn tableName="project">
|
||||
<column name="file_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="project" baseColumnNames="file_id"
|
||||
constraintName="fk_project_file_id" referencedTableName="file"
|
||||
referencedColumnNames="id"/>
|
||||
<addColumn tableName="project">
|
||||
<column name="applicationFileName" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -30,6 +30,8 @@
|
||||
<include file="db/common/changelog-20190312_130000-schema.xml"/>
|
||||
<include file="db/changelog-20190402_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190404_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190419_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190421_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190422_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190424_000000-schema.xml"/>
|
||||
</databaseChangeLog>
|
@ -2,8 +2,8 @@ body {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.conference-row .col:hover {
|
||||
background-color: #f3f3f3;
|
||||
.conference-row .d-flex:hover {
|
||||
background-color: #f1f1f1;
|
||||
border-radius: .25rem;
|
||||
}
|
||||
|
||||
@ -15,10 +15,20 @@ body {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.conference-row .col .text-decoration {
|
||||
.conference-row .d-flex .text-decoration {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.conference-row .d-flex .text-decoration:nth-child(1) {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.conference-row .d-flex {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
|
||||
.form-group textarea {
|
||||
min-height: 206px;
|
||||
@ -61,13 +71,17 @@ body {
|
||||
padding: 0.5rem 1.75em 0.5rem 0.5em;
|
||||
display: inline-block;
|
||||
background: transparent url("https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-16.png") no-repeat right 7px center;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.member select:nth-child(4) {
|
||||
border-right: 1px solid #ced4da;
|
||||
}
|
||||
|
||||
.member select:hover {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
|
||||
.member-name {
|
||||
padding: .75rem 1.25rem;
|
||||
@ -114,11 +128,22 @@ body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.paper-name:hover {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.paper-name span {
|
||||
margin: 6px 15px;
|
||||
margin: 7px 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.paper-name span:nth-child(1) {
|
||||
margin: 3px 0px 3px 10px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
@ -127,14 +152,14 @@ body {
|
||||
}
|
||||
|
||||
.icon-delete {
|
||||
background-color: #f44;
|
||||
background-color: #ff7272;
|
||||
background-image: url(/img/conference/delete.png);
|
||||
background-repeat: round;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.icon-delete:hover {
|
||||
background-color: #ff2929;
|
||||
background-color: #ff0000;
|
||||
transition: background-color .15s ease-in-out;
|
||||
}
|
||||
|
||||
|
@ -10,3 +10,18 @@
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.div-view-paper {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.div-selected-papers {
|
||||
border: 0px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.icon-paper {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
margin: 3px;
|
||||
}
|
@ -13,6 +13,21 @@
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.filter .bootstrap-select{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.filter-option-inner-inner{
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
font-weight: normal;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.sorting .bootstrap-select{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.input-tag-name {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
|
@ -1,7 +1,6 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('a[data-confirm]').click(function(ev) {
|
||||
var href = $(this).attr('href');
|
||||
$('input[data-confirm]').click(function(ev) {
|
||||
var value = $(this).attr('value');
|
||||
if (!$('#dataConfirmModal').length) {
|
||||
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
|
||||
' >\n' +
|
||||
@ -14,7 +13,7 @@ $(document).ready(function () {
|
||||
' </div>\n' +
|
||||
|
||||
' <div class="modal-footer">\n' +
|
||||
' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
|
||||
' <button type="submit" name="deleteConference" class="btn btn-primary" id="deleteConference">Да</button>'+
|
||||
' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
@ -22,7 +21,7 @@ $(document).ready(function () {
|
||||
' </div>');
|
||||
}
|
||||
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
|
||||
$('#dataConfirmOK').attr('href', href);
|
||||
$('#deleteConference').attr('value', value);
|
||||
$('#dataConfirmModal').modal({show:true});
|
||||
return false;
|
||||
});
|
||||
|
@ -13,7 +13,8 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$('a[data-confirm]').click(function(ev) {
|
||||
var href = $(this).attr('href');
|
||||
var id = $(this).parent().parent().find('.id-class').val();
|
||||
|
||||
if (!$('#dataConfirmModal').length) {
|
||||
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
|
||||
' >\n' +
|
||||
@ -34,7 +35,10 @@ $(document).ready(function () {
|
||||
' </div>');
|
||||
}
|
||||
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
|
||||
$('#dataConfirmOK').attr('href', href);
|
||||
$('#dataConfirmOK').click(function () {
|
||||
$("#paperDeleteId").val(id);
|
||||
$('form').submit();
|
||||
});
|
||||
$('#dataConfirmModal').modal({show:true});
|
||||
return false;
|
||||
});
|
||||
|
42
src/main/resources/public/js/projects.js
Normal file
42
src/main/resources/public/js/projects.js
Normal file
@ -0,0 +1,42 @@
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(function () {
|
||||
$(".project-row").mouseenter(function (event) {
|
||||
var projectRow = $(event.target).closest(".project-row");
|
||||
$(projectRow).css("background-color", "#f8f9fa");
|
||||
$(projectRow).find(".remove-paper").removeClass("d-none");
|
||||
|
||||
});
|
||||
$(".project-row").mouseleave(function (event) {
|
||||
var projectRow = $(event.target).closest(".project-row");
|
||||
$(projectRow).css("background-color", "white");
|
||||
$(projectRow).find(".remove-paper").addClass("d-none");
|
||||
});
|
||||
|
||||
$('a[data-confirm]').click(function(ev) {
|
||||
var href = $(this).attr('href');
|
||||
if (!$('#dataConfirmModal').length) {
|
||||
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
|
||||
' >\n' +
|
||||
' <div class="modal-dialog modal-sm">\n' +
|
||||
' <div class="modal-content">\n' +
|
||||
' <div class="modal-header">\n' +
|
||||
' <h8 class="modal-title" id="myModalLabel">Удалить проект?</h8>\n' +
|
||||
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
|
||||
' aria-hidden="true">×</span></button>\n' +
|
||||
' </div>\n' +
|
||||
|
||||
' <div class="modal-footer">\n' +
|
||||
' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
|
||||
' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>');
|
||||
}
|
||||
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
|
||||
$('#dataConfirmOK').attr('href', href);
|
||||
$('#dataConfirmModal').modal({show:true});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
/*]]>*/
|
@ -90,7 +90,7 @@ $(document).ready(function () {
|
||||
' <div class="modal-dialog modal-sm">\n' +
|
||||
' <div class="modal-content">\n' +
|
||||
' <div class="modal-header">\n' +
|
||||
' <h8 class="modal-title" id="myModalLabel">Удалить статью?</h8>\n' +
|
||||
' <h8 class="modal-title" id="myModalLabel">Удалить задачу?</h8>\n' +
|
||||
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
|
||||
' aria-hidden="true">×</span></button>\n' +
|
||||
' </div>\n' +
|
||||
|
@ -135,11 +135,24 @@
|
||||
<div class="form-group">
|
||||
<label for="papers">Статьи:</label>
|
||||
<div class="paper-list form-control list-group" id="papers">
|
||||
<input th:type="hidden" th:field="*{papers}"/>
|
||||
<!--<input th:type="hidden" th:field="*{papers}"/>-->
|
||||
<div class="paper d-flex list-group-item p-0"
|
||||
th:each="paper, rowStat : *{papers}">
|
||||
<input type="hidden" th:field="*{papers[__${rowStat.index}__].id}"/>
|
||||
<input type="hidden" th:field="*{papers[__${rowStat.index}__].title}"/>
|
||||
<input type="hidden" th:field="*{papers[__${rowStat.index}__].status}"/>
|
||||
<a class="paper-name"
|
||||
th:href="@{'/papers/paper?id=' + *{papers[__${rowStat.index}__].id} + ''}">
|
||||
th:href="@{'/papers/paper?id=' + *{papers[__${rowStat.index}__].id} + ''}"
|
||||
th:if="*{papers[__${rowStat.index}__].id !=null}">
|
||||
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status})"/>
|
||||
<span th:text="*{papers[__${rowStat.index}__].title}">
|
||||
Имя статьи
|
||||
</span>
|
||||
|
||||
<!--<img class="icon-paper" src="/img/conference/paper.png"/>-->
|
||||
</a>
|
||||
<a class="paper-name"
|
||||
th:unless="*{papers[__${rowStat.index}__].id !=null}">
|
||||
<span th:text="*{papers[__${rowStat.index}__].title}">
|
||||
Имя статьи
|
||||
</span>
|
||||
@ -160,7 +173,7 @@
|
||||
</option>
|
||||
</select>
|
||||
<button id="add-paper" class="btn btn-primary"
|
||||
type="button">
|
||||
type="submit" name="addPaper">
|
||||
Добавить статью
|
||||
</button>
|
||||
</div>
|
||||
|
@ -8,7 +8,9 @@
|
||||
<body>
|
||||
|
||||
<div layout:fragment="content">
|
||||
<form id="conferences-form" method="post" th:action="@{'/conferences/conferences'}">
|
||||
<form id="conferences-form" method="post" th:action="@{'/conferences/conferences'}"
|
||||
th:object="${filteredConferences}">
|
||||
|
||||
<section id="conferences">
|
||||
<div class="container">
|
||||
<div class="row" id="conference-list">
|
||||
@ -18,9 +20,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="alert alert-danger" th:if="${#fields.hasErrors('*')}">
|
||||
<p th:each="err : ${#fields.errors('*')}" th:text="${err}"></p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-sm-12">
|
||||
<th:block th:each="conference : ${filteredConferences.conferences}">
|
||||
<th:block th:each="conference : *{conferences}">
|
||||
<div th:replace="conferences/fragments/confLineFragment :: confLine(conference=${conference})"/>
|
||||
</th:block>
|
||||
</div>
|
||||
|
@ -5,16 +5,19 @@
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="confLine (conference)" class="row text-left conference-row h3" style="background-color: white;">
|
||||
<div class="col d-flex justify-content-between">
|
||||
<div class="d-flex justify-content-between w-100">
|
||||
<a th:href="@{'conference?id='+${conference.id}}" class="w-100 text-decoration">
|
||||
<span class="h5" th:text="${conference.title}"/>
|
||||
<span class="text-muted h6 float-right m-2" th:text="${conference.datesString}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${conference.id}"/>
|
||||
<a class="remove-paper pull-right m-auto" th:href="@{'/conferences/delete/'+${conference.id}}"
|
||||
data-confirm="Удалить конференцию?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
<input type="submit" class="icon icon-delete grey-border"
|
||||
alt="Удалить" th:value="${conference.id}"
|
||||
data-confirm="Удалить конференцию?"/>
|
||||
<!--<a class="remove-paper pull-right m-auto" th:href="@{'/conferences/delete/'+${conference.id}}"-->
|
||||
<!--data-confirm="Удалить конференцию?">-->
|
||||
<!--<i class="fa fa-trash" aria-hidden="true"></i>-->
|
||||
<!--</a>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -55,7 +55,8 @@
|
||||
<a class="nav-link js-scroll-trigger" target="_blank" href="http://is.ulstu.ru">Сайт кафедры</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link js-scroll-trigger" target="_blank" th:href="@{'http://timetable.athene.tech?filter='+${currentUser}}">Расписание</a>
|
||||
<a class="nav-link js-scroll-trigger" target="_blank"
|
||||
th:href="@{'http://timetable.athene.tech?filter='+${currentUser}}">Расписание</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link js-scroll-trigger" target="_blank" href="https://kias.rfbr.ru/">КИАС РФФИ</a>
|
||||
@ -97,36 +98,54 @@
|
||||
<script src="/js/core.js"></script>
|
||||
<script src="/js/config.js"></script>
|
||||
<script src="/js/odin.js"></script>
|
||||
<script th:inline="javascript">
|
||||
|
||||
/*<![CDATA[*/
|
||||
var message = /*[[${flashMessage}]]*/ "";
|
||||
if (message && message.length > 0) {
|
||||
showFeedbackMessage(message, MessageTypesEnum.DANGER);
|
||||
}
|
||||
/*]]>*/
|
||||
|
||||
|
||||
</script>
|
||||
<th:block layout:fragment="scripts">
|
||||
</th:block>
|
||||
<!-- Yandex.Metrika counter -->
|
||||
<script type="text/javascript" >
|
||||
<script type="text/javascript">
|
||||
(function (d, w, c) {
|
||||
(w[c] = w[c] || []).push(function() {
|
||||
(w[c] = w[c] || []).push(function () {
|
||||
try {
|
||||
w.yaCounter49387279 = new Ya.Metrika2({
|
||||
id:49387279,
|
||||
clickmap:true,
|
||||
trackLinks:true,
|
||||
accurateTrackBounce:true,
|
||||
webvisor:true
|
||||
id: 49387279,
|
||||
clickmap: true,
|
||||
trackLinks: true,
|
||||
accurateTrackBounce: true,
|
||||
webvisor: true
|
||||
});
|
||||
} catch(e) { }
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
|
||||
var n = d.getElementsByTagName("script")[0],
|
||||
s = d.createElement("script"),
|
||||
f = function () { n.parentNode.insertBefore(s, n); };
|
||||
f = function () {
|
||||
n.parentNode.insertBefore(s, n);
|
||||
};
|
||||
s.type = "text/javascript";
|
||||
s.async = true;
|
||||
s.src = "https://mc.yandex.ru/metrika/tag.js";
|
||||
|
||||
if (w.opera == "[object Opera]") {
|
||||
d.addEventListener("DOMContentLoaded", f, false);
|
||||
} else { f(); }
|
||||
} else {
|
||||
f();
|
||||
}
|
||||
})(document, window, "yandex_metrika_callbacks2");
|
||||
</script>
|
||||
<noscript><div><img src="https://mc.yandex.ru/watch/49387279" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||
<noscript>
|
||||
<div><img src="https://mc.yandex.ru/watch/49387279" style="position:absolute; left:-9999px;" alt=""/></div>
|
||||
</noscript>
|
||||
<!-- /Yandex.Metrika counter -->
|
||||
</body>
|
||||
</html>
|
||||
|
@ -144,9 +144,9 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Участники гранта:</label>
|
||||
<select class="selectpicker form-control" multiple="true"
|
||||
<select class="selectpicker form-control" multiple="true" data-live-search="true"
|
||||
title="-- Выберите участников --" id="authors"
|
||||
th:field="*{authorIds}">
|
||||
th:field="*{authorIds}" data-size="5">
|
||||
<option th:each="author : ${allAuthors}" th:value="${author.id}"
|
||||
th:text="${author.lastName}"> Участник
|
||||
</option>
|
||||
@ -154,9 +154,48 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Список статей:</label>
|
||||
<p><a href="./#" class="btn btn-primary"><i class="fa fa-plus-circle"
|
||||
aria-hidden="true">
|
||||
</i> Добавить статью</a></p>
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<select class="selectpicker form-control" multiple="true"
|
||||
data-live-search="true"
|
||||
title="Прикрепить статью" id="allPapers"
|
||||
th:field="*{paperIds}" data-size="5">
|
||||
<option th:each="paper : ${allPapers}" th:value="${paper.id}"
|
||||
th:text="${paper.title}">Статья для прикрепления
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4 div-view-paper">
|
||||
<a th:onclick="|$('#attachPaper').click();|">
|
||||
<span aria-hidden="true">
|
||||
<label>Отобразить</label>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<input type="submit" hidden="hidden" id="attachPaper" name="attachPaper"
|
||||
value="Отобразить прикрепленную статью"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<input th:type="hidden" th:field="*{papers}"/>
|
||||
<div class="form-control list-group div-selected-papers" id="selected-papers">
|
||||
<div th:each="paper, rowStat : *{papers}">
|
||||
<div class="col">
|
||||
<a th:href="@{'/papers/paper?id=' + *{papers[__${rowStat.index}__].id} + ''}">
|
||||
<img class="icon-paper" src="/img/conference/paper.png"/>
|
||||
<span th:text="*{papers[__${rowStat.index}__].title}">
|
||||
Название статьи
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label>Статус: </label>
|
||||
<span th:text="*{papers[__${rowStat.index}__].status.statusName}">
|
||||
Статус статьи
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div th:if="*{project} == null">
|
||||
@ -203,6 +242,8 @@
|
||||
/*]]>*/
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function updateAuthors() {
|
||||
@ -212,6 +253,23 @@
|
||||
var lid = $("#leaderId option:selected").val();
|
||||
$("#authors [value='" + lid + "']").attr("disabled", "disabled");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function viewdiv(id) {
|
||||
var el = document.getElementById(id);
|
||||
var link = document.getElementById('toggleLink');
|
||||
if (el.style.display == "block") {
|
||||
el.style.display = "none";
|
||||
link.innerText = link.getAttribute('data-text-hide');
|
||||
} else {
|
||||
el.style.display = "block";
|
||||
link.innerText = link.getAttribute('data-text-show');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -8,7 +8,8 @@
|
||||
<div th:fragment="filesList (isLatexAttach)" th:remove="tag">
|
||||
<th:block th:each="file, rowStat : *{files}">
|
||||
|
||||
<span th:if="${(!isLatexAttach and file.isLatexAttach == null) or file.isLatexAttach == isLatexAttach}" th:remove="tag">
|
||||
<span th:if="${(!isLatexAttach and file.isLatexAttach == null) or file.isLatexAttach == isLatexAttach}"
|
||||
th:remove="tag">
|
||||
|
||||
<div class="row" th:id="|files${rowStat.index}|"
|
||||
th:style="${file.deleted} ? 'display: none;' :''">
|
||||
|
@ -12,8 +12,7 @@
|
||||
<span class="text-muted" th:text="${paper.authorsString}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${paper.id}"/>
|
||||
<a class="remove-paper pull-right d-none" th:href="@{'/papers/delete/'+${paper.id}}"
|
||||
data-confirm="Удалить статью?">
|
||||
<a class="remove-paper pull-right d-none" href="#" data-confirm="Удалить статью?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -7,7 +7,8 @@
|
||||
<body>
|
||||
|
||||
<div class="container" layout:fragment="content">
|
||||
<form id="papers-form" method="post" th:action="@{'/papers/papers'}">
|
||||
<form id="papers-form" method="post" th:action="@{'/papers/papers'}"
|
||||
th:object="${filteredPapers}">
|
||||
<input th:type="hidden" name="paperDeleteId" id="paperDeleteId"/>
|
||||
<section id="papers">
|
||||
<div class="container">
|
||||
@ -17,7 +18,11 @@
|
||||
<div th:replace="papers/fragments/paperNavigationFragment"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="alert alert-danger" th:if="${#fields.hasErrors('*')}">
|
||||
<p th:each="err : ${#fields.errors('*')}" th:text="${err}"></p>
|
||||
</div>
|
||||
<div class="col-md-9 col-sm-12">
|
||||
<th:block th:each="paper : ${filteredPapers.papers}">
|
||||
<div th:replace="papers/fragments/paperLineFragment :: paperLine(paper=${paper})"/>
|
||||
@ -43,7 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>
|
||||
<!--<div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>-->
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
<div th:replace="projects/fragments/projectNavigationFragment"/>
|
||||
</div>
|
||||
<div class="row justify-content-center" id="dashboard">
|
||||
<th:block>
|
||||
<div/>
|
||||
<th:block th:each="project : ${projects}">
|
||||
<div th:replace="projects/fragments/projectDashboardFragment :: projectDashboard(project=${project})"/>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="projectDashboard (project)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<span th:replace="projects/fragments/projectStatusFragment :: projectStatus(projectStatus=${project.status})"/>
|
||||
</div>
|
||||
<div class="col col-10 text-right">
|
||||
<h7 class="service-heading" th:text="${project.title}"> title</h7>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -12,6 +12,10 @@
|
||||
<span class="text-muted" th:text="${project.description}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${project.id}"/>
|
||||
<a class="remove-paper pull-right d-none" th:href="@{'/projects/delete/'+${project.id}}"
|
||||
data-confirm="Удалить проект?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<span th:fragment="paperStatus (paperStatus)" class="fa-stack fa-1x">
|
||||
<span th:fragment="projectStatus (projectStatus)" class="fa-stack fa-1x">
|
||||
<th:block th:switch="${projectStatus.name()}">
|
||||
<div th:case="'APPLICATION'">
|
||||
<i class="fa fa-circle fa-stack-2x text-draft"></i>
|
||||
|
@ -71,16 +71,21 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Дедлайны показателей:</label>
|
||||
<div class="row">
|
||||
<input type="hidden"/>
|
||||
<div class="col-6">
|
||||
<input type="date" class="form-control" name="deadline"/>
|
||||
<div class="row" th:each="deadline, rowStat : *{deadlines}">
|
||||
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
|
||||
<div class="col-6 div-deadline-date">
|
||||
<input type="date" class="form-control form-deadline-date" name="deadline"
|
||||
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input class="form-control" type="text" placeholder="Описание"/>
|
||||
<div class="col-4 div-deadline-description">
|
||||
<input class="form-control" type="text" placeholder="Описание"
|
||||
th:field="*{deadlines[__${rowStat.index}__].description}"/>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<a class="btn btn-danger float-right"><span
|
||||
<a class="btn btn-danger float-right"
|
||||
th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
|
||||
$('#deadlines${rowStat.index}\\.date').val('');
|
||||
$('#addDeadline').click();|"><span
|
||||
aria-hidden="true"><i class="fa fa-times"/></span>
|
||||
</a>
|
||||
</div>
|
||||
@ -90,8 +95,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" id="addDeadline" name="addDeadline" class="btn btn-primary"
|
||||
value="Добавить
|
||||
дедлайн"/>
|
||||
value="Добавить дедлайн"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@ -110,7 +114,8 @@
|
||||
Сохранить
|
||||
</button>
|
||||
<button id="cancelButton" class="btn btn-default text-uppercase"
|
||||
href="/projects/projects">
|
||||
onclick="location.href='/projects/projects'" href="/projects/projects"
|
||||
type="button">
|
||||
Отмена
|
||||
</button>
|
||||
</div>
|
||||
|
@ -27,7 +27,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div id="modalDelete"/>
|
||||
</form>
|
||||
<script src="/js/projects.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -14,10 +14,10 @@
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row justify-content-center" id="dashboard">
|
||||
<div th:replace="students/fragments/taskDashboardFragment"/>
|
||||
<!--<th:block th:each="task : ${tasks}">-->
|
||||
<!--<div th:replace="students/fragments/taskDashboardFragment :: taskDashboard(task=${task})"/>-->
|
||||
<!--</th:block>-->
|
||||
<th:block th:each="task : ${tasks}">
|
||||
<div th:replace="students/fragments/taskDashboardFragment :: taskDashboard(task=${task})"/>
|
||||
</th:block>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -6,9 +6,6 @@
|
||||
<body>
|
||||
<span th:fragment="taskStatus (taskStatus)" class="fa-stack fa-1x">
|
||||
<th:block th:switch="${taskStatus.name()}">
|
||||
<!--<div th:case="'ATTENTION'">-->
|
||||
<!--<i class="fa fa-circle fa-stack-2x text-warning"></i>-->
|
||||
<!--</div>-->
|
||||
<div th:case="'IN_WORK'">
|
||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<form id="tasks-form" method="post" th:action="@{'/tasks/tasks'}">
|
||||
<form id="tasks-form" method="post" th:action="@{'/students/tasks'}">
|
||||
<input th:type="hidden" name="taskDeleteId" id="taskDeleteId"/>
|
||||
<section id="tasks">
|
||||
<div class="container">
|
||||
@ -20,27 +20,43 @@
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-sm-12">
|
||||
<th:block th:each="task : ${tasks}">
|
||||
<th:block th:each="task : ${filteredTasks.tasks}">
|
||||
<div th:replace="students/fragments/taskLineFragment :: taskLine(task=${task})"/>
|
||||
</th:block>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-12">
|
||||
<div class="sorting">
|
||||
<h5>Сортировать:</h5>
|
||||
<select class="form-control selectpicker" size="auto" th:field="${filteredTasks.order}"
|
||||
id="order"
|
||||
onchange="this.form.submit();">
|
||||
<option th:value="new">
|
||||
Сначала новые
|
||||
</option>
|
||||
<option th:value="old">
|
||||
Сначала старые
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter">
|
||||
<h5>Фильтр:</h5>
|
||||
<select class="form-control" id="status"
|
||||
<select class="form-control selectpicker" size="auto" th:field="${filteredTasks.status}"
|
||||
id="status"
|
||||
onchange="this.form.submit();">
|
||||
<option value="">Все статусы</option>
|
||||
<!--<option th:each="author: ${allAuthors}" th:value="${author.id}"-->
|
||||
<!--th:text="${author.lastName}">lastName-->
|
||||
<!--</option>-->
|
||||
<option th:each="status: ${allStatuses}" th:value="${status}"
|
||||
th:text="${status.statusName}">
|
||||
status
|
||||
</option>
|
||||
</select>
|
||||
<select class="form-control selectpicker" size="auto" data-live-search="true"
|
||||
th:field="${filteredTasks.tag}" id="tags"
|
||||
onchange="this.form.submit();">
|
||||
<option value="">Все теги</option>
|
||||
<option th:each="tag: ${allTags}" th:value="${tag.id}"
|
||||
th:text="${tag.tagName}">tag
|
||||
</option>
|
||||
</select>
|
||||
<select class="form-control" id="tags"
|
||||
onchange="this.form.submit();">
|
||||
<option value="">Все типы</option>
|
||||
<!--<option th:each="year: ${allYears}" th:value="${year}"-->
|
||||
<!--th:text="${year}">year-->
|
||||
<!--</option>-->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user