Books sorted by series on Author's page
This commit is contained in:
parent
261d5b3ae4
commit
dd7582b2d3
3 changed files with 32 additions and 7 deletions
|
@ -1,9 +1,12 @@
|
|||
package ru.redrise.marinesco.library.web;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.comparator.Comparators;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -32,6 +35,8 @@ public class AuthorController {
|
|||
|
||||
List<Book> books = author.getBooks();
|
||||
|
||||
Collections.sort(books, (a, b) -> a.getSeries().compareTo(b.getSeries()));
|
||||
|
||||
model.addAttribute("author", author);
|
||||
model.addAttribute("books", books);
|
||||
|
||||
|
|
|
@ -277,6 +277,19 @@ button:hover {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.horizontal_el_left{
|
||||
flex:1;
|
||||
padding-right: 2px;
|
||||
}
|
||||
.horizontal_el_right{
|
||||
flex:1;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.wrapper_centred{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
@ -18,13 +18,20 @@
|
|||
<div th:if="${author} != null">
|
||||
<div class="title" th:text="${author.authorName}"><br /></div>
|
||||
<div th:each="book : ${books}">
|
||||
<a th:href="${'/book/' + book.id}">
|
||||
<div class="book_title" th:text="${book.title}"></div>
|
||||
</a>
|
||||
<em><div th:if="${book.series} != ''" th:text="${book.series}"></div></em>
|
||||
<br />
|
||||
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
|
||||
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>
|
||||
<div class="wrapper">
|
||||
<div class="horizontal_el_left">
|
||||
<a th:href="${'/book/' + book.id}">
|
||||
<div class="book_title" th:text="${book.title}"></div>
|
||||
</a>
|
||||
<em>
|
||||
<div th:if="${book.series} != ''" th:text="${book.series}"></div>
|
||||
</em>
|
||||
</div>
|
||||
<div class="horizontal_el_right">
|
||||
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
|
||||
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue