#247 -- Remove latex and fix paper list

This commit is contained in:
Anton Romanov 2024-04-23 17:02:48 +04:00
parent 55a76daa5a
commit 6e40343d6c
8 changed files with 57 additions and 72 deletions

View File

@ -108,9 +108,7 @@ public class Deadline extends BaseEntity {
}
return getId().equals(deadline.getId()) &&
description.equals(deadline.description) &&
date.equals(deadline.date) &&
executors.equals(deadline.executors) &&
done.equals(deadline.done);
date.equals(deadline.date);
}
@Override

View File

@ -100,7 +100,7 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate = new Date();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "paper_id", unique = true)
@Fetch(FetchMode.SUBSELECT)
@OrderBy("date")
@ -123,10 +123,6 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
@ManyToMany(fetch = FetchType.EAGER)
private Set<User> authors = new HashSet<>();
@Column(name = "latex_text")
private String latexText;
@ManyToOne()
@JoinColumn(name = "conference_id")
private Conference conference;
@ -245,14 +241,6 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
this.url = url;
}
public String getLatexText() {
return latexText;
}
public void setLatexText(String latexText) {
this.latexText = latexText;
}
public Conference getConference() {
return conference;
}
@ -322,13 +310,12 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
Objects.equals(events, paper.events) &&
Objects.equals(files, paper.files) &&
Objects.equals(authors, paper.authors) &&
Objects.equals(latexText, paper.latexText) &&
Objects.equals(conference, paper.conference) &&
Objects.equals(grants, paper.grants);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, latexText, conference, grants);
return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, conference, grants);
}
}

View File

@ -3,6 +3,7 @@ package ru.ulstu.paper.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.file.model.FileDataDto;
import ru.ulstu.user.model.UserDto;
@ -89,10 +90,9 @@ public class PaperDto {
this.deadlines = paper.getDeadlines();
this.comment = paper.getComment();
this.url = paper.getUrl();
this.latexText = paper.getLatexText();
this.locked = paper.getLocked();
this.files = convert(paper.getFiles(), FileDataDto::new);
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
this.authorIds = convert(paper.getAuthors(), BaseEntity::getId);
this.authors = convert(paper.getAuthors(), UserDto::new);
this.references = convert(paper.getReferences(), ReferenceDto::new);
}
@ -212,7 +212,7 @@ public class PaperDto {
public String getAuthorsString() {
return StringUtils.abbreviate(authors
.stream()
.map(author -> author.getLastName())
.map(UserDto::getLastName)
.collect(Collectors.joining(", ")), MAX_AUTHORS_LENGTH);
}

View File

@ -81,9 +81,7 @@ public class PaperService {
}
public List<PaperDto> findAllDto() {
List<PaperDto> papers = convert(findAll(), PaperDto::new);
papers.forEach(paperDto -> paperDto.setTitle(StringUtils.abbreviate(paperDto.getTitle(), MAX_DISPLAY_SIZE)));
return papers;
return convert(findAll(), PaperDto::new);
}
public List<Paper> findAllActive() {
@ -125,7 +123,6 @@ public class PaperService {
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
paper.setComment(paperDto.getComment());
paper.setUrl(paperDto.getUrl());
paper.setLatexText(paperDto.getLatexText());
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
paper.setLocked(paperDto.getLocked());
paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus());

View File

@ -36,7 +36,7 @@ spring.liquibase.enabled=true
# Application Settings
ng-tracker.base-url=http://127.0.0.1:8080
ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=false
ng-tracker.dev-mode=true
ng-tracker.debug_email=
ng-tracker.use-https=false
ng-tracker.check-run=false

View File

@ -4,23 +4,33 @@
<meta charset="UTF-8"/>
</head>
<body>
<div th:fragment="paperLine (paper)" class="row text-left paper-row" style="background-color: white;">
<div class="col">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)"/>
<a th:href="@{'../papers/paper?id='+${paper.id}}">
<span class="h6" th:if="${#strings.length(paper.title)} > 50"
th:text="${#strings.substring(paper.title, 0, 50) + '...'}" th:title="${paper.title}"/>
<span class="h6" th:if="${#strings.length(paper.title) le 50}" th:text="${paper.title}"
th:title="${paper.title}"/>
<div th:fragment="paperLine (paper)" class="text-left paper-row" style="background-color: white;">
<div class="row">
<div class="col-1 d-flex justify-content-center">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)"/>
</div>
<div class="col-10">
<a th:href="@{'../papers/paper?id='+${paper.id}}">
<span class="h6" th:if="${#strings.length(paper.title)} > 100"
th:text="${#strings.substring(paper.title, 0, 100) + ' ...'}" th:title="${paper.title}"/>
<span class="h6" th:if="${#strings.length(paper.title) le 100}" th:text="${paper.title}"
th:title="${paper.title}"/>
</a>
</div>
<div class="col-1 d-flex justify-content-center">
<input class="id-class" type="hidden" th:value="${paper.id}"/>
<a class="remove-paper pull-right d-none" href="#" data-confirm="Удалить статью?">
<i class="fa fa-trash fa-2x" aria-hidden="true"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-1">
</div>
<div class="col-10">
<span class="text-muted" th:text="${paper.authorsString}"/>
</a>
<input class="id-class" type="hidden" th:value="${paper.id}"/>
<a class="remove-paper pull-right d-none" href="#" data-confirm="Удалить статью?">
<i class="fa fa-trash" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -33,8 +33,6 @@
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab"
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
<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>
<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>

