Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Васин Антон 2019-04-26 10:01:21 +03:00
commit b2d4d52675
59 changed files with 1204 additions and 155 deletions

View File

@ -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;
@ -57,6 +56,8 @@ public class ConferenceController {
@GetMapping("/dashboard")
public void getDashboard(ModelMap modelMap) {
modelMap.put("conferences", conferenceService.findAllActiveDto());
conferenceService.setChartData(modelMap); // example
}
@GetMapping("/conference")
@ -68,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);
@ -76,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;
@ -105,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 {
@ -124,6 +134,15 @@ public class ConferenceController {
return CONFERENCE_PAGE;
}
@PostMapping(value = "/conference", params = "pingConference")
public String ping(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
if (errors.hasErrors()) {
return CONFERENCE_PAGE;
}
conferenceService.ping(conferenceDto);
return CONFERENCE_PAGE;
}
@ModelAttribute("allParticipation")
public List<ConferenceUser.Participation> getAllParticipation() {
return conferenceService.getAllParticipations();

View File

@ -35,7 +35,7 @@ public class Conference extends BaseEntity {
private String url;
private int ping;
private int ping = 0;
@Column(name = "begin_date")
@Temporal(TemporalType.TIMESTAMP)
@ -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")})

View File

@ -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() {

View File

@ -1,6 +1,7 @@
package ru.ulstu.conference.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import ru.ulstu.conference.model.Conference;
@ -16,4 +17,11 @@ 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);
}

View File

@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.conference.model.ConferenceDto;
import ru.ulstu.conference.model.ConferenceFilterDto;
@ -12,6 +13,7 @@ import ru.ulstu.conference.repository.ConferenceRepository;
import ru.ulstu.deadline.service.DeadlineService;
import ru.ulstu.paper.model.Paper;
import ru.ulstu.paper.service.PaperService;
import ru.ulstu.ping.service.PingService;
import ru.ulstu.user.model.User;
import ru.ulstu.user.service.UserService;
@ -33,17 +35,20 @@ public class ConferenceService {
private final DeadlineService deadlineService;
private final PaperService paperService;
private final UserService userService;
private final PingService pingService;
public ConferenceService(ConferenceRepository conferenceRepository,
ConferenceUserService conferenceUserService,
DeadlineService deadlineService,
PaperService paperService,
UserService userService) {
UserService userService,
PingService pingService) {
this.conferenceRepository = conferenceRepository;
this.conferenceUserService = conferenceUserService;
this.deadlineService = deadlineService;
this.paperService = paperService;
this.userService = userService;
this.pingService = pingService;
}
public ConferenceDto getExistConferenceById(Integer id) {
@ -111,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 {
@ -141,15 +156,15 @@ public class ConferenceService {
conference.setTitle(conferenceDto.getTitle());
conference.setDescription(conferenceDto.getDescription());
conference.setUrl(conferenceDto.getUrl());
conference.setPing(0);
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;
}
@ -173,4 +188,40 @@ public class ConferenceService {
public List<Conference> findAllActive() {
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()));
conferenceRepository.updatePingConference(conferenceDto.getId());
}
public Conference findOne(Integer conferenceId) {
return conferenceRepository.findOne(conferenceId);
}
public void setChartData(ModelMap modelMap) {
//first, add the regional sales
Integer northeastSales = 17089;
Integer westSales = 10603;
Integer midwestSales = 5223;
Integer southSales = 10111;
modelMap.addAttribute("northeastSales", northeastSales);
modelMap.addAttribute("southSales", southSales);
modelMap.addAttribute("midwestSales", midwestSales);
modelMap.addAttribute("westSales", westSales);
//now add sales by lure type
List<Integer> inshoreSales = Arrays.asList(4074, 3455, 4112);
List<Integer> nearshoreSales = Arrays.asList(3222, 3011, 3788);
List<Integer> offshoreSales = Arrays.asList(7811, 7098, 6455);
modelMap.addAttribute("inshoreSales", inshoreSales);
modelMap.addAttribute("nearshoreSales", nearshoreSales);
modelMap.addAttribute("offshoreSales", offshoreSales);
}
}

View File

@ -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);

View File

@ -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);
@ -88,6 +97,14 @@ public class GrantController {
return GRANT_PAGE;
}
@PostMapping(value = "/grant", params = "removeDeadline")
public String removeDeadline(GrantDto grantDto,
@RequestParam(value = "removeDeadline") Integer deadlineId) {
grantService.removeDeadline(grantDto, deadlineId);
return GRANT_PAGE;
}
@PostMapping(value = "/grant", params = "createProject")
public String createProject(@Valid GrantDto grantDto, Errors errors) throws IOException {
if (errors.hasErrors()) {
@ -113,6 +130,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()))

View File

@ -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;
@ -62,8 +64,6 @@ public class Grant extends BaseEntity implements UserContainer {
@OrderBy("date")
private List<Deadline> deadlines = new ArrayList<>();
//Описание гранта
@NotNull
private String comment;
//Заявка на грант
@ -83,6 +83,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 +158,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()

View File

@ -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,9 @@ public class GrantDto {
private boolean wasLeader;
private boolean hasAge;
private boolean hasDegree;
private List<Integer> paperIds = new ArrayList<>();
private List<Paper> papers = new ArrayList<>();
private List<Integer> removedDeadlineIds = new ArrayList<>();
public GrantDto() {
deadlines.add(new Deadline());
@ -49,7 +53,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 +68,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 +86,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 +200,28 @@ 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;
}
public List<Integer> getRemovedDeadlineIds() {
return removedDeadlineIds;
}
public void setRemovedDeadlineIds(List<Integer> removedDeadlineIds) {
this.removedDeadlineIds = removedDeadlineIds;
}
}

View File

@ -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,6 +91,10 @@ 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;
}
@ -100,6 +109,7 @@ public class GrantService {
if (grantDto.getApplicationFileName() != null && grant.getApplication() != null) {
fileService.deleteFile(grant.getApplication());
}
grantDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
grantRepository.save(copyFromDto(grant, grantDto));
return grant.getId();
}
@ -118,7 +128,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 +137,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 +167,30 @@ 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();
}
}
public void removeDeadline(GrantDto grantDto, Integer deadlineId) {
if (grantDto.getDeadlines().get(deadlineId).getId() != null) {
grantDto.getRemovedDeadlineIds().add(grantDto.getDeadlines().get(deadlineId).getId());
}
grantDto.getDeadlines().remove((int) deadlineId);
}
}

