From 76ab0ddf11c7650858f355daf6508ee627af0a6a Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 11 Mar 2022 09:10:48 +0400 Subject: [PATCH] #3 -- fix routing --- data/db.mv.db | Bin 45056 -> 69632 bytes .../configuration/SecurityConfiguration.java | 2 +- .../ru/ulstu/controller/IndexController.java | 2 +- .../ru/ulstu/controller/NewsController.java | 14 ++++-- .../ru/ulstu/repository/NewsRepository.java | 3 ++ .../java/ru/ulstu/service/NewsService.java | 4 ++ src/main/resources/public/css/main.css | 2 +- src/main/resources/templates/default.html | 2 +- src/main/resources/templates/editNews.html | 2 +- src/main/resources/templates/index.html | 6 +-- src/main/resources/templates/news.html | 41 ++++++++++++------ src/main/resources/templates/viewNews.html | 25 +++++++++++ 12 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 src/main/resources/templates/viewNews.html diff --git a/data/db.mv.db b/data/db.mv.db index 2fc3b4de9e4cf466f101f7aa4ec2d385f69dc93c..232741a16331eb07abff8824e1e6378d5adb1060 100644 GIT binary patch literal 69632 zcmeHQYiwM{bzah3MW#$!v@J`PAGuz?WQ*P0=ia+a3VX?2O0+0a=0lIP2z&S5yVSZ0{+tiMN`8) z^PXMaU9LpRmhF)Z?%dbRnKNh3JkFW#9G^5Nij`XM*rcJ8#8UYa5nSl{L~y=UeQdH= z%1i|H$ZtmBq~Vq_zUP;sOm?DFtFQabNn_$dRBx1PRs3S95;cSKQGGIF6^nM54Mr2{ zpW=YxfZ~ASfZ~ASfZ~ASfZ~ASfZ~ASfZ~ASz&p)><7)l?PB(!nUvWTjKyg5EKyg5E zKyg5EKyg5EKyg5EKyl!TbAa0TqmX(5m=l$#3VQG%|!_SkGhH2>&)#%CQq&>0W zuSJc?%tXCbYfhS_q78lmx*oc^HPI}uN0UM5nzro;p8&{sqgDZ`Nm;#0Z;C_Mt%fW@9t-pQ6mtzUtfDm@<8JHy~CJUi!8Ci5@%Q< zc`Z-vdp_MMx}tf3NxEb9dc0R`u7Tbh#QvP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NYL${t#= zI9mTdTK`|hIf*?us0*{$kPoi)(f)ru8>!HRp`-o(u-nL<*2?d@AsJnXN^Y!3o#laO zwErJdv%poGZ;VPk=Pz$VrD*@Z0Xq~0&_?_J(H$9StNV2J{|n~d;VHB~|4*m!0>HeA z@&A_ijAM(r8=L3^_MvsNwiZL4gBzQ$bf z*8qI}{|KA^{}tX2Wj~0G;yChq?;qZ=Vp+U?s}?)F%Zg?Gn*j4uU%Sj;HQMaA%zi83 zHHB0qTD#0tEvz-T`?uBb?vvryP{Fs=YkKXnSN$c{dN<{iORS|UmGE01HH~(an`ResZLP*(N+ zH-~>xJ@AF-lj?QwN!7s0RsU~SR=XZQH$^-}2t)`(2t){6BM8Xv@4@^#nEzYB`hSL_ Lm8(}{{lEVMz8BQP diff --git a/src/main/java/ru/ulstu/configuration/SecurityConfiguration.java b/src/main/java/ru/ulstu/configuration/SecurityConfiguration.java index ea8dc5d..f893257 100644 --- a/src/main/java/ru/ulstu/configuration/SecurityConfiguration.java +++ b/src/main/java/ru/ulstu/configuration/SecurityConfiguration.java @@ -45,7 +45,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { log.debug("Security enabled"); http.authorizeRequests() .antMatchers("/").permitAll() - .antMatchers("/login", "/index", "/news/*", "/h2-console/*", "/h2-console").permitAll() + .antMatchers("/login", "/index", "/news/**", "/h2-console/*", "/h2-console").permitAll() .antMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN) .anyRequest().authenticated() .and() diff --git a/src/main/java/ru/ulstu/controller/IndexController.java b/src/main/java/ru/ulstu/controller/IndexController.java index d6f2fc0..9774e53 100644 --- a/src/main/java/ru/ulstu/controller/IndexController.java +++ b/src/main/java/ru/ulstu/controller/IndexController.java @@ -22,7 +22,7 @@ public class IndexController { @GetMapping("/") public String index(Model model) { - model.addAttribute("news", newsService.getAll()); + model.addAttribute("news", newsService.getLast()); return "index"; } } diff --git a/src/main/java/ru/ulstu/controller/NewsController.java b/src/main/java/ru/ulstu/controller/NewsController.java index 3de7221..111a1ca 100644 --- a/src/main/java/ru/ulstu/controller/NewsController.java +++ b/src/main/java/ru/ulstu/controller/NewsController.java @@ -13,12 +13,14 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; import ru.ulstu.model.News; import ru.ulstu.service.NewsService; import javax.validation.Valid; @Controller +@RequestMapping("news") public class NewsController { private final NewsService newsService; @@ -26,6 +28,12 @@ public class NewsController { this.newsService = newsService; } + @GetMapping("/news") + public String index(Model model) { + model.addAttribute("news", newsService.getAll()); + return "news"; + } + @GetMapping("/editNews/{newsId}") public String editNews(@PathVariable(value = "newsId") Integer id, Model model) { model.addAttribute("news", (id != null && id != 0) ? newsService.getById(id) : new News()); @@ -35,7 +43,7 @@ public class NewsController { @GetMapping("/news/{newsId}") public String viewNews(@PathVariable(value = "newsId") Integer id, Model model) { model.addAttribute("news", id != null ? newsService.getById(id) : new News()); - return "news"; + return "viewNews"; } @PostMapping("saveNews") @@ -45,12 +53,12 @@ public class NewsController { } newsService.save(news); - return "redirect:/"; + return "redirect:/news/news"; } @GetMapping("deleteNews/{newsId}") public String delete(@PathVariable(value = "newsId") Integer id) { newsService.delete(id); - return "redirect:/"; + return "redirect:/news/news"; } } diff --git a/src/main/java/ru/ulstu/repository/NewsRepository.java b/src/main/java/ru/ulstu/repository/NewsRepository.java index 3aaf6bf..6bd607a 100644 --- a/src/main/java/ru/ulstu/repository/NewsRepository.java +++ b/src/main/java/ru/ulstu/repository/NewsRepository.java @@ -3,5 +3,8 @@ package ru.ulstu.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.model.News; +import java.util.List; + public interface NewsRepository extends JpaRepository { + List findFirst3ByOrderByDateDesc(); } diff --git a/src/main/java/ru/ulstu/service/NewsService.java b/src/main/java/ru/ulstu/service/NewsService.java index 293d062..3f743f0 100644 --- a/src/main/java/ru/ulstu/service/NewsService.java +++ b/src/main/java/ru/ulstu/service/NewsService.java @@ -46,4 +46,8 @@ public class NewsService { public void delete(Integer id) { newsRepository.deleteById(id); } + + public List getLast() { + return newsRepository.findFirst3ByOrderByDateDesc(); + } } diff --git a/src/main/resources/public/css/main.css b/src/main/resources/public/css/main.css index 359a34c..9b299ad 100644 --- a/src/main/resources/public/css/main.css +++ b/src/main/resources/public/css/main.css @@ -29,6 +29,6 @@ color: black; } -.link-dark, .link-dark:visited, .link-dark:focus { +.link-dark, .link-dark:visited, .link-dark:focus, .link-dark:any-link { color: black; } \ No newline at end of file diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 5d978bd..3146bbf 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -33,7 +33,7 @@