diff --git a/app/src/main/java/it/chalmers/gamma/adapter/primary/web/UserAgreementController.java b/app/src/main/java/it/chalmers/gamma/adapter/primary/web/UserAgreementController.java new file mode 100644 index 000000000..28f448506 --- /dev/null +++ b/app/src/main/java/it/chalmers/gamma/adapter/primary/web/UserAgreementController.java @@ -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; + } + +} diff --git a/app/src/main/resources/templates/common/header.html b/app/src/main/resources/templates/common/header.html index b448b6189..c3191fe6d 100644 --- a/app/src/main/resources/templates/common/header.html +++ b/app/src/main/resources/templates/common/header.html @@ -27,6 +27,9 @@
  • Posts
  • +
  • + User agreement +

  • diff --git a/app/src/main/resources/templates/user-agreement/page.html b/app/src/main/resources/templates/user-agreement/page.html new file mode 100644 index 000000000..dd276633b --- /dev/null +++ b/app/src/main/resources/templates/user-agreement/page.html @@ -0,0 +1,9 @@ +
    +
    +
    +
    + User agreement +
    + +
    +
    \ No newline at end of file