View File

@ -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();

View File

@ -11,7 +11,8 @@ 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.model.ReferenceDto;
import ru.ulstu.paper.service.PaperService;
import javax.validation.Valid;
@ -58,12 +59,17 @@ 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")
public Response<List<String>> getFormattedPaperList() {
return new Response<>(paperService.getFormattedPaperList());
}
@PostMapping("/getFormattedReference")
public Response<String> getFormattedReference(@RequestBody @Valid ReferenceDto referenceDto) {
return new Response<>(paperService.getFormattedReference(referenceDto));
}
}

View File

@ -0,0 +1,7 @@
package ru.ulstu.paper.error;
public class PaperConferenceRelationExistException extends RuntimeException {
public PaperConferenceRelationExistException(String message) {
super(message);
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,129 @@
package ru.ulstu.paper.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ReferenceDto {
public enum ReferenceType {
ARTICLE("Статья"),
BOOK("Книга");
private String typeName;
ReferenceType(String name) {
this.typeName = name;
}
public String getTypeName() {
return typeName;
}
}
public enum FormatStandard {
GOST("ГОСТ"),
SPRINGER("Springer");
private String standardName;
FormatStandard(String name) {
this.standardName = name;
}
public String getStandardName() {
return standardName;
}
}
private String authors;
private String publicationTitle;
private Integer publicationYear;
private String publisher;
private String pages;
private String journalOrCollectionTitle;
private ReferenceType referenceType;
private FormatStandard formatStandard;
@JsonCreator
public ReferenceDto(
@JsonProperty("authors") String authors,
@JsonProperty("publicationTitle") String publicationTitle,
@JsonProperty("publicationYear") Integer publicationYear,
@JsonProperty("publisher") String publisher,
@JsonProperty("pages") String pages,
@JsonProperty("journalOrCollectionTitle") String journalOrCollectionTitle,
@JsonProperty("referenceType") ReferenceType referenceType,
@JsonProperty("formatStandard") FormatStandard formatStandard) {
this.authors = authors;
this.publicationTitle = publicationTitle;
this.publicationYear = publicationYear;
this.publisher = publisher;
this.pages = pages;
this.journalOrCollectionTitle = journalOrCollectionTitle;
this.referenceType = referenceType;
this.formatStandard = formatStandard;
}
public String getAuthors() {
return authors;
}
public void setAuthors(String authors) {
this.authors = authors;
}
public String getPublicationTitle() {
return publicationTitle;
}
public void setPublicationTitle(String publicationTitle) {
this.publicationTitle = publicationTitle;
}
public Integer getPublicationYear() {
return publicationYear;
}
public void setPublicationYear(Integer publicationYear) {
this.publicationYear = publicationYear;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getPages() {
return pages;
}
public void setPages(String pages) {
this.pages = pages;
}
public String getJournalOrCollectionTitle() {
return journalOrCollectionTitle;
}
public void setJournalOrCollectionTitle(String journalOrCollectionTitle) {
this.journalOrCollectionTitle = journalOrCollectionTitle;
}
public ReferenceType getReferenceType() {
return referenceType;
}
public void setReferenceType(ReferenceType referenceType) {
this.referenceType = referenceType;
}
public FormatStandard getFormatStandard() {
return formatStandard;
}
public void setFormatStandard(FormatStandard formatStandard) {
this.formatStandard = formatStandard;
}
}

View File

@ -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);
}

View File

@ -9,13 +9,15 @@ 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.model.ReferenceDto;
import ru.ulstu.paper.repository.PaperRepository;
import ru.ulstu.timeline.service.EventService;
import ru.ulstu.user.model.User;
import ru.ulstu.user.service.UserService;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
@ -32,6 +34,9 @@ import static ru.ulstu.paper.model.Paper.PaperStatus.DRAFT;
import static ru.ulstu.paper.model.Paper.PaperStatus.FAILED;
import static ru.ulstu.paper.model.Paper.PaperStatus.ON_PREPARATION;
import static ru.ulstu.paper.model.Paper.PaperType.OTHER;
import static ru.ulstu.paper.model.ReferenceDto.FormatStandard.GOST;
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.ARTICLE;
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.BOOK;
@Service
public class PaperService {
@ -93,6 +98,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 +186,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 +236,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 +249,10 @@ public class PaperService {
}
public List<Paper> findAllSelect(List<Integer> paperIds) {
return sortPapers(paperRepository.findAllByIdIn(paperIds));
}
public List<User> getPaperAuthors() {
return userService.findAll();
}
@ -260,4 +277,30 @@ public class PaperService {
.map(User::getUserAbbreviate)
.collect(Collectors.joining(", "));
}
public String getFormattedReference(ReferenceDto referenceDto) {
return referenceDto.getFormatStandard() == GOST
? getGostReference(referenceDto)
: getSpringerReference(referenceDto);
}
public String getGostReference(ReferenceDto referenceDto) {
return MessageFormat.format(referenceDto.getReferenceType() == BOOK ? "{0} {1} - {2}{3}. - {4}с." : "{0} {1}{5} {2}{3}. С. {4}.",
referenceDto.getAuthors(),
referenceDto.getPublicationTitle(),
StringUtils.isEmpty(referenceDto.getPublisher()) ? "" : referenceDto.getPublisher() + ", ",
referenceDto.getPublicationYear().toString(),
referenceDto.getPages(),
StringUtils.isEmpty(referenceDto.getJournalOrCollectionTitle()) ? "." : " // " + referenceDto.getJournalOrCollectionTitle() + ".");
}
public String getSpringerReference(ReferenceDto referenceDto) {
return MessageFormat.format("{0} ({1}) {2}.{3} {4}pp {5}",
referenceDto.getAuthors(),
referenceDto.getPublicationYear().toString(),
referenceDto.getPublicationTitle(),
referenceDto.getReferenceType() == ARTICLE ? " " + referenceDto.getJournalOrCollectionTitle() + "," : "",
StringUtils.isEmpty(referenceDto.getPublisher()) ? "" : referenceDto.getPublisher() + ", ",
referenceDto.getPages());
}
}

View File

@ -0,0 +1,73 @@
package ru.ulstu.ping.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.user.model.User;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
@Entity
@Table(name = "ping")
public class Ping extends BaseEntity {
@Temporal(value = TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date date;
@ManyToOne(optional = false)
@JoinColumn(name = "users_id")
private User user;
@ManyToOne(optional = false)
@JoinColumn(name = "conference_id")
private Conference conference;
public Ping() {
}
public Ping(Date date, User user) {
this.date = date;
this.user = user;
}
public Ping(@JsonProperty("id") Integer id,
@JsonProperty("date") Date date,
@JsonProperty("user") User user,
@JsonProperty("conference") Conference conference) {
setId(id);
this.date = date;
this.user = user;
this.conference = conference;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Conference getConference() {
return conference;
}
public void setConference(Conference conference) {
this.conference = conference;
}
}

View File

@ -0,0 +1,7 @@
package ru.ulstu.ping.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.ulstu.ping.model.Ping;
public interface PingRepository extends JpaRepository<Ping, Integer> {
}

View File

@ -0,0 +1,30 @@
package ru.ulstu.ping.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ru.ulstu.conference.model.Conference;
import ru.ulstu.ping.model.Ping;
import ru.ulstu.ping.repository.PingRepository;
import ru.ulstu.user.service.UserService;
import java.io.IOException;
import java.util.Date;
@Service
public class PingService {
private final PingRepository pingRepository;
private final UserService userService;
public PingService(PingRepository pingRepository,
UserService userService) {
this.pingRepository = pingRepository;
this.userService = userService;
}
@Transactional
public void addPing(Conference conference) throws IOException {
Ping newPing = new Ping(new Date(), userService.getCurrentUser());
newPing.setConference(conference);
pingRepository.save(newPing);
}
}

View File

@ -5,6 +5,7 @@ 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;
@ -78,6 +79,12 @@ public class ProjectController {
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()))

View File

@ -15,7 +15,6 @@ public class ProjectDto {
@NotEmpty
private String title;
private Project.ProjectStatus status;
private String statusName;
private String description;
private List<Deadline> deadlines = new ArrayList<>();
private GrantDto grant;
@ -40,7 +39,6 @@ public class ProjectDto {
this.id = id;
this.title = title;
this.status = status;
this.statusName = status.getStatusName();
this.description = description;
this.grant = grant;
this.repository = repository;
@ -53,7 +51,6 @@ public class ProjectDto {
this.id = project.getId();
this.title = project.getTitle();
this.status = project.getStatus();
this.statusName = project.getStatus().getStatusName();
this.description = project.getDescription();
this.applicationFileName = project.getApplication() == null ? null : project.getApplication().getName();
this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant());
@ -85,14 +82,6 @@ public class ProjectDto {
this.status = status;
}
public String getStatusName() {
return statusName;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public String getDescription() {
return description;
}

View File

@ -72,6 +72,15 @@ public class ProjectService {
return project;
}
@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());

View File

@ -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()))

View File

@ -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)

View File

@ -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());

