From 75d25de1e6e279e4d5e2d16d1c3483a2e2fd97d0 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Sun, 20 Mar 2016 11:09:17 +0100 Subject: [PATCH] #171 - Switched to Thymeleaf Spring Data dialect for pagination in views. Added dependency and bean definition for the SpringDataDialect. Templates now use three different elements of the Thymeleaf Spring Data support: - Pagination information (pagination summary) - The pagination links including first / previous and next / last links - Pagination links to navigate through the pages --- web/querydsl/pom.xml | 6 +++ .../main/java/example/users/Application.java | 7 +++ .../src/main/resources/templates/index.html | 43 ++++++++----------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/web/querydsl/pom.xml b/web/querydsl/pom.xml index 68edf2d8..5f18d1d2 100644 --- a/web/querydsl/pom.xml +++ b/web/querydsl/pom.xml @@ -43,6 +43,12 @@ runtime + + io.github.jpenren + thymeleaf-spring-data-dialect + 2.1.0 + + org.webjars jquery diff --git a/web/querydsl/src/main/java/example/users/Application.java b/web/querydsl/src/main/java/example/users/Application.java index c65fcc82..f09cbfb1 100644 --- a/web/querydsl/src/main/java/example/users/Application.java +++ b/web/querydsl/src/main/java/example/users/Application.java @@ -20,8 +20,10 @@ import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.thymeleaf.dialect.springdata.SpringDataDialect; /** * @author Christoph Strobl @@ -44,6 +46,11 @@ public class Application extends WebMvcConfigurerAdapter { resourceChain(true); } + @Bean + SpringDataDialect springDataDialect() { + return new SpringDataDialect(); + } + @Autowired UserRepository repo; @PostConstruct diff --git a/web/querydsl/src/main/resources/templates/index.html b/web/querydsl/src/main/resources/templates/index.html index 569a9ed2..6b6bb450 100644 --- a/web/querydsl/src/main/resources/templates/index.html +++ b/web/querydsl/src/main/resources/templates/index.html @@ -1,26 +1,26 @@ - + User Center - + - +

User Center

- +

Search

- +
- +
@@ -44,33 +44,26 @@
- +
- + - + - + @@ -93,8 +86,10 @@
# FirstnameFirstname Lastname Nationality City
- + +
    +
    - + \ No newline at end of file