View File

@ -12,43 +12,38 @@
<input th:type="hidden" name="paperDeleteId" id="paperDeleteId"/>
<section id="papers">
<div class="container">
<div class="row" id="paper-list">
<div class="row mb-3" id="paper-list">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Статьи</h2>
<h3 class="section-heading text-uppercase">Статьи</h3>
<div th:replace="papers/fragments/paperNavigationFragment"/>
</div>
</div>
<div class="row">
<div class="alert alert-danger" th:if="${#fields.hasErrors('*')}">
<p th:each="err : ${#fields.errors('*')}" th:text="${err}"></p>
<div class="row filter mb-3 justify-content-center">
<div class="col-4">
<select class="form-control" th:field="${filteredPapers.filterAuthorId}" id="author"
onchange="this.form.submit();">
<option value="">Все авторы</option>
<option th:each="author: ${allAuthors}" th:value="${author.id}"
th:text="${author.lastName}">lastName
</option>
</select>
</div>
<div class="col-md-9 col-sm-12">
<th:block th:each="paper : ${filteredPapers.papers}">
<div th:replace="papers/fragments/paperLineFragment :: paperLine(paper=${paper})"/>
</th:block>
</div>
<div class="col-md-3 col-sm-12">
<div class="filter">
<h5>Фильтр:</h5>
<select class="form-control" th:field="${filteredPapers.filterAuthorId}" id="author"
onchange="this.form.submit();">
<option value="">Все авторы</option>
<option th:each="author: ${allAuthors}" th:value="${author.id}"
th:text="${author.lastName}">lastName
</option>
</select>
<select class="form-control" id="year" th:field="${filteredPapers.year}"
onchange="this.form.submit();">
<option value="">Все годы</option>
<option th:each="year: ${allYears}" th:value="${year}"
th:text="${year}">year
</option>
</select>
</div>
<div class="col-4">
<select class="form-control" id="year" th:field="${filteredPapers.year}"
onchange="this.form.submit();">
<option value="">Все годы</option>
<option th:each="year: ${allYears}" th:value="${year}"
th:text="${year}">year
</option>
</select>
</div>
</div>
<!--<div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>-->
<th:block th:each="paper : ${filteredPapers.papers}">
<div th:replace="papers/fragments/paperLineFragment :: paperLine(paper=${paper})"/>
</th:block>
<!--div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>-->
</div>
</section>