View 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;
}
}

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View 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>

View File

@ -0,0 +1,28 @@
<?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="vova" id="20190424_000000-1">
<createTable tableName="ping">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="date" type="timestamp">
<constraints nullable="false"/>
</column>
<column name="users_id" type="integer">
<constraints nullable="false"/>
</column>
<column name="conference_id" type="integer"/>
<column name="version" type="integer"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_ping" tableName="ping"/>
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="users_id"
constraintName="fk_ping_users_id" referencedTableName="users"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="conference_id"
constraintName="fk_ping_conference_id" referencedTableName="conference"
referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>

View File

@ -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>

View File

@ -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;
@ -77,6 +91,16 @@ body {
border-right: 1px solid #ced4da;
}
#ping-button[disabled=disabled] {
background-color: #ced4da;
border-color: #c2c5c7;
}
#ping-button[disabled=disabled]:hover {
background-color: #737475 !important;
border-color: #5d5e5f !important;
}
#take-part[disabled=disabled] {
background-color: #ced4da;
border-color: #c2c5c7;
@ -104,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;
@ -117,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;
}
@ -153,6 +188,22 @@ body {
float: right;
}
.note-1 {
background-color: #bfffce;
}
.note-2 {
background-color: #eaffb4;
}
.note-3 {
background-color: #fff69f;
}
.note-4 {
background-color: #ff9973;
}
@media (max-width: 1199px) and (min-width: 768px){
.paper-control {
display: block!important;

View File

@ -9,4 +9,23 @@
.div-deadline-description{
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;
}
.btn-delete-deadline {
color: black;
}

View File

@ -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;

View File

@ -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;
});

