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;
|
package ru.redrise.marinesco.library.web;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.comparator.Comparators;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -32,6 +35,8 @@ public class AuthorController {
|
||||||
|
|
||||||
List<Book> books = author.getBooks();
|
List<Book> books = author.getBooks();
|
||||||
|
|
||||||
|
Collections.sort(books, (a, b) -> a.getSeries().compareTo(b.getSeries()));
|
||||||
|
|
||||||
model.addAttribute("author", author);
|
model.addAttribute("author", author);
|
||||||
model.addAttribute("books", books);
|
model.addAttribute("books", books);
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,19 @@ button:hover {
|
||||||
font-weight: bold;
|
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{
|
.wrapper_centred{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
|
@ -18,13 +18,20 @@
|
||||||
<div th:if="${author} != null">
|
<div th:if="${author} != null">
|
||||||
<div class="title" th:text="${author.authorName}"><br /></div>
|
<div class="title" th:text="${author.authorName}"><br /></div>
|
||||||
<div th:each="book : ${books}">
|
<div th:each="book : ${books}">
|
||||||
<a th:href="${'/book/' + book.id}">
|
<div class="wrapper">
|
||||||
<div class="book_title" th:text="${book.title}"></div>
|
<div class="horizontal_el_left">
|
||||||
</a>
|
<a th:href="${'/book/' + book.id}">
|
||||||
<em><div th:if="${book.series} != ''" th:text="${book.series}"></div></em>
|
<div class="book_title" th:text="${book.title}"></div>
|
||||||
<br />
|
</a>
|
||||||
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
|
<em>
|
||||||
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>
|
<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>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue