#127 references tab, crud
This commit is contained in:
parent
29cfadef02
commit
7c1b124c94
@ -16,6 +16,7 @@ import ru.ulstu.deadline.model.Deadline;
|
|||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
import ru.ulstu.paper.model.PaperListDto;
|
import ru.ulstu.paper.model.PaperListDto;
|
||||||
|
import ru.ulstu.paper.model.ReferenceDto;
|
||||||
import ru.ulstu.paper.service.LatexService;
|
import ru.ulstu.paper.service.LatexService;
|
||||||
import ru.ulstu.paper.service.PaperService;
|
import ru.ulstu.paper.service.PaperService;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
@ -105,6 +106,15 @@ public class PaperController {
|
|||||||
return "/papers/paper";
|
return "/papers/paper";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/paper", params = "addReference")
|
||||||
|
public String addReference(@Valid PaperDto paperDto, Errors errors) {
|
||||||
|
if (errors.hasErrors()) {
|
||||||
|
return "/papers/paper";
|
||||||
|
}
|
||||||
|
paperDto.getReferences().add(new ReferenceDto());
|
||||||
|
return "/papers/paper";
|
||||||
|
}
|
||||||
|
|
||||||
@ModelAttribute("allStatuses")
|
@ModelAttribute("allStatuses")
|
||||||
public List<Paper.PaperStatus> getPaperStatuses() {
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||||
return paperService.getPaperStatuses();
|
return paperService.getPaperStatuses();
|
||||||
@ -129,6 +139,16 @@ public class PaperController {
|
|||||||
return years;
|
return years;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ModelAttribute("allFormatStandards")
|
||||||
|
public List<ReferenceDto.FormatStandard> getFormatStandards() {
|
||||||
|
return paperService.getFormatStandards();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute("allReferenceTypes")
|
||||||
|
public List<ReferenceDto.ReferenceType> getReferenceTypes() {
|
||||||
|
return paperService.getReferenceTypes();
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/generatePdf")
|
@PostMapping("/generatePdf")
|
||||||
public ResponseEntity<byte[]> getPdfFile(PaperDto paper) throws IOException, InterruptedException {
|
public ResponseEntity<byte[]> getPdfFile(PaperDto paper) throws IOException, InterruptedException {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
@ -123,6 +123,11 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
@ManyToMany(mappedBy = "papers")
|
@ManyToMany(mappedBy = "papers")
|
||||||
private List<Grant> grants;
|
private List<Grant> grants;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(name = "paper_id", unique = true)
|
||||||
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
|
private List<Reference> references = new ArrayList<>();
|
||||||
|
|
||||||
public PaperStatus getStatus() {
|
public PaperStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -248,6 +253,14 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
return getAuthors();
|
return getAuthors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Reference> getReferences() {
|
||||||
|
return references;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferences(List<Reference> references) {
|
||||||
|
this.references = references;
|
||||||
|
}
|
||||||
|
|
||||||
public Optional<Deadline> getNextDeadline() {
|
public Optional<Deadline> getNextDeadline() {
|
||||||
return deadlines
|
return deadlines
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -38,6 +38,8 @@ public class PaperDto {
|
|||||||
private Set<UserDto> authors;
|
private Set<UserDto> authors;
|
||||||
private Integer filterAuthorId;
|
private Integer filterAuthorId;
|
||||||
private String latexText;
|
private String latexText;
|
||||||
|
private List<ReferenceDto> references = new ArrayList<>();
|
||||||
|
private ReferenceDto.FormatStandard formatStandard = ReferenceDto.FormatStandard.GOST;
|
||||||
|
|
||||||
public PaperDto() {
|
public PaperDto() {
|
||||||
deadlines.add(new Deadline());
|
deadlines.add(new Deadline());
|
||||||
@ -57,7 +59,9 @@ public class PaperDto {
|
|||||||
@JsonProperty("locked") Boolean locked,
|
@JsonProperty("locked") Boolean locked,
|
||||||
@JsonProperty("files") List<FileDataDto> files,
|
@JsonProperty("files") List<FileDataDto> files,
|
||||||
@JsonProperty("authorIds") Set<Integer> authorIds,
|
@JsonProperty("authorIds") Set<Integer> authorIds,
|
||||||
@JsonProperty("authors") Set<UserDto> authors) {
|
@JsonProperty("authors") Set<UserDto> authors,
|
||||||
|
@JsonProperty("references") List<ReferenceDto> references,
|
||||||
|
@JsonProperty("formatStandard") ReferenceDto.FormatStandard formatStandard) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@ -71,6 +75,8 @@ public class PaperDto {
|
|||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.authors = authors;
|
this.authors = authors;
|
||||||
|
this.references = references;
|
||||||
|
this.formatStandard = formatStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaperDto(Paper paper) {
|
public PaperDto(Paper paper) {
|
||||||
@ -88,6 +94,7 @@ public class PaperDto {
|
|||||||
this.files = convert(paper.getFiles(), FileDataDto::new);
|
this.files = convert(paper.getFiles(), FileDataDto::new);
|
||||||
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
||||||
this.authors = convert(paper.getAuthors(), UserDto::new);
|
this.authors = convert(paper.getAuthors(), UserDto::new);
|
||||||
|
this.references = convert(paper.getReferences(), ReferenceDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@ -216,4 +223,20 @@ public class PaperDto {
|
|||||||
public void setFilterAuthorId(Integer filterAuthorId) {
|
public void setFilterAuthorId(Integer filterAuthorId) {
|
||||||
this.filterAuthorId = filterAuthorId;
|
this.filterAuthorId = filterAuthorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ReferenceDto> getReferences() {
|
||||||
|
return references;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferences(List<ReferenceDto> references) {
|
||||||
|
this.references = references;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceDto.FormatStandard getFormatStandard() {
|
||||||
|
return formatStandard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormatStandard(ReferenceDto.FormatStandard formatStandard) {
|
||||||
|
this.formatStandard = formatStandard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ru.ulstu.paper.model;
|
package ru.ulstu.paper.model;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@ -11,7 +10,6 @@ import javax.persistence.Enumerated;
|
|||||||
@Entity
|
@Entity
|
||||||
public class Reference extends BaseEntity {
|
public class Reference extends BaseEntity {
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
private String authors;
|
private String authors;
|
||||||
|
|
||||||
@Column(name = "publication_title")
|
@Column(name = "publication_title")
|
||||||
|
@ -34,6 +34,7 @@ public class ReferenceDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
private String authors;
|
private String authors;
|
||||||
private String publicationTitle;
|
private String publicationTitle;
|
||||||
private Integer publicationYear;
|
private Integer publicationYear;
|
||||||
@ -42,9 +43,11 @@ public class ReferenceDto {
|
|||||||
private String journalOrCollectionTitle;
|
private String journalOrCollectionTitle;
|
||||||
private ReferenceType referenceType;
|
private ReferenceType referenceType;
|
||||||
private FormatStandard formatStandard;
|
private FormatStandard formatStandard;
|
||||||
|
private boolean deleted;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReferenceDto(
|
public ReferenceDto(
|
||||||
|
@JsonProperty("id") Integer id,
|
||||||
@JsonProperty("authors") String authors,
|
@JsonProperty("authors") String authors,
|
||||||
@JsonProperty("publicationTitle") String publicationTitle,
|
@JsonProperty("publicationTitle") String publicationTitle,
|
||||||
@JsonProperty("publicationYear") Integer publicationYear,
|
@JsonProperty("publicationYear") Integer publicationYear,
|
||||||
@ -52,7 +55,9 @@ public class ReferenceDto {
|
|||||||
@JsonProperty("pages") String pages,
|
@JsonProperty("pages") String pages,
|
||||||
@JsonProperty("journalOrCollectionTitle") String journalOrCollectionTitle,
|
@JsonProperty("journalOrCollectionTitle") String journalOrCollectionTitle,
|
||||||
@JsonProperty("referenceType") ReferenceType referenceType,
|
@JsonProperty("referenceType") ReferenceType referenceType,
|
||||||
@JsonProperty("formatStandard") FormatStandard formatStandard) {
|
@JsonProperty("formatStandard") FormatStandard formatStandard,
|
||||||
|
@JsonProperty("isDeleted") boolean deleted) {
|
||||||
|
this.id = id;
|
||||||
this.authors = authors;
|
this.authors = authors;
|
||||||
this.publicationTitle = publicationTitle;
|
this.publicationTitle = publicationTitle;
|
||||||
this.publicationYear = publicationYear;
|
this.publicationYear = publicationYear;
|
||||||
@ -61,6 +66,22 @@ public class ReferenceDto {
|
|||||||
this.journalOrCollectionTitle = journalOrCollectionTitle;
|
this.journalOrCollectionTitle = journalOrCollectionTitle;
|
||||||
this.referenceType = referenceType;
|
this.referenceType = referenceType;
|
||||||
this.formatStandard = formatStandard;
|
this.formatStandard = formatStandard;
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceDto(Reference reference) {
|
||||||
|
this.id = reference.getId();
|
||||||
|
this.authors = reference.getAuthors();
|
||||||
|
this.publicationTitle = reference.getPublicationTitle();
|
||||||
|
this.publicationYear = reference.getPublicationYear();
|
||||||
|
this.publisher = reference.getPublisher();
|
||||||
|
this.pages = reference.getPages();
|
||||||
|
this.journalOrCollectionTitle = reference.getJournalOrCollectionTitle();
|
||||||
|
this.referenceType = reference.getReferenceType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceDto() {
|
||||||
|
referenceType = ReferenceType.ARTICLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthors() {
|
public String getAuthors() {
|
||||||
@ -126,4 +147,20 @@ public class ReferenceDto {
|
|||||||
public void setFormatStandard(FormatStandard formatStandard) {
|
public void setFormatStandard(FormatStandard formatStandard) {
|
||||||
this.formatStandard = formatStandard;
|
this.formatStandard = formatStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDeleted() {
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeleted(boolean deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package ru.ulstu.paper.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import ru.ulstu.paper.model.Reference;
|
||||||
|
|
||||||
|
public interface ReferenceRepository extends JpaRepository<Reference, Integer> {
|
||||||
|
void deleteById(Integer id);
|
||||||
|
}
|
@ -10,8 +10,10 @@ import ru.ulstu.file.service.FileService;
|
|||||||
import ru.ulstu.paper.model.Paper;
|
import ru.ulstu.paper.model.Paper;
|
||||||
import ru.ulstu.paper.model.PaperDto;
|
import ru.ulstu.paper.model.PaperDto;
|
||||||
import ru.ulstu.paper.model.PaperListDto;
|
import ru.ulstu.paper.model.PaperListDto;
|
||||||
|
import ru.ulstu.paper.model.Reference;
|
||||||
import ru.ulstu.paper.model.ReferenceDto;
|
import ru.ulstu.paper.model.ReferenceDto;
|
||||||
import ru.ulstu.paper.repository.PaperRepository;
|
import ru.ulstu.paper.repository.PaperRepository;
|
||||||
|
import ru.ulstu.paper.repository.ReferenceRepository;
|
||||||
import ru.ulstu.timeline.service.EventService;
|
import ru.ulstu.timeline.service.EventService;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
import ru.ulstu.user.service.UserService;
|
import ru.ulstu.user.service.UserService;
|
||||||
@ -39,6 +41,7 @@ import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.ARTICLE;
|
|||||||
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.BOOK;
|
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.BOOK;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class PaperService {
|
public class PaperService {
|
||||||
private final static int MAX_DISPLAY_SIZE = 40;
|
private final static int MAX_DISPLAY_SIZE = 40;
|
||||||
private final static String PAPER_FORMATTED_TEMPLATE = "%s %s";
|
private final static String PAPER_FORMATTED_TEMPLATE = "%s %s";
|
||||||
@ -49,14 +52,17 @@ public class PaperService {
|
|||||||
private final DeadlineService deadlineService;
|
private final DeadlineService deadlineService;
|
||||||
private final FileService fileService;
|
private final FileService fileService;
|
||||||
private final EventService eventService;
|
private final EventService eventService;
|
||||||
|
private final ReferenceRepository referenceRepository;
|
||||||
|
|
||||||
public PaperService(PaperRepository paperRepository,
|
public PaperService(PaperRepository paperRepository,
|
||||||
|
ReferenceRepository referenceRepository,
|
||||||
FileService fileService,
|
FileService fileService,
|
||||||
PaperNotificationService paperNotificationService,
|
PaperNotificationService paperNotificationService,
|
||||||
UserService userService,
|
UserService userService,
|
||||||
DeadlineService deadlineService,
|
DeadlineService deadlineService,
|
||||||
EventService eventService) {
|
EventService eventService) {
|
||||||
this.paperRepository = paperRepository;
|
this.paperRepository = paperRepository;
|
||||||
|
this.referenceRepository = referenceRepository;
|
||||||
this.fileService = fileService;
|
this.fileService = fileService;
|
||||||
this.paperNotificationService = paperNotificationService;
|
this.paperNotificationService = paperNotificationService;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
@ -117,6 +123,7 @@ public class PaperService {
|
|||||||
paper.setTitle(paperDto.getTitle());
|
paper.setTitle(paperDto.getTitle());
|
||||||
paper.setUpdateDate(new Date());
|
paper.setUpdateDate(new Date());
|
||||||
paper.setDeadlines(deadlineService.saveOrCreate(paperDto.getDeadlines()));
|
paper.setDeadlines(deadlineService.saveOrCreate(paperDto.getDeadlines()));
|
||||||
|
paper.setReferences(saveOrCreateReferences(paperDto.getReferences()));
|
||||||
paper.setFiles(fileService.saveOrCreate(paperDto.getFiles().stream()
|
paper.setFiles(fileService.saveOrCreate(paperDto.getFiles().stream()
|
||||||
.filter(f -> !f.isDeleted())
|
.filter(f -> !f.isDeleted())
|
||||||
.collect(toList())));
|
.collect(toList())));
|
||||||
@ -127,6 +134,43 @@ public class PaperService {
|
|||||||
return paper;
|
return paper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Reference> saveOrCreateReferences(List<ReferenceDto> references) {
|
||||||
|
return references
|
||||||
|
.stream()
|
||||||
|
.filter(reference -> !reference.getDeleted())
|
||||||
|
.map(reference -> reference.getId() != null ? updateReference(reference) : createReference(reference))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Reference updateReference(ReferenceDto referenceDto) {
|
||||||
|
Reference updateReference = referenceRepository.findOne(referenceDto.getId());
|
||||||
|
updateReference.setAuthors(referenceDto.getAuthors());
|
||||||
|
updateReference.setJournalOrCollectionTitle(referenceDto.getJournalOrCollectionTitle());
|
||||||
|
updateReference.setPages(referenceDto.getPages());
|
||||||
|
updateReference.setPublicationTitle(referenceDto.getPublicationTitle());
|
||||||
|
updateReference.setPublicationYear(referenceDto.getPublicationYear());
|
||||||
|
updateReference.setPublisher(referenceDto.getPublisher());
|
||||||
|
updateReference.setReferenceType(referenceDto.getReferenceType());
|
||||||
|
referenceRepository.save(updateReference);
|
||||||
|
return updateReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Reference createReference(ReferenceDto referenceDto) {
|
||||||
|
Reference newReference = new Reference();
|
||||||
|
newReference.setAuthors(referenceDto.getAuthors());
|
||||||
|
newReference.setJournalOrCollectionTitle(referenceDto.getJournalOrCollectionTitle());
|
||||||
|
newReference.setPages(referenceDto.getPages());
|
||||||
|
newReference.setPublicationTitle(referenceDto.getPublicationTitle());
|
||||||
|
newReference.setPublicationYear(referenceDto.getPublicationYear());
|
||||||
|
newReference.setPublisher(referenceDto.getPublisher());
|
||||||
|
newReference.setReferenceType(referenceDto.getReferenceType());
|
||||||
|
newReference = referenceRepository.save(newReference);
|
||||||
|
return newReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Integer update(PaperDto paperDto) throws IOException {
|
public Integer update(PaperDto paperDto) throws IOException {
|
||||||
Paper paper = paperRepository.findOne(paperDto.getId());
|
Paper paper = paperRepository.findOne(paperDto.getId());
|
||||||
@ -139,6 +183,11 @@ public class PaperService {
|
|||||||
fileService.delete(file.getId());
|
fileService.delete(file.getId());
|
||||||
}
|
}
|
||||||
paperRepository.save(copyFromDto(paper, paperDto));
|
paperRepository.save(copyFromDto(paper, paperDto));
|
||||||
|
for (ReferenceDto referenceDto : paperDto.getReferences().stream()
|
||||||
|
.filter(f -> f.getDeleted() && f.getId() != null)
|
||||||
|
.collect(toList())) {
|
||||||
|
referenceRepository.deleteById(referenceDto.getId());
|
||||||
|
}
|
||||||
eventService.updatePaperDeadlines(paper);
|
eventService.updatePaperDeadlines(paper);
|
||||||
|
|
||||||
paper.getAuthors().forEach(author -> {
|
paper.getAuthors().forEach(author -> {
|
||||||
@ -168,6 +217,14 @@ public class PaperService {
|
|||||||
return Arrays.asList(Paper.PaperType.values());
|
return Arrays.asList(Paper.PaperType.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ReferenceDto.FormatStandard> getFormatStandards() {
|
||||||
|
return Arrays.asList(ReferenceDto.FormatStandard.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReferenceDto.ReferenceType> getReferenceTypes() {
|
||||||
|
return Arrays.asList(ReferenceDto.ReferenceType.values());
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Paper create(String title, User user, Date deadlineDate) {
|
public Paper create(String title, User user, Date deadlineDate) {
|
||||||
Paper paper = new Paper();
|
Paper paper = new Paper();
|
||||||
|
@ -7,20 +7,13 @@
|
|||||||
<column name="id" type="integer">
|
<column name="id" type="integer">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="authors" type="varchar(255)">
|
<column name="authors" type="varchar(255)"/>
|
||||||
<constraints nullable="false"/>
|
<column name="publication_title" type="varchar(255)"/>
|
||||||
</column>
|
<column name="publication_year" type="integer"/>
|
||||||
<column name="publication_title" type="varchar(255)">
|
|
||||||
<constraints nullable="false"/>
|
|
||||||
</column>
|
|
||||||
<column name="publication_year" type="integer">
|
|
||||||
<constraints nullable="false"/>
|
|
||||||
</column>
|
|
||||||
<column name="paper_id" type="integer"/>
|
<column name="paper_id" type="integer"/>
|
||||||
<column name="publisher" type="varchar(255)"/>
|
<column name="publisher" type="varchar(255)"/>
|
||||||
<column name="pages" type="varchar(255)"/>
|
<column name="pages" type="varchar(255)"/>
|
||||||
<column name="journal_or_collection_title" type="varchar(255)"/>
|
<column name="journal_or_collection_title" type="varchar(255)"/>
|
||||||
|
|
||||||
<column name="reference_type" type="varchar(255)">
|
<column name="reference_type" type="varchar(255)">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
|
@ -7,3 +7,23 @@
|
|||||||
.nav-tabs {
|
.nav-tabs {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#nav-references label, #nav-references select, #nav-references input {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-references .collapse-heading {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 5px 15px;
|
||||||
|
background-color: #efefef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-references .collapse-heading a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-references a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
@ -31,6 +31,9 @@
|
|||||||
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
|
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
|
||||||
<a class="nav-item nav-link" id="nav-latex-tab" data-toggle="tab"
|
<a class="nav-item nav-link" id="nav-latex-tab" data-toggle="tab"
|
||||||
href="#nav-latex" role="tab" aria-controls="nav-latex" aria-selected="false">Latex</a>
|
href="#nav-latex" role="tab" aria-controls="nav-latex" aria-selected="false">Latex</a>
|
||||||
|
<a class="nav-item nav-link" id="nav-references-tab" data-toggle="tab"
|
||||||
|
href="#nav-references" role="tab" aria-controls="nav-references"
|
||||||
|
aria-selected="false">References</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="tab-content" id="nav-tabContent">
|
<div class="tab-content" id="nav-tabContent">
|
||||||
@ -167,6 +170,99 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane fade" id="nav-references" role="tabpanel"
|
||||||
|
aria-labelledby="nav-profile-tab">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>References:</label>
|
||||||
|
<th:block th:each="reference, rowStat : *{references}">
|
||||||
|
<div class="row" th:id="|reference${rowStat.index}|"
|
||||||
|
th:style="${reference.deleted} ? 'display: none;' :''">
|
||||||
|
|
||||||
|
<div class="form-group col-11">
|
||||||
|
<a data-toggle="collapse"
|
||||||
|
th:href="${'#collapseReference'+rowStat.index}"
|
||||||
|
aria-expanded="false">
|
||||||
|
<div class="collapse-heading"
|
||||||
|
th:text="${(reference.referenceType.toString() == 'ARTICLE'?'Статья':'Книга') +'. '
|
||||||
|
+(reference.publicationTitle==null?'':reference.publicationTitle+'. ')+(reference.authors==null?'':reference.authors+'. ') }">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
<a class="btn btn-danger float-right"
|
||||||
|
th:onclick="|$('#references${rowStat.index}\\.deleted').val('true'); $('#reference${rowStat.index}').hide(); |"><span
|
||||||
|
aria-hidden="true"><i class="fa fa-times"/></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse" th:id="${'collapseReference'+rowStat.index}">
|
||||||
|
<input type="hidden"
|
||||||
|
th:field="*{references[__${rowStat.index}__].id}"/>
|
||||||
|
<input type="hidden"
|
||||||
|
th:field="*{references[__${rowStat.index}__].deleted}"/>
|
||||||
|
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Вид публикации:</label>
|
||||||
|
<select class="form-control col-7"
|
||||||
|
th:field="*{references[__${rowStat.index}__].referenceType}">
|
||||||
|
<option th:each="type : ${allReferenceTypes}"
|
||||||
|
th:value="${type}"
|
||||||
|
th:text="${type.typeName}">Type
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Авторы:</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control col-7"
|
||||||
|
name="authors"
|
||||||
|
th:field="*{references[__${rowStat.index}__].authors}"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4 ">Название публикации:</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control col-7"
|
||||||
|
name="publicationTitle"
|
||||||
|
th:field="*{references[__${rowStat.index}__].publicationTitle}"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Год издания:</label>
|
||||||
|
<input type="number" class="form-control col-7 "
|
||||||
|
name="publicationYear"
|
||||||
|
th:field="*{references[__${rowStat.index}__].publicationYear}"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Издательство:</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control col-7"
|
||||||
|
name="publisher"
|
||||||
|
th:field="*{references[__${rowStat.index}__].publisher}"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Страницы:</label>
|
||||||
|
<input type="text" class="form-control col-7" name="pages"
|
||||||
|
th:field="*{references[__${rowStat.index}__].pages}"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="col-4">Название журнала или сборника статей
|
||||||
|
конференции:</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control col-7"
|
||||||
|
name="journalOrCollectionTitle"
|
||||||
|
th:field="*{references[__${rowStat.index}__].journalOrCollectionTitle}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" id="addReference" name="addReference"
|
||||||
|
class="btn btn-primary"
|
||||||
|
value="Добавить источник"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 offset-md-1 col-sm-12 offset-sm-0">
|
<div class="col-md-4 offset-md-1 col-sm-12 offset-sm-0">
|
||||||
@ -378,7 +474,6 @@
|
|||||||
$('#pdfBtn').prop('disabled', false);
|
$('#pdfBtn').prop('disabled', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user