Merge branch 'dev' into paper-latex-editing
# Conflicts: # src/main/java/ru/ulstu/paper/model/Paper.java # src/main/java/ru/ulstu/paper/model/PaperDto.java # src/main/java/ru/ulstu/paper/service/PaperService.java # src/main/resources/db/changelog-master.xml # src/main/resources/templates/papers/paper.htmlmerge-requests/60/head
commit
a2dca6b7c6
@ -0,0 +1,46 @@
|
||||
## Краткое описание задачи
|
||||
|
||||
Что требуется сделать
|
||||
|
||||
|
||||
## `Опционально` Список верстаемых страниц
|
||||
|
||||
Будут затронуты страницы:
|
||||
* page1.html
|
||||
* page2.html
|
||||
* page3.html
|
||||
|
||||
## `Опционально` Список затрагиваемых модулей
|
||||
|
||||
При реализации задачи потребуется также реализовать методы контроллера
|
||||
|
||||
|
||||
## `Опционально` Список реализуемых функций
|
||||
|
||||
После выполнения задачи станет доступным:
|
||||
* просмотр `entity_name`
|
||||
* редактирование `entity_name`
|
||||
* валидация `entity_name`
|
||||
|
||||
## `Опционально` Сценарии работы
|
||||
|
||||
Сценарий просмотра:
|
||||
1. Зайти на главную страницу приложения
|
||||
2. Перейти в раздел `section_name`
|
||||
3. Перейти к списку `entity_name`
|
||||
4. Выбрать нужную `entity_name` и нажать на нее
|
||||
|
||||
Сценарий редактирования:
|
||||
1. Зайти на главную страницу приложения
|
||||
2. Перейти в раздел `section_name`
|
||||
3. Перейти к списку `entity_name`
|
||||
4. Выбрать нужную `entity_name` и нажать на нее
|
||||
5. Внести нужные правки в поля и сохранить
|
||||
|
||||
## Описание конечного результата, дающего возможность проверки выполнения задачи: компоненты проекта, сценарии работы
|
||||
|
||||
* Сверстаны страницы page1.hml, page2.hml, page3.hml
|
||||
* Реализован контроллер для обслуживания страниц
|
||||
* Сохранение в БД еще не реализовано
|
||||
* Валидация происходит по полям `field1, field2`
|
||||
* Сценарий просмотра проверяется при ручном внечении записей в БД
|
@ -0,0 +1,116 @@
|
||||
package ru.ulstu.conference.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.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.model.ConferenceDto;
|
||||
import ru.ulstu.conference.model.ConferenceFilterDto;
|
||||
import ru.ulstu.conference.service.ConferenceService;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springframework.util.StringUtils.isEmpty;
|
||||
import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE;
|
||||
import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE;
|
||||
import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
||||
|
||||
|
||||
@Controller()
|
||||
@RequestMapping(value = "/conferences")
|
||||
@ApiIgnore
|
||||
public class ConferenceController {
|
||||
|
||||
private final ConferenceService conferenceService;
|
||||
|
||||
public ConferenceController(ConferenceService conferenceService) {
|
||||
this.conferenceService = conferenceService;
|
||||
}
|
||||
|
||||
@GetMapping("/conferences")
|
||||
public void getConferences(ModelMap modelMap) {
|
||||
modelMap.put("filteredConferences", new ConferenceFilterDto(conferenceService.findAllDto()));
|
||||
}
|
||||
|
||||
@GetMapping("/conference")
|
||||
public void getConference(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
|
||||
if (id != null && id > 0) {
|
||||
ConferenceDto conferenceDto = conferenceService.findOneDto(id);
|
||||
conferenceDto.setNotSelectedPapers(getNotSelectPapers(conferenceDto.getPaperIds()));
|
||||
modelMap.put("conferenceDto", conferenceDto);
|
||||
} else {
|
||||
ConferenceDto conferenceDto = new ConferenceDto();
|
||||
conferenceDto.setNotSelectedPapers(getNotSelectPapers(new ArrayList<Integer>()));
|
||||
modelMap.put("conferenceDto", conferenceDto);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "save")
|
||||
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
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) {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
conferenceDto.getDeadlines().add(new Deadline());
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "removeDeadline")
|
||||
public String removeDeadline(@Valid ConferenceDto conferenceDto, Errors errors,
|
||||
@RequestParam(value = "removeDeadline") Integer deadlineIndex) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
conferenceService.removeDeadline(conferenceDto, deadlineIndex);
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "removePaper")
|
||||
public String removePaper(@Valid ConferenceDto conferenceDto, Errors errors,
|
||||
@RequestParam(value = "removePaper") Integer paperIndex) throws IOException {
|
||||
if (errors.hasErrors()) {
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
conferenceService.removePaper(conferenceDto, paperIndex);
|
||||
return CONFERENCE_PAGE;
|
||||
}
|
||||
|
||||
public List<Paper> getNotSelectPapers(List<Integer> paperIds) {
|
||||
return conferenceService.getConferencePapers(paperIds);
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
||||
conferenceDto.setDeadlines(conferenceDto.getDeadlines().stream()
|
||||
.filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package ru.ulstu.conference.model;
|
||||
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.user.model.User;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Table(name = "conference")
|
||||
public class Conference extends BaseEntity {
|
||||
|
||||
@NotBlank
|
||||
private String title;
|
||||
|
||||
private String description;
|
||||
|
||||
private String url;
|
||||
|
||||
private int ping;
|
||||
|
||||
@Column(name = "begin_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date beginDate;
|
||||
|
||||
@Column(name = "end_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "conference_id", unique = true)
|
||||
@Fetch(FetchMode.SUBSELECT)
|
||||
@OrderBy("date")
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "paper_conference",
|
||||
joinColumns = {@JoinColumn(name = "conference_id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "paper_id")})
|
||||
private List<Paper> papers = new ArrayList<>();
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "users_conference",
|
||||
joinColumns = {@JoinColumn(name = "conference_id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "users_id")})
|
||||
private Set<User> users = new HashSet<>();
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public int getPing() {
|
||||
return ping;
|
||||
}
|
||||
|
||||
public void setPing(int ping) {
|
||||
this.ping = ping;
|
||||
}
|
||||
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public void setBeginDate(Date beginDate) {
|
||||
this.beginDate = beginDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public List<Deadline> getDeadlines() {
|
||||
return deadlines;
|
||||
}
|
||||
|
||||
public void setDeadlines(List<Deadline> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
|
||||
public List<Paper> getPapers() {
|
||||
return papers;
|
||||
}
|
||||
|
||||
public void setPapers(List<Paper> papers) {
|
||||
this.papers = papers;
|
||||
}
|
||||
|
||||
public Set<User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(Set<User> users) {
|
||||
this.users = users;
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
package ru.ulstu.conference.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.user.model.UserDto;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||
|
||||
public class ConferenceDto {
|
||||
|
||||
private Integer id;
|
||||
@NotEmpty
|
||||
@Size(min = 2, max = 400)
|
||||
private String title;
|
||||
@Size(max = 500)
|
||||
private String description = "";
|
||||
@Size(max = 255)
|
||||
private String url = "";
|
||||
private int ping = 0;
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date beginDate = new Date();
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate = new Date();
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
private List<Integer> removedDeadlineIds = new ArrayList<>();
|
||||
private Set<Integer> userIds = new HashSet<>();
|
||||
private List<Integer> paperIds = new ArrayList<>();
|
||||
private List<Paper> papers = new ArrayList<>();
|
||||
|
||||
|
||||
private List<Paper> notSelectedPapers = new ArrayList<>();
|
||||
private Set<UserDto> users = new HashSet<>();
|
||||
private Integer filterUserId;
|
||||
|
||||
public ConferenceDto() {
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public ConferenceDto(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("title") String title,
|
||||
@JsonProperty("description") String description,
|
||||
@JsonProperty("url") String url,
|
||||
@JsonProperty("ping") Integer ping,
|
||||
@JsonProperty("beginDate") Date beginDate,
|
||||
@JsonProperty("endDate") Date endDate,
|
||||
@JsonProperty("deadlines") List<Deadline> deadlines,
|
||||
@JsonProperty("userIds") Set<Integer> userIds,
|
||||
@JsonProperty("paperIds") List<Integer> paperIds,
|
||||
@JsonProperty("users") Set<UserDto> users,
|
||||
@JsonProperty("papers") List<Paper> papers,
|
||||
@JsonProperty("notSelectedPapers") List<Paper> notSelectedPapers) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.url = url;
|
||||
this.ping = ping;
|
||||
this.beginDate = beginDate;
|
||||
this.endDate = endDate;
|
||||
this.deadlines = deadlines;
|
||||
this.userIds = userIds;
|
||||
this.paperIds = paperIds;
|
||||
this.users = users;
|
||||
this.papers = papers;
|
||||
this.notSelectedPapers = notSelectedPapers;
|
||||
}
|
||||
|
||||
public ConferenceDto(Conference conference) {
|
||||
this.id = conference.getId();
|
||||
this.title = conference.getTitle();
|
||||
this.description = conference.getDescription();
|
||||
this.url = conference.getUrl();
|
||||
this.ping = conference.getPing();
|
||||
this.beginDate = conference.getBeginDate();
|
||||
this.endDate = conference.getEndDate();
|
||||
this.deadlines = conference.getDeadlines();
|
||||
this.userIds = convert(conference.getUsers(), user -> user.getId());
|
||||
this.paperIds = convert(conference.getPapers(), paper -> paper.getId());
|
||||
this.users = convert(conference.getUsers(), UserDto::new);
|
||||
this.papers = conference.getPapers();
|
||||
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public int getPing() {
|
||||
return ping;
|
||||
}
|
||||
|
||||
public void setPing(int ping) {
|
||||
this.ping = ping;
|
||||
}
|
||||
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public void setBeginDate(Date beginDate) {
|
||||
this.beginDate = beginDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public List<Deadline> getDeadlines() {
|
||||
return deadlines;
|
||||
}
|
||||
|
||||
public void setDeadlines(List<Deadline> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
|
||||
public Set<Integer> getUserIds() {
|
||||
return userIds;
|
||||
}
|
||||
|
||||
public void setUserIds(Set<Integer> userIds) {
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
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 Set<UserDto> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(Set<UserDto> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Integer getFilterUserId() {
|
||||
return filterUserId;
|
||||
}
|
||||
|
||||
public void setFilterUserId(Integer filterUserId) {
|
||||
this.filterUserId = filterUserId;
|
||||
}
|
||||
|
||||
public List<Integer> getRemovedDeadlineIds() {
|
||||
return removedDeadlineIds;
|
||||
}
|
||||
|
||||
public void setRemovedDeadlineIds(List<Integer> removedDeadlineIds) {
|
||||
this.removedDeadlineIds = removedDeadlineIds;
|
||||
}
|
||||
|
||||
public List<Paper> getNotSelectedPapers() {
|
||||
return notSelectedPapers;
|
||||
}
|
||||
|
||||
public void setNotSelectedPapers(List<Paper> notSelectedPapers) {
|
||||
this.notSelectedPapers = notSelectedPapers;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package ru.ulstu.conference.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConferenceFilterDto {
|
||||
|
||||
private List<ConferenceDto> conferences;
|
||||
private Integer filterAuthorId;
|
||||
private Integer year;
|
||||
|
||||
public ConferenceFilterDto() {
|
||||
}
|
||||
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferenceDtos, Integer filterAuthorId, Integer year) {
|
||||
this.conferences = conferenceDtos;
|
||||
this.filterAuthorId = filterAuthorId;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public ConferenceFilterDto(List<ConferenceDto> conferenceDtos) {
|
||||
this(conferenceDtos, null, null);
|
||||
}
|
||||
|
||||
public List<ConferenceDto> getConferences() {
|
||||
return conferences;
|
||||
}
|
||||
|
||||
public void setConferences(List<ConferenceDto> conferences) {
|
||||
this.conferences = conferences;
|
||||
}
|
||||
|
||||
public Integer getFilterAuthorId() {
|
||||
return filterAuthorId;
|
||||
}
|
||||
|
||||
public void setFilterAuthorId(Integer filterAuthorId) {
|
||||
this.filterAuthorId = filterAuthorId;
|
||||
}
|
||||
|
||||
public Integer getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(Integer year) {
|
||||
this.year = year;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.conference.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.conference.model.Conference;
|
||||
|
||||
public interface ConferenceRepository extends JpaRepository<Conference, Integer> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.conference.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferenceNotificationService {
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package ru.ulstu.conference.service;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ru.ulstu.conference.model.Conference;
|
||||
import ru.ulstu.conference.model.ConferenceDto;
|
||||
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 java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.isEmpty;
|
||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||
|
||||
@Service
|
||||
public class ConferenceService {
|
||||
private final static int MAX_DISPLAY_SIZE = 40;
|
||||
|
||||
private final ConferenceRepository conferenceRepository;
|
||||
private final DeadlineService deadlineService;
|
||||
private final PaperService paperService;
|
||||
|
||||
public ConferenceService(ConferenceRepository conferenceRepository,
|
||||
DeadlineService deadlineService,
|
||||
PaperService paperService) {
|
||||
this.conferenceRepository = conferenceRepository;
|
||||
this.deadlineService = deadlineService;
|
||||
this.paperService = paperService;
|
||||
}
|
||||
|
||||
public List<Conference> findAll() {
|
||||
return conferenceRepository.findAll();
|
||||
}
|
||||
|
||||
public List<ConferenceDto> findAllDto() {
|
||||
List<ConferenceDto> conferences = convert(findAll(), ConferenceDto::new);
|
||||
conferences.forEach(conferenceDto -> conferenceDto.setTitle(StringUtils.abbreviate(conferenceDto.getTitle(), MAX_DISPLAY_SIZE)));
|
||||
return conferences;
|
||||
}
|
||||
|
||||
public ConferenceDto findOneDto(Integer id) {
|
||||
return new ConferenceDto(conferenceRepository.findOne(id));
|
||||
}
|
||||
|
||||
public void save(ConferenceDto conferenceDto) throws IOException {
|
||||
if (isEmpty(conferenceDto.getId())) {
|
||||
create(conferenceDto);
|
||||
} else {
|
||||
update(conferenceDto);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer create(ConferenceDto conferenceDto) throws IOException {
|
||||
Conference newConference = copyFromDto(new Conference(), conferenceDto);
|
||||
newConference = conferenceRepository.save(newConference);
|
||||
return newConference.getId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer update(ConferenceDto conferenceDto) throws IOException {
|
||||
Conference conference = conferenceRepository.findOne(conferenceDto.getId());
|
||||
conferenceRepository.save(copyFromDto(conference, conferenceDto));
|
||||
conferenceDto.getRemovedDeadlineIds().forEach(deadlineService::remove);
|
||||
return conference.getId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void delete(Integer conferenceId) {
|
||||
if (conferenceRepository.exists(conferenceId)) {
|
||||
conferenceRepository.delete(conferenceId);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
||||
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
||||
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
||||
}
|
||||
conferenceDto.getDeadlines().remove((int) deadlineIndex);
|
||||
}
|
||||
|
||||
public void removePaper(ConferenceDto conferenceDto, Integer paperIndex) throws IOException {
|
||||
Paper removedPaper = conferenceDto.getPapers().remove((int) paperIndex);
|
||||
conferenceDto.getNotSelectedPapers().add(removedPaper);
|
||||
}
|
||||
|
||||
public List<Paper> getConferencePapers(List<Integer> paperIds) {
|
||||
return paperService.findAllNotSelect(paperIds);
|
||||
}
|
||||
|
||||
private Conference copyFromDto(Conference conference, ConferenceDto conferenceDto) throws IOException {
|
||||
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.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));
|
||||
if (conferenceDto.getPaperIds() != null && !conferenceDto.getPaperIds().isEmpty()) {
|
||||
conferenceDto.getPaperIds().forEach(paperId ->
|
||||
conference.getPapers().add(paperService.findEntityById(paperId)));
|
||||
}
|
||||
return conference;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package ru.ulstu.core.error;
|
||||
|
||||
public class XlsLoadException extends Exception {
|
||||
public XlsLoadException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package ru.ulstu.core.error;
|
||||
|
||||
public class XlsParseException extends Exception {
|
||||
public XlsParseException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package ru.ulstu.core.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.core.model.TreeDto;
|
||||
import ru.ulstu.core.model.TreeEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Service
|
||||
public class TreeService<T extends TreeEntity> {
|
||||
public TreeDto getTree(String rootName, List<T> rootItems) {
|
||||
return addChildNode(new TreeDto(rootName), rootItems, element -> true);
|
||||
}
|
||||
|
||||
public TreeDto getTree(String rootName, List<T> rootItems, Predicate<T> filterPredicate) {
|
||||
return addChildNode(new TreeDto(rootName), rootItems, filterPredicate);
|
||||
}
|
||||
|
||||
private TreeDto addChildNode(TreeDto currentRoot, List<T> children, Predicate<T> filterPredicate) {
|
||||
if (children != null) {
|
||||
children.stream()
|
||||
.filter(filterPredicate)
|
||||
.forEach(item -> {
|
||||
TreeDto newNode = new TreeDto(item);
|
||||
currentRoot.getChildren().add(addChildNode(newNode, item.getChildren(), filterPredicate));
|
||||
});
|
||||
}
|
||||
return currentRoot;
|
||||
}
|
||||
}
|
@ -1,207 +0,0 @@
|
||||
package ru.ulstu.core.service;
|
||||
|
||||
import org.apache.poi.POIXMLDocument;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import ru.ulstu.core.error.XlsParseException;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class XlsDocumentBuilder {
|
||||
private static final int DEFAULT_SHEET_NUM = 0;
|
||||
private File documentFile;
|
||||
private Workbook workBook;
|
||||
private Sheet currentSheet;
|
||||
|
||||
/**
|
||||
* Constructor for reading and writing data from/to *.[xls|xlsx] document
|
||||
*
|
||||
* @param file contains existing document for reading or new document to save
|
||||
*/
|
||||
public XlsDocumentBuilder(File file) throws IOException, XlsParseException {
|
||||
this.documentFile = file;
|
||||
if (file.exists()) {
|
||||
workBook = getWorkBook(file);
|
||||
currentSheet = workBook.getSheetAt(DEFAULT_SHEET_NUM);
|
||||
} else {
|
||||
workBook = new XSSFWorkbook();
|
||||
currentSheet = workBook.createSheet();
|
||||
}
|
||||
}
|
||||
|
||||
private Workbook getWorkBook(File file) throws XlsParseException, IOException {
|
||||
InputStream inputStream = new PushbackInputStream(new FileInputStream(file), 4096);
|
||||
if (isXlsx(inputStream)) {
|
||||
return new XSSFWorkbook(inputStream);
|
||||
} else if (isExcel(inputStream)) {
|
||||
return new HSSFWorkbook(inputStream);
|
||||
}
|
||||
throw new XlsParseException("Wrong document format");
|
||||
}
|
||||
|
||||
/**
|
||||
* Change active sheet to write or read data
|
||||
*
|
||||
* @param index index of sheet to activate
|
||||
*/
|
||||
public XlsDocumentBuilder setActiveSheet(int index) {
|
||||
workBook.setActiveSheet(index);
|
||||
currentSheet = workBook.getSheetAt(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new sheet in document and set it active
|
||||
*
|
||||
* @param sheetName
|
||||
*/
|
||||
public XlsDocumentBuilder insertNewSheet(String sheetName) {
|
||||
currentSheet = workBook.createSheet(sheetName);
|
||||
workBook.setActiveSheet(getSheetCount() - 1);
|
||||
return this;
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder insertNewSheet(String sheetName, int order) {
|
||||
insertNewSheet(sheetName);
|
||||
workBook.setSheetOrder(sheetName, order);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sheet in document
|
||||
*
|
||||
* @return sheets count
|
||||
*/
|
||||
public int getSheetCount() {
|
||||
return workBook.getNumberOfSheets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of rows in sheet
|
||||
*
|
||||
* @return rows count
|
||||
*/
|
||||
public int getRowCount() {
|
||||
return currentSheet.getLastRowNum();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of columns in sheet
|
||||
*
|
||||
* @return columns count
|
||||
*/
|
||||
public int getColumnCount() {
|
||||
Row row = currentSheet.getRow(getRowCount());
|
||||
if (row == null) {
|
||||
return 0;
|
||||
}
|
||||
return row.getLastCellNum() - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns converted to string representation of cell value
|
||||
*
|
||||
* @param rowIndex row index of current sheet
|
||||
* @param colIndex column index of current sheet
|
||||
* @return string value of cell
|
||||
*/
|
||||
public String getCellAsString(int rowIndex, int colIndex) {
|
||||
Cell cell = currentSheet.getRow(rowIndex).getCell(colIndex);
|
||||
cell.setCellType(Cell.CELL_TYPE_STRING);
|
||||
return cell.getStringCellValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets string cell value
|
||||
*
|
||||
* @param rowIndex row index of current sheet
|
||||
* @param colIndex column index of current sheet
|
||||
*/
|
||||
public XlsDocumentBuilder setCellValue(int rowIndex, int colIndex, String value) {
|
||||
if (currentSheet.getRow(rowIndex) == null) {
|
||||
currentSheet.createRow(rowIndex);
|
||||
}
|
||||
if (currentSheet.getRow(rowIndex).getCell(colIndex) == null) {
|
||||
currentSheet.getRow(rowIndex).createCell(colIndex);
|
||||
}
|
||||
Cell cell = currentSheet.getRow(rowIndex).getCell(colIndex);
|
||||
cell.setCellValue(value);
|
||||
setColumnAutosize(colIndex, colIndex);
|
||||
return this;
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder setCellValue(int rowIndex, int colIndex, int value) {
|
||||
return setCellValue(rowIndex, colIndex, String.valueOf(value));
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder setCellValue(int rowIndex, int colIndex, long value) {
|
||||
return setCellValue(rowIndex, colIndex, String.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save current file
|
||||
*/
|
||||
public XlsDocumentBuilder save() throws IOException {
|
||||
OutputStream out = new FileOutputStream(documentFile);
|
||||
workBook.write(out);
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean isExcel(InputStream i) throws IOException {
|
||||
return (POIFSFileSystem.hasPOIFSHeader(i) || POIXMLDocument.hasOOXMLHeader(i));
|
||||
}
|
||||
|
||||
private boolean isXlsx(InputStream i) throws IOException {
|
||||
return POIXMLDocument.hasOOXMLHeader(i);
|
||||
}
|
||||
|
||||
public int getActiveSheetIndex() {
|
||||
return workBook.getActiveSheetIndex();
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder mergeCells(int rowFrom, int rowTo, int colFrom, int colTo) {
|
||||
currentSheet.addMergedRegion(new CellRangeAddress(rowFrom, rowTo, colFrom, colTo));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRegionBorderWithMedium(int rowFrom, int rowTo, int colFrom, int colTo) {
|
||||
for (int row = rowFrom; row < rowTo; row++) {
|
||||
for (int col = colFrom; col <= colTo; col++) {
|
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(row, row, col, col);
|
||||
RegionUtil.setBorderBottom(CellStyle.BORDER_THIN, cellRangeAddress, currentSheet, workBook);
|
||||
RegionUtil.setBorderLeft(CellStyle.BORDER_THIN, cellRangeAddress, currentSheet, workBook);
|
||||
RegionUtil.setBorderRight(CellStyle.BORDER_THIN, cellRangeAddress, currentSheet, workBook);
|
||||
RegionUtil.setBorderTop(CellStyle.BORDER_THIN, cellRangeAddress, currentSheet, workBook);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder setColumnAutosize(int from, int to) {
|
||||
for (int col = from; col <= to; col++) {
|
||||
currentSheet.autoSizeColumn(col, true);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder setRowAutosize(int from, int to) {
|
||||
CellStyle style = workBook.createCellStyle();
|
||||
style.setWrapText(true);
|
||||
for (int row = from; row <= to; row++) {
|
||||
for (int col = 0; col <= currentSheet.getRow(row).getLastCellNum(); col++) {
|
||||
if (currentSheet.getRow(row).getCell(col) != null) {
|
||||
currentSheet.getRow(row).getCell(col).setCellStyle(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public XlsDocumentBuilder deleteSheet(int index) {
|
||||
workBook.removeSheetAt(index);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package ru.ulstu.project.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.project.model.Project;
|
||||
import ru.ulstu.project.model.ProjectDto;
|
||||
import ru.ulstu.project.service.ProjectService;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller()
|
||||
@RequestMapping(value = "/projects")
|
||||
@ApiIgnore
|
||||
public class ProjectController {
|
||||
private final ProjectService projectService;
|
||||
|
||||
public ProjectController(ProjectService projectService) {
|
||||
this.projectService = projectService;
|
||||
}
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
public void getDashboard(ModelMap modelMap) {
|
||||
modelMap.put("projects", projectService.findAllDto());
|
||||
}
|
||||
|
||||
@GetMapping("/projects")
|
||||
public void getProjects(ModelMap modelMap) {
|
||||
modelMap.put("projects", projectService.findAllDto());
|
||||
}
|
||||
|
||||
@GetMapping("/project")
|
||||
public void getProject(ModelMap modelMap, @RequestParam(value = "id") Integer id) {
|
||||
if (id != null && id > 0) {
|
||||
modelMap.put("projectDto", projectService.findOneDto(id));
|
||||
} else {
|
||||
modelMap.put("projectDto", new ProjectDto());
|
||||
}
|
||||
}
|
||||
|
||||
@ModelAttribute("allStatuses")
|
||||
public List<Project.ProjectStatus> getProjectStatuses() {
|
||||
return projectService.getProjectStatuses();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package ru.ulstu.students.controller;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
|
||||
public class Navigation {
|
||||
public static final String REDIRECT_TO = "redirect:%s";
|
||||
public static final String TASKS_PAGE = "/students/tasks";
|
||||
public static final String TASK_PAGE = "/students/task";
|
||||
|
||||
public static String hasErrors(Errors errors, String page) {
|
||||
if (errors.hasErrors()) {
|
||||
return page;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package ru.ulstu.students.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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.tags.model.Tag;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TaskDto {
|
||||
|
||||
private final static int MAX_TAGS_LENGTH = 50;
|
||||
|
||||
private Integer id;
|
||||
@NotEmpty
|
||||
private String title;
|
||||
private String description;
|
||||
private Task.TaskStatus status;
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
private Date createDate;
|
||||
private Date updateDate;
|
||||
private Set<Integer> tagIds;
|
||||
private List<Tag> tags;
|
||||
|
||||
public TaskDto() {
|
||||
deadlines.add(new Deadline());
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public TaskDto(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("title") String title,
|
||||
@JsonProperty("description") String description,
|
||||
@JsonProperty("createDate") Date createDate,
|
||||
@JsonProperty("updateDate") Date updateDate,
|
||||
@JsonProperty("status") Task.TaskStatus status,
|
||||
@JsonProperty("deadlines") List<Deadline> deadlines,
|
||||
@JsonProperty("tagIds") Set<Integer> tagIds,
|
||||
@JsonProperty("tags") List<Tag> tags) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.status = status;
|
||||
this.deadlines = deadlines;
|
||||
this.createDate = createDate;
|
||||
this.updateDate = updateDate;
|
||||
this.description = description;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public TaskDto(Task task) {
|
||||
this.id = task.getId();
|
||||
this.title = task.getTitle();
|
||||
this.status = task.getStatus();
|
||||
this.deadlines = task.getDeadlines();
|
||||
this.createDate = task.getCreateDate();
|
||||
this.updateDate = task.getUpdateDate();
|
||||
this.description = task.getDescription();
|
||||
this.tags = task.getTags();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Task.TaskStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Task.TaskStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<Deadline> getDeadlines() {
|
||||
return deadlines;
|
||||
}
|
||||
|
||||
public void setDeadlines(List<Deadline> deadlines) {
|
||||
this.deadlines = deadlines;
|
||||
}
|
||||
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public Set<Integer> getTagIds() {
|
||||
return tagIds;
|
||||
}
|
||||
|
||||
public void setTagIds(Set<Integer> tagIds) {
|
||||
this.tagIds = tagIds;
|
||||
}
|
||||
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public String getTagsString() {
|
||||
return StringUtils.abbreviate(tags
|
||||
.stream()
|
||||
.map(tag -> tag.getTagName())
|
||||
.collect(Collectors.joining(", ")), MAX_TAGS_LENGTH);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.students.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.students.model.Task;
|
||||
|
||||
public interface TaskRepository extends JpaRepository<Task, Integer> {
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package ru.ulstu.students.service;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.repository.TaskRepository;
|
||||
import ru.ulstu.tags.service.TagService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.isEmpty;
|
||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||
import static ru.ulstu.students.model.Task.TaskStatus.IN_WORK;
|
||||
|
||||
@Service
|
||||
public class TaskService {
|
||||
|
||||
private final static int MAX_DISPLAY_SIZE = 40;
|
||||
|
||||
private final TaskRepository taskRepository;
|
||||
private final DeadlineService deadlineService;
|
||||
private final TagService tagService;
|
||||
|
||||
public TaskService(TaskRepository grantRepository,
|
||||
DeadlineService deadlineService, TagService tagService) {
|
||||
this.taskRepository = grantRepository;
|
||||
this.deadlineService = deadlineService;
|
||||
this.tagService = tagService;
|
||||
}
|
||||
|
||||
public List<Task> findAll() {
|
||||
return taskRepository.findAll();
|
||||
}
|
||||
|
||||
public List<TaskDto> findAllDto() {
|
||||
List<TaskDto> tasks = convert(findAll(), TaskDto::new);
|
||||
tasks.forEach(taskDto -> taskDto.setTitle(StringUtils.abbreviate(taskDto.getTitle(), MAX_DISPLAY_SIZE)));
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public TaskDto findOneDto(Integer id) {
|
||||
return new TaskDto(taskRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer create(TaskDto taskDto) throws IOException {
|
||||
Task newTask = copyFromDto(new Task(), taskDto);
|
||||
newTask = taskRepository.save(newTask);
|
||||
return newTask.getId();
|
||||
}
|
||||
|
||||
private Task copyFromDto(Task task, TaskDto taskDto) throws IOException {
|
||||
task.setTitle(taskDto.getTitle());
|
||||
task.setDescription(taskDto.getDescription());
|
||||
task.setStatus(taskDto.getStatus() == null ? IN_WORK : taskDto.getStatus());
|
||||
task.setDeadlines(deadlineService.saveOrCreate(taskDto.getDeadlines()));
|
||||
task.setCreateDate(task.getCreateDate() == null ? new Date() : task.getCreateDate());
|
||||
task.setUpdateDate(new Date());
|
||||
task.getTags().clear();
|
||||
task.setTags(tagService.saveOrCreate(taskDto.getTags()));
|
||||
return task;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer update(TaskDto taskDto) throws IOException {
|
||||
Task task = taskRepository.findOne(taskDto.getId());
|
||||
taskRepository.save(copyFromDto(task, taskDto));
|
||||
return task.getId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void delete(Integer taskId) throws IOException {
|
||||
Task task = taskRepository.findOne(taskId);
|
||||
taskRepository.delete(task);
|
||||
}
|
||||
|
||||
public void save(TaskDto taskDto) throws IOException {
|
||||
if (isEmpty(taskDto.getId())) {
|
||||
create(taskDto);
|
||||
} else {
|
||||
update(taskDto);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Task.TaskStatus> getTaskStatuses() {
|
||||
return Arrays.asList(Task.TaskStatus.values());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package ru.ulstu.tags.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tag")
|
||||
public class Tag extends BaseEntity {
|
||||
|
||||
@NotEmpty
|
||||
@Size(max = 50)
|
||||
@Column(name = "tag_name")
|
||||
private String tagName;
|
||||
|
||||
public Tag() {
|
||||
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public Tag(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("tag_name") String tagName) {
|
||||
this.setId(id);
|
||||
this.tagName = tagName;
|
||||
}
|
||||
|
||||
public Tag(String name) {
|
||||
this.tagName = name;
|
||||
}
|
||||
|
||||
public String getTagName() {
|
||||
return tagName;
|
||||
}
|
||||
|
||||
public void setTagName(String tagName) {
|
||||
this.tagName = tagName;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package ru.ulstu.tags.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.tags.model.Tag;
|
||||
|
||||
public interface TagRepository extends JpaRepository<Tag, Integer> {
|
||||
|
||||
@Query("SELECT t FROM Tag t WHERE (t.tagName = :tagName)")
|
||||
Tag findByName(@Param("tagName") String tagName);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package ru.ulstu.tags.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.tags.model.Tag;
|
||||
import ru.ulstu.tags.repository.TagRepository;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class TagService {
|
||||
|
||||
private final TagRepository tagRepository;
|
||||
|
||||
|
||||
public TagService(TagRepository tagRepository) {
|
||||
|
||||
this.tagRepository = tagRepository;
|
||||
}
|
||||
|
||||
public List<Tag> saveOrCreate(List<Tag> tags) {
|
||||
return tags
|
||||
.stream()
|
||||
.map(tag -> {
|
||||
if (tag.getId() != null) {
|
||||
return getExistById(tag);
|
||||
} else {
|
||||
Tag existTag = isExistByName(tag.getTagName());
|
||||
return existTag != null ? existTag : create(tag);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tag getExistById(Tag tag) {
|
||||
return tagRepository.findOne(tag.getId());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tag isExistByName(String tagName) {
|
||||
return tagRepository.findByName(tagName);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tag create(Tag tag) {
|
||||
Tag newTag = new Tag();
|
||||
newTag.setTagName(tag.getTagName());
|
||||
newTag = tagRepository.save(newTag);
|
||||
return newTag;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?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="masha" id="20190319_000001-1">
|
||||
<addColumn tableName="paper">
|
||||
<column name="url" type="varchar(255)"></column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,13 @@
|
||||
<?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="masha" id="20190327_000000-1">
|
||||
<addColumn tableName="event">
|
||||
<column name="paper_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="event" baseColumnNames="paper_id"
|
||||
constraintName="fk_event_paper_id" referencedTableName="paper"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,55 @@
|
||||
<?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="nastya" id="20190331_000000-1">
|
||||
<createTable tableName="tag">
|
||||
<column name="id" type="integer">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="tagname" type="varchar(255)"/>
|
||||
</createTable>
|
||||
<addPrimaryKey columnNames="id" constraintName="pk_tag" tableName="tag"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="nastya" id="20190331_000000-2">
|
||||
<createTable tableName="task">
|
||||
<column name="id" type="integer">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="user_id" type="integer"/>
|
||||
<column name="title" type="varchar(255)"/>
|
||||
<column name="description" type="varchar(255)"/>
|
||||
<column name="status" type="varchar(255)"/>
|
||||
<column name="deadline_date" type="timestamp"/>
|
||||
<column name="create_date" type="timestamp"/>
|
||||
<column name="update_date" type="timestamp"/>
|
||||
</createTable>
|
||||
<addPrimaryKey columnNames="id" constraintName="pk_task" tableName="task"/>
|
||||
<addForeignKeyConstraint baseTableName="task" baseColumnNames="user_id"
|
||||
constraintName="fk_user_task_id" referencedTableName="users"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="nastya" id="20190331_000000-3">
|
||||
<createTable tableName="task_tags">
|
||||
<column name="task_id" type="integer"/>
|
||||
<column name="tag_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="task_tags" baseColumnNames="task_id"
|
||||
constraintName="fk_task_id" referencedTableName="task"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="task_tags" baseColumnNames="tag_id"
|
||||
constraintName="fk_tag_id" referencedTableName="tag"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="nastya" id="20190331_000000-4">
|
||||
<addColumn tableName="deadline">
|
||||
<column name="task_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="deadline" baseColumnNames="task_id"
|
||||
constraintName="fk_deadlines_task" referencedTableName="task"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,63 @@
|
||||
<?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="20190331_000010-1">
|
||||
<createTable tableName="conference">
|
||||
<column name="id" type="integer">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="title" type="varchar(300)"/>
|
||||
<column name="description" type="varchar(500)"/>
|
||||
<column name="url" type="varchar(255)"/>
|
||||
<column name="ping" type="integer"/>
|
||||
<column name="begin_date" type="timestamp"/>
|
||||
<column name="end_date" type="timestamp"/>
|
||||
</createTable>
|
||||
<addPrimaryKey columnNames="id" constraintName="pk_conference" tableName="conference"/>
|
||||
</changeSet>
|
||||
|
||||
|
||||
<changeSet author="vova" id="20190331_000010-2">
|
||||
<createTable tableName="paper_conference">
|
||||
<column name="conference_id" type="integer"/>
|
||||
<column name="paper_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="paper_conference" baseColumnNames="conference_id"
|
||||
constraintName=" fk_paper_conference_conference" referencedTableName="conference"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="paper_conference" baseColumnNames="paper_id"
|
||||
constraintName="fk_paper_conference_paper" referencedTableName="paper"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="vova" id="20190331_000010-3">
|
||||
<createTable tableName="users_conference">
|
||||
<column name="conference_id" type="integer"/>
|
||||
<column name="users_id" type="integer"/>
|
||||
<column name="participation" type="boolean"/>
|
||||
<column name="deposit" type="varchar(255)"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="users_conference" baseColumnNames="conference_id"
|
||||
constraintName=" fk_users_conference_conference" referencedTableName="conference"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="users_conference" baseColumnNames="users_id"
|
||||
constraintName="fk_users_conference_users" referencedTableName="users"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="vova" id="20190331_000010-4">
|
||||
<addColumn tableName="deadline">
|
||||
<column name="conference_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="deadline" baseColumnNames="conference_id"
|
||||
constraintName=" fk_deadlines_conference" referencedTableName="conference"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="orion" id="20190331_000010-5">
|
||||
<addColumn tableName="conference">
|
||||
<column name="version" type="integer"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -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="nastya" id="20190410_000000-1">
|
||||
<addColumn tableName="tag">
|
||||
<column name="version" type="integer"/>
|
||||
</addColumn>
|
||||
<renameColumn tableName="tag" oldColumnName="tagname" newColumnName="tag_name"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="nastya" id="20190410_000000-2">
|
||||
<addColumn tableName="task">
|
||||
<column name="version" type="integer"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,22 @@
|
||||
<?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="status" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
<addColumn tableName="project">
|
||||
<column name="description" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
<addColumn tableName="project">
|
||||
<column name="grant_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="project" baseColumnNames="grant_id"
|
||||
constraintName="fk_project_grant_id" referencedTableName="grants"
|
||||
referencedColumnNames="id"/>
|
||||
<addColumn tableName="project">
|
||||
<column name="repository" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,226 @@
|
||||
.odin-unselectable {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.odin-kill-padding {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.odin-input-group {
|
||||
padding-left: 15px !important;
|
||||
padding-right: 15px !important;
|
||||
}
|
||||
|
||||
.odin-closable .fa {
|
||||
font-size: 1.5em;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.odin-closable .fa:hover:before {
|
||||
content: "\f057";
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Toolbar
|
||||
*/
|
||||
.odin-toolbar {
|
||||
padding-left: 1px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.odin-toolbar .odin-btn {
|
||||
float: none !important;
|
||||
}
|
||||
|
||||
.odin-btn {
|
||||
min-width: 112px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.odin-btn {
|
||||
min-width: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Paginator
|
||||
*/
|
||||
.odin-paginator {
|
||||
margin: 0;
|
||||
margin-top: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.odin-paginator-content {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.odin-paginator-content a {
|
||||
cursor: pointer;
|
||||
color: black;
|
||||
float: left;
|
||||
padding: 6px 16px;
|
||||
text-decoration: none;
|
||||
transition: background-color .3s;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.odin-paginator-content i {
|
||||
color: black;
|
||||
float: left;
|
||||
padding: 6px 16px;
|
||||
}
|
||||
|
||||
.odin-paginator-content a.active {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.odin-paginator-content a:hover:not(.active) {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Formatters
|
||||
*/
|
||||
.odin-negative {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Table
|
||||
*/
|
||||
.odin-table {
|
||||
min-height: 324px;
|
||||
border: 1px solid #ddd;
|
||||
padding: 0;
|
||||
margin: 0 0 0 1px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.odin-table > table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.odin-table > table > tbody > tr {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.odin-table-pointed-line {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.odin-table-selected-line {
|
||||
background-color: #5bc0de !important;
|
||||
}
|
||||
|
||||
.odin-table-selected-line:hover {
|
||||
background-color: #6bd0ee !important;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Form
|
||||
*/
|
||||
.odin-form {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 1500;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.odin-form .panel {
|
||||
position: relative;
|
||||
max-height: 95%;
|
||||
max-width: 95%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.odin-form .panel {
|
||||
max-width: 55%;
|
||||
}
|
||||
}
|
||||
|
||||
.odin-form .panel-footer {
|
||||
padding: 5px 7px;
|
||||
}
|
||||
|
||||
.odin-form .odin-btn {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.odin-checkbox {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.odin-form .tab-pane {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Confirm Box
|
||||
*/
|
||||
.odin-confirm-box {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 2000;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.odin-confirm-box .panel {
|
||||
position: relative;
|
||||
max-width: 95%;
|
||||
}
|
||||
|
||||
.odin-confirm-box .panel-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.odin-confirm-box .panel {
|
||||
max-width: 25%;
|
||||
}
|
||||
}
|
||||
|
||||
.odin-confirm-box .panel-body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Table Box
|
||||
*/
|
||||
.odin-table-box {
|
||||
z-index: 2500;
|
||||
}
|
||||
|
||||
/*
|
||||
Odin Simple Box
|
||||
*/
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.odin-simple-form .panel {
|
||||
max-width: 35%;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
.tags-container {
|
||||
width: 100%;
|
||||
padding: .375rem .75rem;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
display: inline-block;
|
||||
color: #555;
|
||||
vertical-align: middle;
|
||||
border-radius: 4px;
|
||||
max-width: 100%;
|
||||
line-height: 22px;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.input-tag-name {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
max-width: inherit;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: .2em .6em .3em;
|
||||
background-color: orange;
|
||||
border-radius: .25em;
|
||||
margin-right: 4px;
|
||||
margin-bottom: 4px;
|
||||
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tag-name span[data-role="remove"] {
|
||||
margin-left: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tag-name span[data-role="remove"]:after {
|
||||
content: "x";
|
||||
padding: 0px 2px;
|
||||
}
|
||||
|
||||
.tag-name input[type="text"] {
|
||||
background: transparent;
|
||||
border: none;
|
||||
display: inline-flex;
|
||||
font-size: 100%;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
outline: none;
|
||||
cursor: default;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".conference-row").mouseenter(function (event) {
|
||||
var conferenceRow = $(event.target).closest(".conference-row");
|
||||
$(conferenceRow).css("background-color", "#f8f9fa");
|
||||
$(conferenceRow).find(".remove-conference").removeClass("d-none");
|
||||
|
||||
});
|
||||
$(".conference-row").mouseleave(function (event) {
|
||||
var conferenceRow = $(event.target).closest(".conference-row");
|
||||
$(conferenceRow).css("background-color", "white");
|
||||
$(conferenceRow).closest(".conference-row").find(".remove-conference").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;
|
||||
});
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
/* exported contextPath */
|
||||
var contextPath = "";
|
||||
var apiVersion = "/api/1.0";
|
||||
|
||||
var basePath = contextPath + apiVersion;
|
||||
|
||||
/* exported uiLocale */
|
||||
var uiLocale = "ru";
|
||||
|
||||
/* exported urlVersions */
|
||||
var urlVersions = basePath + "/versions";
|
||||
/* exported urlCommits */
|
||||
var urlCommits = basePath + "/commits";
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,113 @@
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#tags .tag .tag-name input[type=text]").each(function() {
|
||||
$(this).attr("size", $(this).val().length)
|
||||
});
|
||||
|
||||
|
||||
$("#task-form").keydown(function(event){
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
function removeTag () {
|
||||
$(this).parent().parent().remove();
|
||||
}
|
||||
|
||||
|
||||
$("#input-tag").keyup(function (event) {
|
||||
if(event.keyCode == 13 || event.keyCode == 188) {
|
||||
var tagNumber = $("#tags .tag").length;
|
||||
var tagName = $.trim($(this).val());
|
||||
var addTag = true;
|
||||
// проверка, добавлен ли этот тег
|
||||
$("#tags .tag .tag-name input[type=text]").each(function() {
|
||||
if(tagName === $(this).val()) {
|
||||
addTag = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
// если тег не добавлен
|
||||
if(addTag) {
|
||||
// контейнер тега
|
||||
var newTagRow = $("<div/>")
|
||||
.attr("id", 'tags' + tagNumber)
|
||||
.addClass("tag");
|
||||
// контейнер id
|
||||
var idInput = $("<input/>")
|
||||
.attr("type", "hidden")
|
||||
.attr("id", "tags" + tagNumber + ".id")
|
||||
.attr("name", "tags[" + tagNumber + "].id")
|
||||
.attr("value", '');
|
||||
// контейнер текста
|
||||
var conDiv = $("<div/>")
|
||||
.addClass("tag-name");
|
||||
// текст тега
|
||||
var nameInput = $("<input/>")
|
||||
.attr("type", "text")
|
||||
.attr("id", "tags" + tagNumber + ".tagName")
|
||||
.attr("name", "tags[" + tagNumber + "].tagName")
|
||||
.attr("value", tagName)
|
||||
.attr("readonly", "true")
|
||||
.attr("size", tagName.length);
|
||||
// кнопка удалить тег
|
||||
var removeSpan = $("<span/>")
|
||||
.attr("data-role", "remove")
|
||||
.bind("click", removeTag);
|
||||
|
||||
conDiv.append(nameInput);
|
||||
conDiv.append(removeSpan);
|
||||
newTagRow.append(idInput);
|
||||
newTagRow.append(conDiv);
|
||||
$(this).before(newTagRow);
|
||||
}
|
||||
|
||||
$(this).val('');
|
||||
}
|
||||
});
|
||||
|
||||
$("span[data-role=remove]").click(removeTag);
|
||||
$(".task-row").mouseenter(function (event) {
|
||||
var taskRow = $(event.target).closest(".task-row");
|
||||
$(taskRow).css("background-color", "#f8f9fa");
|
||||
$(taskRow).find(".remove-task").removeClass("d-none");
|
||||
|
||||
});
|
||||
$(".task-row").mouseleave(function (event) {
|
||||
var taskRow = $(event.target).closest(".task-row");
|
||||
$(taskRow).css("background-color", "white");
|
||||
$(taskRow).closest(".task-row").find(".remove-task").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;
|
||||
});
|
||||
|
||||
});
|
||||
/*]]>*/
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="../css/conference.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div layout:fragment="content">
|
||||
<section id="conference">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="section-heading text-uppercase text-center">Актуальные конференции</h3>
|
||||
<div th:replace="conferences/fragments/confNavigationFragment"/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<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 class="row">
|
||||
<div class="col-2">
|
||||
|
||||
</div>
|
||||
<div class="col col-10 text-right">
|
||||
<h7 class="service-heading"> title</h7>
|
||||
<p class="text-muted"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="confLine (conference)" class="row text-left conference-row h3" style="background-color: white;">
|
||||
<div class="col">
|
||||
<a th:href="@{'conference?id='+${conference.id}}">
|
||||
<span class="h5" th:text="${conference.title}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${conference.id}"/>
|
||||
<a class="remove-paper pull-right" th:href="@{'/conferences/delete/'+${conference.id}}"
|
||||
data-confirm="Удалить статью?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row justify-content-center control-panel">
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./conferences" class="btn btn-light toolbar-button">
|
||||
<i class="fa fa-list-alt"></i>
|
||||
Весь список</a>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./actual" class="btn btn-light toolbar-button">
|
||||
<i class="fa fa-newspaper-o" aria-hidden="true"></i>
|
||||
Актуальное</a>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="noRecords(entities, noRecordsMessage, url)" class="col-12 text-center"
|
||||
style="background-color: white;">
|
||||
<div th:if="*{#lists.isEmpty(entities)}">
|
||||
<div th:text="'Еще не создано ни'+${noRecordsMessage}"/>
|
||||
<a th:href="@{${url}+'?id=0'}">
|
||||
Перейдите по ссылке, чтобы добавить
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<section id="services">
|
||||
<div class="container">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Проекты</h2>
|
||||
<div th:replace="projects/fragments/projectNavigationFragment"/>
|
||||
</div>
|
||||
<div class="row justify-content-center" id="dashboard">
|
||||
<th:block>
|
||||
<div/>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -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="projectLine (project)" class="row text-left project-row" style="background-color: white;">
|
||||
<div class="col">
|
||||
<span th:replace="projects/fragments/projectStatusFragment :: projectStatus(projectStatus=${project.status})"/>
|
||||
<a th:href="@{'project?id='+${project.id}}">
|
||||
<span class="h6" th:text="${project.title}"/>
|
||||
<span class="text-muted" th:text="${project.description}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${project.id}"/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./projects" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||
Список</a>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||
aria-hidden="true"></i> Панель
|
||||
управления</a>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./project?id=0" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle"
|
||||
aria-hidden="true"></i>
|
||||
Добавить проект</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<span th:fragment="paperStatus (paperStatus)" 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>
|
||||
</div>
|
||||
<div th:case="'ON_COMPETITION'">
|
||||
<i class="fa fa-circle fa-stack-2x text-review"></i>
|
||||
</div>
|
||||
<div th:case="'SUCCESSFUL_PASSAGE'">
|
||||
<i class="fa fa-circle fa-stack-2x text-accepted"></i>
|
||||
</div>
|
||||
<div th:case="'IN_WORK'">
|
||||
<i class="fa fa-circle fa-stack-2x text-primary"></i>
|
||||
</div>
|
||||
<div th:case="'COMPLETED'">
|
||||
<i class="fa fa-circle fa-stack-2x text-success"></i>
|
||||
</div>
|
||||
<div th:case="'FAILED'">
|
||||
<i class="fa fa-circle fa-stack-2x text-failed"></i>
|
||||
</div>
|
||||
</th:block>
|
||||
<i class="fa fa-file-text-o fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container" layout:fragment="content">
|
||||
|
||||
<section id="paper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Редактирование проекта</h2>
|
||||
<div th:replace="projects/fragments/projectNavigationFragment"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="project-form" method="post" th:action="@{'/projects/project?id='+ *{id == null ? '' : id} + ''}"
|
||||
th:object="${projectDto}">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<input type="hidden" name="id" th:field="*{id}"/>
|
||||
<div class="form-group">
|
||||
<label for="title">Название:</label>
|
||||
<input class="form-control" id="title" type="text"
|
||||
placeholder="Название проекта"
|
||||
th:field="*{title}"/>
|
||||
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
|
||||
class="alert alert-danger">Incorrect title</p>
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status">Статус:</label>
|
||||
<select class="form-control" th:field="*{status}" id="status">
|
||||
<option th:each="status : ${allStatuses}" th:value="${status}"
|
||||
th:text="${status.statusName}">Status
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Описание:</label>
|
||||
<textarea class="form-control" rows="3" id="description"
|
||||
th:field="*{description}"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="createGrant">Добавить грант:</label>
|
||||
<div th:if="*{grant} == null">
|
||||
<input type="submit" id="createGrant" name="createGrant" class="btn btn-primary"
|
||||
value="Добавить грант"/>
|
||||
</div>
|
||||
<input type = "hidden" th:field="*{grant.id}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="repository">Ссылка на репозиторий:</label>
|
||||
<input class="form-control" id="repository" type="text"
|
||||
placeholder="http://"
|
||||
th:field="*{repository}"/>
|
||||
<p th:if="${#fields.hasErrors('repository')}" th:errors="*{repository}"
|
||||
class="alert alert-danger">Incorrect repository link</p>
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="col-4">
|
||||
<input class="form-control" type="text" placeholder="Описание"/>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<a class="btn btn-danger float-right"><span
|
||||
aria-hidden="true"><i class="fa fa-times"/></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
|
||||
class="alert alert-danger">Incorrect title</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" id="addDeadline" name="addDeadline" class="btn btn-primary" value="Добавить
|
||||
дедлайн"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="loader">Загрузить файл:</label>
|
||||
<div id="loader">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<button id="sendMessageButton" name="save" class="btn btn-success text-uppercase"
|
||||
type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
<button id="cancelButton" class="btn btn-default text-uppercase" href="/projects/projects">
|
||||
Отмена
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript" src="/js/file-loader.js"></script>
|
||||
<script>
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(function () {
|
||||
new FileLoader({
|
||||
div: "loader",
|
||||
url: urlFileUpload,
|
||||
maxSize: 2,
|
||||
extensions: ["doc", "docx", "xls", "jpg", "png", "pdf", "txt"],
|
||||
callback: function (response) {
|
||||
showFeedbackMessage("Файл успешно загружен");
|
||||
console.debug(response);
|
||||
}
|
||||
});
|
||||
$('.selectpicker').selectpicker();
|
||||
});
|
||||
/*]]>*/
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<form id="projects-form" method="post" th:action="@{'/projects/projects'}">
|
||||
<input th:type="hidden" name="projectDeleteId" id="projectDeleteId"/>
|
||||
<section id="projects">
|
||||
<div class="container">
|
||||
<div class="row" id="project-list">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Проекты</h2>
|
||||
<div th:replace="projects/fragments/projectNavigationFragment"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-sm-12">
|
||||
<th:block th:each="project : ${projects}">
|
||||
<div th:replace="projects/fragments/projectLineFragment :: projectLine(project=${project})"/>
|
||||
</th:block>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="taskDashboard (task)" 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="students/fragments/taskStatusFragment :: taskStatus(taskStatus=${task.status})"/>
|
||||
<!--<span th:replace="students/fragments/taskStatusFragment"/>-->
|
||||
</div>
|
||||
<div class="col col-10 text-right">
|
||||
<h7 class="service-heading" th:text="${task.title}"> title</h7>
|
||||
<p class="text-muted" th:text="${task.status.statusName}"> status</p>
|
||||
<!--<h7 class="service-heading" th:text="Title"> title</h7>-->
|
||||
<!--<p class="text-muted" th:text="Type">type</p>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="taskLine (task)" class="row text-left task-row" style="background-color: white;">
|
||||
<div class="col">
|
||||
<span th:replace="students/fragments/taskStatusFragment :: taskStatus(taskStatus=${task.status})"/>
|
||||
<a th:href="@{'task?id='+${task.id}}">
|
||||
<span class="h6" th:text="${task.title}"></span>
|
||||
<span class="text-muted" th:text="${task.tagsString}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden" th:value="${task.id}"/>
|
||||
<a class="remove-task pull-right d-none" th:href="@{'/students/delete/'+${task.id}}"
|
||||
data-confirm="Удалить задачу?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
</head>
|
||||
<body>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./tasks" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
|
||||
Список</a>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
|
||||
aria-hidden="true"></i> Панель
|
||||
управления</a>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
|
||||
<a href="./task?id=0" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle"
|
||||
aria-hidden="true"></i>
|
||||
Добавить задачу</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<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>
|
||||
<div th:case="'LOADED_FROM_KIAS'">
|
||||
<i class="fa fa-circle fa-stack-2x text-review"></i>
|
||||
</div>
|
||||
<div th:case="'COMPLETED'">
|
||||
<i class="fa fa-circle fa-stack-2x text-success"></i>
|
||||
</div>
|
||||
<div th:case="'FAILED'">
|
||||
<i class="fa fa-circle fa-stack-2x text-failed"></i>
|
||||
</div>
|
||||
</th:block>
|
||||
<i class="fa fa-check fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,146 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css"/>
|
||||
<link rel="stylesheet" href="../css/tasks.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container" layout:fragment="content">
|
||||
|
||||
<section id="paper">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.min.js"></script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Редактирование задачи</h2>
|
||||
<div th:replace="students/fragments/taskNavigationFragment"/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="task-form" method="post" th:action="@{'/students/task?id='+ *{id == null ? '' : id} + ''}"
|
||||
th:object="${taskDto}">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-sm-12">
|
||||
<input type="hidden" name="id" th:field="*{id}"/>
|
||||
<div class="form-group">
|
||||
<label for="title">Название:</label>
|
||||
<input class="form-control" id="title" type="text" placeholder="Название задачи"
|
||||
th:field="*{title}"/>
|
||||
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
|
||||
class="alert alert-danger">Incorrect title</p>
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status">Статус:</label>
|
||||
<select class="form-control" id="status" th:field="*{status}">
|
||||
<option th:each="status : ${allStatuses}" th:value="${status}"
|
||||
th:text="${status.statusName}">Status
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment">Описание задачи:</label>
|
||||
<textarea class="form-control" rows="3" id="comment"
|
||||
th:field="*{description}"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="tags">Теги:</label>
|
||||
<div class="tags-container" id="tags">
|
||||
<div class="tag" th:each="tag, rowStat : *{tags}">
|
||||
<input type="hidden" th:field="*{tags[__${rowStat.index}__].id}"/>
|
||||
<div class="tag-name">
|
||||
<input type="text" readonly="true"
|
||||
th:field="*{tags[__${rowStat.index}__].tagName}"/>
|
||||
<span data-role="remove"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input class="input-tag-name" type="text" placeholder="Теги задачи"
|
||||
id="input-tag"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Дедлайны задачи:</label>
|
||||
<div class="row" th:each="deadline, rowStat : *{deadlines}">
|
||||
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
|
||||
<div class="col-6">
|
||||
<input type="date" class="form-control" name="deadline"
|
||||
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<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"
|
||||
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>
|
||||
</div>
|
||||
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
|
||||
class="alert alert-danger">Incorrect title</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" id="addDeadline" name="addDeadline" class="btn btn-primary"
|
||||
value="Добавить
|
||||
дедлайн"/>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="form-group">
|
||||
<button id="sendMessageButton" name="save" class="btn btn-success text-uppercase"
|
||||
type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
<a id="cancelButton" class="btn btn-default text-uppercase" href="/students/tasks">
|
||||
Отмена
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 offset-md-1 col-sm-12 offset-sm-0">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="my-0">Дата создания:</h6>
|
||||
</div>
|
||||
<div class="col">
|
||||
<small class="text-muted"
|
||||
th:text="${taskDto.createDate == null ? '' : #dates.format(taskDto.createDate, 'dd.MM.yyyy HH:mm')}">
|
||||
text
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="my-0">Дата изменения:</h6>
|
||||
</div>
|
||||
<div class="col">
|
||||
<small class="text-muted"
|
||||
th:text="${taskDto.updateDate == null ? '' : #dates.format(taskDto.updateDate, 'dd.MM.yyyy HH:mm')}">
|
||||
text
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/tasks.js"></script>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue