From dd7582b2d3da79e1cbbb3107e23bc26d83738282 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Wed, 17 Jan 2024 20:19:48 +0300 Subject: [PATCH] Books sorted by series on Author's page --- .../library/web/AuthorController.java | 5 +++++ src/main/resources/static/styles/styles.css | 13 ++++++++++++ src/main/resources/templates/author.html | 21 ++++++++++++------- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/ru/redrise/marinesco/library/web/AuthorController.java b/src/main/java/ru/redrise/marinesco/library/web/AuthorController.java index 44c39a6..67cb5eb 100644 --- a/src/main/java/ru/redrise/marinesco/library/web/AuthorController.java +++ b/src/main/java/ru/redrise/marinesco/library/web/AuthorController.java @@ -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 books = author.getBooks(); + Collections.sort(books, (a, b) -> a.getSeries().compareTo(b.getSeries())); + model.addAttribute("author", author); model.addAttribute("books", books); diff --git a/src/main/resources/static/styles/styles.css b/src/main/resources/static/styles/styles.css index bad83d7..a10c96b 100644 --- a/src/main/resources/static/styles/styles.css +++ b/src/main/resources/static/styles/styles.css @@ -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; diff --git a/src/main/resources/templates/author.html b/src/main/resources/templates/author.html index 75e8615..447b100 100644 --- a/src/main/resources/templates/author.html +++ b/src/main/resources/templates/author.html @@ -18,13 +18,20 @@

- -
-
-
-
- +
+
+ +
+
+ +
+
+
+
+ +
+