diff --git a/src/main/java/Team5/SmartTowns/Landmarks/Landmarks.java b/src/main/java/Team5/SmartTowns/Landmarks/Landmarks.java index ee6628f305b885fab6253be7ab50482d1cc818f2..94fec3e5f18cf082f58ca3dbca4223b1c50429b7 100644 --- a/src/main/java/Team5/SmartTowns/Landmarks/Landmarks.java +++ b/src/main/java/Team5/SmartTowns/Landmarks/Landmarks.java @@ -1,29 +1,44 @@ package Team5.SmartTowns.Landmarks; +import Team5.SmartTowns.trails.Trail; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotEmpty; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + @Data @AllArgsConstructor +@NoArgsConstructor public class Landmarks { + + // Intialised object to getID from trail. + + //Predefined Landmark for Dragons Tale. + public static List<Landmarks> landmarksDragonstrail = List.of( + new Landmarks( 1, "A scent of...Dragon", "The Dragon has been spotted near by, find the QR code to continue" , "Start your discovery, at the sweet shop."), + new Landmarks( 2, "They've been found!", "Don't let them escape, find the next QR code to continue!", "location test") + ); + + private Integer trailID; + private int landmarkID; @NotEmpty(message = "You must type in a username.") private String landmarkName; @Email(message = "You must attach a contact address.") private String landmarkEmail; private String landmarkDescription; private String landmarkLocation; - private Integer trailID; - + private String landmarkPicture; - public Landmarks(){ - this.landmarkName =""; - this.landmarkEmail=""; - this.landmarkDescription =""; - this.landmarkLocation =""; - this.trailID =0; - } + // Constructor for List above. + public Landmarks( int landmarkID, String landmarkName, String landmarkDescription, String landmarkLocation) { + this.landmarkID = landmarkID; + this.landmarkName = landmarkName; + this.landmarkDescription = landmarkDescription; + this.landmarkLocation = landmarkLocation; } } diff --git a/src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java b/src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java index 2de5783d1e96beeb3fa8043830fe04ac93a41f8e..98c35594da947d261f6980b10a516a75b4583431 100644 --- a/src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java +++ b/src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java @@ -36,7 +36,7 @@ public class LandmarksController { // current functionality only prints successful Landmarks, (todo )database integration is necessary here - ModelAndView modelAndView = new ModelAndView("redirect:/allTrails"); + ModelAndView modelAndView = new ModelAndView("redirect:/test.html"); return modelAndView; } diff --git a/src/main/java/Team5/SmartTowns/trailcontrollers/DragonsTale.java b/src/main/java/Team5/SmartTowns/trailcontrollers/DragonsTale.java deleted file mode 100644 index ba499c964988180a774b2f66ba7c18274ccfdd21..0000000000000000000000000000000000000000 --- a/src/main/java/Team5/SmartTowns/trailcontrollers/DragonsTale.java +++ /dev/null @@ -1,15 +0,0 @@ -package Team5.SmartTowns.trailcontrollers; - - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class DragonsTale { - @GetMapping("/dragonstale") - public ModelAndView getDragonsTale(){ - ModelAndView modelAndView = new ModelAndView("src/main/resources/templates/towns/trails/dragonstale/index.html"); - return modelAndView; - } -} diff --git a/src/main/java/Team5/SmartTowns/trails/Trail.java b/src/main/java/Team5/SmartTowns/trails/Trail.java index a80755867991c82eb90b21fcb33f563294ab44b2..efc9e125af8f94a79e29c21e1de4b1cdf3d5a503 100644 --- a/src/main/java/Team5/SmartTowns/trails/Trail.java +++ b/src/main/java/Team5/SmartTowns/trails/Trail.java @@ -12,7 +12,7 @@ public class Trail { new Trail(2,"Trail2", "This is trail two"), new Trail(3,"Trail3", "This is trail three"), new Trail(4,"Trail4", "This is trail four"), - new Trail(5,"Trail5", "This trail is an example of a trail that does not have an image") + new Trail(5,"A Dragon's Tale", "EDITING THIS") ); int id; String name; diff --git a/src/main/java/Team5/SmartTowns/trails/TrailsController.java b/src/main/java/Team5/SmartTowns/trails/TrailsController.java index e78b8f721fcd7852db7bbd7b549d66c10ed09248..0b9b8f6c7f241a88b31b38598378fe1ab1b6ab4c 100644 --- a/src/main/java/Team5/SmartTowns/trails/TrailsController.java +++ b/src/main/java/Team5/SmartTowns/trails/TrailsController.java @@ -1,6 +1,7 @@ package Team5.SmartTowns.trails; +import Team5.SmartTowns.Landmarks.Landmarks; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -12,6 +13,8 @@ import org.springframework.web.servlet.ModelAndView; import java.util.ArrayList; import java.util.List; +import static Team5.SmartTowns.Landmarks.Landmarks.landmarksDragonstrail; + @Controller public class TrailsController { @GetMapping("/allTrails") @@ -32,7 +35,16 @@ public class TrailsController { List<Trail> trailList= Trail.trails;//results from db ModelAndView mv= new ModelAndView("fragments/allTrailsFrags :: trailSection"); mv.addObject("trail", trailList.get(id-1)); - return mv; } + + @GetMapping("/dragonstale") + public ModelAndView getDragonsTale(){ + List<Landmarks> landmarksList = landmarksDragonstrail; + ModelAndView modelAndView = new ModelAndView("towns/trails/dragonstale/index"); + modelAndView.addObject("landmarksList", landmarksList); + return modelAndView; + } + } + diff --git a/src/main/resources/templates/towns/trails/dragonstale/stylesheet.css b/src/main/resources/static/css/dragonstaless.css similarity index 52% rename from src/main/resources/templates/towns/trails/dragonstale/stylesheet.css rename to src/main/resources/static/css/dragonstaless.css index 32670b4a99e9848541977e77c6f119d7e018991b..69503719953005705fd789f816766664caa2d3d2 100644 --- a/src/main/resources/templates/towns/trails/dragonstale/stylesheet.css +++ b/src/main/resources/static/css/dragonstaless.css @@ -5,5 +5,13 @@ margin-left: auto; margin-right: auto; width: 50%; - background-color: antiquewhite; + background-color: #927BB7; +} + +#homeimg.centre{ + box-shadow: 100px -100px purple; +} + +body{ + background-color: #927BB7; } \ No newline at end of file diff --git a/src/main/resources/templates/towns/trails/dragonstale/trailcheckpoints/one/dragonone.png b/src/main/resources/static/images/trails/dragonone.png similarity index 100% rename from src/main/resources/templates/towns/trails/dragonstale/trailcheckpoints/one/dragonone.png rename to src/main/resources/static/images/trails/dragonone.png diff --git a/src/main/resources/templates/towns/trails/dragonstale/dragonstalehome.png b/src/main/resources/static/images/trails/dragonstalehome.png similarity index 100% rename from src/main/resources/templates/towns/trails/dragonstale/dragonstalehome.png rename to src/main/resources/static/images/trails/dragonstalehome.png diff --git a/src/main/resources/templates/fragments/landmarkFrag.html b/src/main/resources/templates/fragments/landmarkFrag.html new file mode 100644 index 0000000000000000000000000000000000000000..67eaed5a79945996702aa451164c35c318f559d1 --- /dev/null +++ b/src/main/resources/templates/fragments/landmarkFrag.html @@ -0,0 +1,8 @@ +<!-- TODO Develop each individual landmark for DragonsTrail --> +<!-- Each trail should have a preestablished set of landmarks --> + +<div th:fragment="landmarkList" class="centre" id="landmarkList"> + <ul> + <li th:each="item : ${landmarksList}" th:text="${item}"></li> + </ul> +</div> \ No newline at end of file diff --git a/src/main/resources/templates/fragments/landmarkInfoFrag.html b/src/main/resources/templates/fragments/landmarkInfoFrag.html new file mode 100644 index 0000000000000000000000000000000000000000..ef12db2ea01f1d2711213fba997dc8aa8634ad8e --- /dev/null +++ b/src/main/resources/templates/fragments/landmarkInfoFrag.html @@ -0,0 +1,13 @@ +<!-- TODO Develop each individual landmark for DragonsTrail --> +<!-- Each trail should have a preestablished set of landmarks --> + +<div th:fragment="landmarkInfoFrag" class="centre" id="landmarkList"> + <ul> + <li th:replace=""> Landmark 1 </li> + <li> Landmark 2 </li> + <li> Larkmark 3 </li> + <li> Larkmark 4 </li> + <li> Larkmark 5 </li> + <li> Larkmark 6 </li> + </ul> +</div> \ No newline at end of file diff --git a/src/main/resources/templates/towns/trails/dragonstale/index.html b/src/main/resources/templates/towns/trails/dragonstale/index.html index c9202cfdfe91be4b0d095abe1398e3a5f6e74c19..21ef46b042f44eaf03bdb47075245e8d9b6a895d 100644 --- a/src/main/resources/templates/towns/trails/dragonstale/index.html +++ b/src/main/resources/templates/towns/trails/dragonstale/index.html @@ -1,29 +1,47 @@ <!DOCTYPE html> <html lang="en"> -<head> +<html xmlns:th="http://www.thymeleaf.org"> <meta charset="UTF-8"> <title>A Dragon's Tale</title> - <link rel="stylesheet" href="stylesheet.css"> + <link rel="stylesheet" th:href="@{/css/dragonstaless.css}"> + <link rel="stylesheet" th:href="@{/css/templatingstyle.css}"> </head> -<body> - - <div class="centre"> - <h1> Welcome, to a dragon's tale! </h1> - <img src="dragonstalehome.png" alt="Image of a dragon"> - <h2> Discover the mystery of the dragon, track its location and follow it throughout the town of (thymeleaf element) to discover a prize! </h2> - </div> - - <div class="centre"> - <p> - Adventurers... embark through these mystical historical landmarks and scenery, to ultimately discover the lair of the dragon. - Legend has it that within this ominous lair, mighty dragons, guardians of ancient wisdom and treasures untold lay.... - </p> - </div> - - <div class="centre"> - <h3>Begin your hunt!</h3> - <button type="button" id="begin">Click here!</button> - </div> - -</body> + <body> + <header th:insert="towns/Templating.html :: header"></header> + + <div class="centre"> + <h1> Welcome, to a dragon's tale! </h1> + <img th:src="@{/images/trails/dragonstalehome.png}" alt="Image of a dragon" id="homeimg"> + <h2> Discover the mystery of the dragon, track its location and follow it throughout the town of (thymeleaf element) to discover a prize! </h2> + </div> + + <div class="centre"> + <p> + Adventurers... embark through mystical historical landmarks to ultimately discover the lair of the dragon. + Legend has it that within this ominous lair, mighty dragons, guardians of ancient wisdom and treasures untold lay.... + </p> + </div> + + <div class="centre"> + <ul th:each="item : ${landmarksList}"> + <p th:text="${item.landmarkName}"></p> + <p th:text="${item.landmarkDescription}"></p> + </ul> + </div> + + <div class="centre"> + <h3>Begin your hunt!</h3> + <button type="button" id="begin">Click here!</button> + </div> + + <div th:insert="towns/Templating.html :: footer"></div> + + <script> + + document.getElementById("begin").addEventListener("click", function (){ + window.location.href = ("/dragonstale/landmarkone"); + }) + + </script> + </body> </html> \ No newline at end of file diff --git a/src/main/resources/templates/towns/trails/dragonstale/script.js b/src/main/resources/templates/towns/trails/dragonstale/script.js index 6708ae40acad145d586be407af2b29a4bba96eba..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/main/resources/templates/towns/trails/dragonstale/script.js +++ b/src/main/resources/templates/towns/trails/dragonstale/script.js @@ -1,8 +0,0 @@ -function onClick(){ - var beginButton = document.getElementById("begin"); - if (beginButton === true){ - - } - - -} \ No newline at end of file diff --git a/src/main/resources/templates/towns/trails/dragonstale/trailcheckpoints/one/one.html b/src/main/resources/templates/towns/trails/dragonstale/trailcheckpoints/one/one.html deleted file mode 100644 index df1237ce0aeff72a3a2f840bfd1a2ffc39200894..0000000000000000000000000000000000000000 --- a/src/main/resources/templates/towns/trails/dragonstale/trailcheckpoints/one/one.html +++ /dev/null @@ -1,37 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <title>Checkpoint One <filler></title> -</head> -<body> - <!-- constant use of divs used to separate important sections of the website that'll be maintained throughout the project --> - <div> - <h1>Checkpoint one... The Beginning of an adventure!</h1> - </div> - - <div> - <!-- Insert a thymeleaf attribute here to layer this image onto a background of the town--> - <img src="dragonone.png" alt="Image of a Red Dragon"> - </div> - - <div> - <p> Enter a story about the checkpoint here.....</p> - </div> - - <div> - <p> Here goes where the user must go next. Hints, etc. </p> - </div> - - <div> - <p> Greyed out image of something that can be dynamically altered upon scanning QR code.</p> - </div> - - <div> - <p> Here a total progress bar...</p> - </div> - - - -</body> -</html> \ No newline at end of file