View File

@ -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;
});

View 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">&times;</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;
});
});
/*]]>*/

View File

@ -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">&times;</span></button>\n' +
' </div>\n' +

View File

@ -121,7 +121,11 @@
</div>
</div>
<div class="form-group d-flex justify-content-end">
<div class="form-group d-flex justify-content-between flex-wrap">
<!--<input type="hidden" th:value="*{ping}" th:name="ping"/>-->
<input id="ping-button" class="btn btn-primary"
type="submit" name="pingConference" value="Ping участникам"
th:disabled="*{id == null ? 'true' : 'false'}"/>
<input type="hidden" th:value="*{disabledTakePart}" th:name="disabledTakePart"/>
<input id="take-part" class="btn btn-primary"
type="submit" name="takePart" value="Принять участие"
@ -131,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>
@ -156,7 +173,7 @@
</option>
</select>
<button id="add-paper" class="btn btn-primary"
type="button">
type="submit" name="addPaper">
Добавить статью
</button>
</div>

View File

@ -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>

View File

@ -4,6 +4,7 @@
layout:decorator="default" xmlns:th="">
<head>
<link rel="stylesheet" type="text/css" href="../css/conference.css"/>
<script src="https://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div layout:fragment="content">
@ -21,8 +22,127 @@
<div th:replace="conferences/fragments/confDashboardFragment :: confDashboard(conference=${conference})"/>
</th:block>
</div>
<hr/>
<!--chart example-->
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab"
href="#nav-stat1" role="tab" aria-controls="nav-stat1" aria-selected="true">Стат1</a>
<a class="nav-item nav-link" id="nav-latex-tab" data-toggle="tab"
href="#nav-stat2" role="tab" aria-controls="nav-stat2" aria-selected="false">Стат2</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-stat1" role="tabpanel"
aria-labelledby="nav-main-tab">
<div id="salesByType" style="width:100%; height:400px;"></div>
</div>
<div class="tab-pane fade" id="nav-stat2" role="tabpanel"
aria-labelledby="nav-profile-tab">
<div id="salesByRegion" style="width:100%; height:400px;"></div>
</div>
</div>
<!--chart example-->
</div>
</section>
<script th:inline="javascript">
/*<![CDATA[*/
// chart example
$(function () {
Highcharts.setOptions({
lang: {
decimalPoint: '.',
thousandsSep: ','
}
});
drawSalesByTypeChart();
drawSalesByRegionChart();
});
function drawSalesByRegionChart() {
var salesByRegionChart = Highcharts.chart('salesByRegion', {
chart: {
type: 'pie',
margin: 40
},
title: {
text: 'Sales by Region'
},
tooltip: {
pointFormat: "${point.y:,.0f}"
},
plotOptions: {
pie: {
allowPointSelect: true,
depth: 35
}
},
series: [{
name: 'Regions',
colorByPoint:true,
data: [{
name: 'Northeast',
y: /*[[${northeastSales}]]*/ 0
},{
name: 'South',
y: /*[[${southSales}]]*/ 0
},{
name: 'Midwest',
y: /*[[${midwestSales}]]*/ 0
},{
name: 'West',
y: /*[[${westSales}]]*/ 0
}]
}]
});
}
function drawSalesByTypeChart() {
var salesByTypeChart = Highcharts.chart('salesByType', {
chart: {
type: 'column',
margin: 75
},
title: {
text: 'Sales by Lure Type'
},
xAxis: {
categories: ['May', 'June', 'July']
},
yAxis: {
title: {
text: 'Sales (US $)'
}
},
tooltip: {
pointFormat: "${point.y:,.0f}"
},
plotOptions: {
column: {
depth: 60,
stacking: true,
grouping: false,
groupZPadding: 10
}
},
series: [{
name: 'Inshore',
data: /*[[${inshoreSales}]]*/ []
}, {
name: 'Nearshore',
data: /*[[${nearshoreSales}]]*/ []
}, {
name: 'Offshore',
data: /*[[${offshoreSales}]]*/ []
}]
});
}
/*]]>*/
</script>
</div>
</body>
</html>

