Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Portals committed Sep 7, 2024
1 parent d5fcd7a commit 462a9e2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package it.chalmers.gamma.adapter.primary.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class UserAgreementController {

@GetMapping("/user-agreement")
public ModelAndView getUserAgreement(@RequestHeader(value = "HX-Request", required = false) boolean htmxRequest) {
ModelAndView mv = new ModelAndView();
if (htmxRequest) {
mv.setViewName("user-agreement/page");
} else {
mv.setViewName("index");
mv.addObject("page", "user-agreement/page");
}

return mv;
}

}
3 changes: 3 additions & 0 deletions app/src/main/resources/templates/common/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<li>
<a th:href="@{/posts}">Posts</a>
</li>
<li>
<a th:href="@{/user-agreement}">User agreement</a>
</li>
<th:block th:if="${isAdmin}">
<hr>
<li>
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/resources/templates/user-agreement/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<header th:replace="~{common/header}"></header>
<main>
<article>
<header>
User agreement
</header>
<th:block th:replace="~{register-account/user-agreement}" />
</article>
</main>

0 comments on commit 462a9e2

Please sign in to comment.