View File

@ -4,12 +4,13 @@
<meta charset="UTF-8"/>
</head>
<body>
<div th:fragment="confDashboard (conference)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
<div th:fragment="confDashboard (conference)" th:class="@{'col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card ' +
${conference.ping == 0 ? '' :
conference.ping &lt; 5 ? 'note-1' :
conference.ping &lt; 10 ? 'note-2' :
conference.ping &lt; 15 ? 'note-3' : 'note-4'} + ''}">
<div class="row">
<div class="col-2">
</div>
<div class="col col-10 text-right">
<div class="col text-right">
<p th:if="${conference.url!=null and conference.url!=''}"><a target="_blank" th:href="${conference.url}"><i
class="fa fa-external-link fa-1x"
aria-hidden="true"></i></a></p>

View File

@ -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>

View File

@ -21,7 +21,7 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
<a href="./conference?id=0" class="btn btn-light toolbar-button">
<i class="fa fa-plus-circle" aria-hidden="true"></i>
Новая конференцию</a>
Новая конференция</a>
</div>
</div>

View File

@ -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>

View File

@ -48,6 +48,7 @@
</div>
<div class="form-group">
<label>Дедлайны показателей:</label>
<input type="hidden" th:field="*{removedDeadlineIds}"/>
<div class="row" th:each="deadline, rowStat : *{deadlines}">
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
<div class="col-6 div-deadline-date">
@ -59,12 +60,14 @@
th:field="*{deadlines[__${rowStat.index}__].description}"/>
</div>
<div class="col-2">
<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>
<button type="submit"
class="btn btn-danger float-right btn-delete-deadline "
id="removeDeadline" name="removeDeadline"
th:value="${rowStat.index}">
<span aria-hidden="true">
<i class="fa fa-times"/>
</span>
</button>
</div>
</div>
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
@ -144,9 +147,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 +157,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 +245,8 @@
/*]]>*/
</script>
<script type="text/javascript">
function updateAuthors() {
@ -212,6 +256,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>

View File

@ -40,7 +40,7 @@
</div>
</div>
<div class="col-md-4 col-sm-6 portfolio-item">
<a class="portfolio-link" href="./projects/projects">
<a class="portfolio-link" href="./projects/dashboard">
<div class="portfolio-hover">
<div class="portfolio-hover-content">
<i class="fa fa-arrow-right fa-3x"></i>

View File

@ -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;' :''">

View File

@ -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>

View File

@ -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>

View File

@ -11,7 +11,6 @@
</div>
<div class="col col-10 text-right">
<h7 class="service-heading" th:text="${project.title}"> title</h7>
<p class="text-muted" th:text="${project.statusName}"> status</p>
</div>
</div>
</div>

View File

@ -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>

View File

@ -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>

View File

@ -27,7 +27,9 @@
</div>
</div>
</section>
<div id="modalDelete"/>
</form>
<script src="/js/projects.js"></script>
</div>
</body>
</html>

View File

@ -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>

View File

@ -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>

View File

@ -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>