diff --git a/build.gradle b/build.gradle index 57fb1434879e743256de069ce00e844c2c4dc68f..8d359787ce8628dbb4933c80c53d4a6d91fad470 100644 --- a/build.gradle +++ b/build.gradle @@ -24,14 +24,15 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-jdbc' + implementation 'org.mariadb.jdbc:mariadb-java-client:2.1.2' + compileOnly 'org.projectlombok:lombok' testImplementation 'org.projectlombok:lombok:1.18.28' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.springframework.boot:spring-boot-starter-validation' -// implementation 'org.springframework.boot:spring-boot-starter-jdbc' -// implementation 'org.mariadb.jdbc:mariadb-java-client:2.1.2' } tasks.named('bootBuildImage') { diff --git a/identifier.sqlite b/identifier.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/java/Team5.Smarttowns/Data/Towns.db b/src/main/java/Team5.Smarttowns/Data/Towns.db new file mode 100644 index 0000000000000000000000000000000000000000..2532550d9acf4d8abc21a6e6ed89629908b72a3e Binary files /dev/null and b/src/main/java/Team5.Smarttowns/Data/Towns.db differ diff --git a/src/main/java/Team5/SmartTowns/Data/DatabaseController.java b/src/main/java/Team5/SmartTowns/Data/DatabaseController.java new file mode 100644 index 0000000000000000000000000000000000000000..b91d7d880368f6cb405e3ed71c38242f612bfae2 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/DatabaseController.java @@ -0,0 +1,40 @@ +package Team5.SmartTowns.Data; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +import java.util.*; +@Controller +public class DatabaseController { + + @Autowired + private UserRepository userRepository; + @Autowired + private locationRepository locationRepository; + @Autowired + private trailsRepository trailsRepository; + + @GetMapping("/userList") + public ModelAndView userList() { + ModelAndView mav = new ModelAndView("towns/userData"); + List<user> users = userRepository.getAllUsers(); + mav.addObject("users", users); + return mav; + } + @GetMapping("/trailList") + public ModelAndView trailList() { + ModelAndView mav1 = new ModelAndView("towns/trailsData"); + List<trail> trail = trailsRepository.getAllTrails(); + mav1.addObject("trails", trail); + return mav1; + } + @GetMapping("locationList") + public ModelAndView locationList(){ + ModelAndView mav2 = new ModelAndView("towns/locationData"); + List<location> locations = locationRepository.getAllLocation(); + mav2.addObject("location", locations); + return mav2; + } +} diff --git a/src/main/java/Team5/SmartTowns/Data/UserRepository.java b/src/main/java/Team5/SmartTowns/Data/UserRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..172591d6500927a341d6534dca6c34728965db06 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/UserRepository.java @@ -0,0 +1,8 @@ +//Holds users data repository +package Team5.SmartTowns.Data; + +import java.util.List; + +public interface UserRepository { + List<user> getAllUsers(); +} diff --git a/src/main/java/Team5/SmartTowns/Data/UserRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/Data/UserRepositoryJDBC.java new file mode 100644 index 0000000000000000000000000000000000000000..63e0bad0a8a3abf5f09c435a749066f51f7100fc --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/UserRepositoryJDBC.java @@ -0,0 +1,36 @@ +//Implements the users repository using JDBC +package Team5.SmartTowns.Data; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class UserRepositoryJDBC implements UserRepository{ + + private JdbcTemplate jdbc; + private RowMapper<user> userMapper; + + public UserRepositoryJDBC(JdbcTemplate aJdbc){ + this.jdbc = aJdbc; + setuserMapper(); + } + + + private void setuserMapper(){ + userMapper = (rs, i) -> new user( + rs.getInt("userID"), + rs.getString("name") + ); + } + + + + @Override + public List<user> getAllUsers(){ + String sql= "SELECT * FROM users"; + return jdbc.query(sql, userMapper); + } +} diff --git a/src/main/java/Team5/SmartTowns/Data/location.java b/src/main/java/Team5/SmartTowns/Data/location.java new file mode 100644 index 0000000000000000000000000000000000000000..f74adb71039eb1a254e379e56a16ca16d7e3cf32 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/location.java @@ -0,0 +1,12 @@ +//Holds variable data for the locations table +package Team5.SmartTowns.Data; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class location { + private int locationID; + private String name; +} diff --git a/src/main/java/Team5/SmartTowns/Data/locationRepository.java b/src/main/java/Team5/SmartTowns/Data/locationRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..772f335edeb43376b96a4a2045ceddbbb8bf9690 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/locationRepository.java @@ -0,0 +1,10 @@ +//Holds locations data repository +package Team5.SmartTowns.Data; + +import java.util.List; + +public interface locationRepository { + List<location> getAllLocation(); + + +} diff --git a/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java new file mode 100644 index 0000000000000000000000000000000000000000..b11671ee54d102354431f6917b297ba179f388d9 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java @@ -0,0 +1,29 @@ +//Implements the locations repository using JDBC +package Team5.SmartTowns.Data; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class locationRepositoryJDBC implements locationRepository { + private JdbcTemplate jdbc; + private RowMapper<location> locationMapper; + + public locationRepositoryJDBC(JdbcTemplate aJdbc) { + this.jdbc = aJdbc; + setlocationMapper(); + } + private void setlocationMapper(){ + locationMapper = (rs, i) -> new location( + rs.getInt("locationID"), + rs.getString("name") + ); + } + public List<location> getAllLocation(){ + String sql= "SELECT * FROM locations"; + return jdbc.query(sql, locationMapper); + } +} diff --git a/src/main/java/Team5/SmartTowns/Data/trail.java b/src/main/java/Team5/SmartTowns/Data/trail.java new file mode 100644 index 0000000000000000000000000000000000000000..86e78b96712ecf7a5756edbf20a4bae35839ca70 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/trail.java @@ -0,0 +1,12 @@ +//Holds variable data for the trails table +package Team5.SmartTowns.Data; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class trail { + private int trailsId; + private String name; +} diff --git a/src/main/java/Team5/SmartTowns/Data/trailsRepository.java b/src/main/java/Team5/SmartTowns/Data/trailsRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..52d8dc39b9bda0a7390f06afca8769a5fd0607a9 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/trailsRepository.java @@ -0,0 +1,8 @@ +//Holds trails data repository +package Team5.SmartTowns.Data; + +import java.util.List; + +public interface trailsRepository { + List<trail> getAllTrails(); +} diff --git a/src/main/java/Team5/SmartTowns/Data/trailsRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/Data/trailsRepositoryJDBC.java new file mode 100644 index 0000000000000000000000000000000000000000..58aa84a95b00b8f8b5d7f97d240e04f405d2ac3b --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/trailsRepositoryJDBC.java @@ -0,0 +1,28 @@ +//Implements the trails repository using JDBC +package Team5.SmartTowns.Data; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class trailsRepositoryJDBC implements trailsRepository{ + private JdbcTemplate jdbc; + private RowMapper<trail> trailMapper; + public trailsRepositoryJDBC(JdbcTemplate aJdbc){ + this.jdbc = aJdbc; + settrailsMapper(); + } + private void settrailsMapper(){ + trailMapper = (rs, i) -> new trail( + rs.getInt("trailID"), + rs.getString("name") + ); + } + public List<trail> getAllTrails(){ + String sql= "SELECT * FROM trails"; + return jdbc.query(sql, trailMapper); + } +} diff --git a/src/main/java/Team5/SmartTowns/Data/user.java b/src/main/java/Team5/SmartTowns/Data/user.java new file mode 100644 index 0000000000000000000000000000000000000000..a40350ebc13621da4fb8a89f4e58d2ccb5be2568 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/user.java @@ -0,0 +1,12 @@ +//Holds variable data for the users table +package Team5.SmartTowns.Data; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class user { + private int userId; + private String name; +} 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 1330e8e529dcce380e0feb27eaffd34d3111ee5a..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 81a8298177efc622eafff53e297eda6600cf5dd1..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", "EDITING THIS") + 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/QRCodeScanner.html b/src/main/resources/QRCodeScanner.html new file mode 100644 index 0000000000000000000000000000000000000000..11da0658b1421e28159c97fc5abae82030ff3630 --- /dev/null +++ b/src/main/resources/QRCodeScanner.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>QR Camera</title> +</head> +<body> + +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b137891791fe96927ad78e64b0aad7bded08bdc..95f46c69ab2c6b38e1c520a5b8438c8f87aba0a3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,5 @@ +spring.datasource.url=jdbc:mariadb://localhost:3306/towns +spring.datasource.username=root +spring.datasource.password=comsc +spring.sql.init.mode=always diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000000000000000000000000000000000000..f7656769c7d1b2afd5e78e3a93c3cd3ed44abe3b --- /dev/null +++ b/src/main/resources/data.sql @@ -0,0 +1,11 @@ +delete from users; +insert into users (userID, Name) value ('1', 'Hannah'); +insert into users (userID, Name) value ('2', 'Nigel'); + +delete from trails; +insert into trails (trailID, Name) value ('1', 'Caerphilly Coffee Trail'); +insert into trails (trailID, Name) value ('2', 'Penarth Dragon Trail'); + +delete from locations; +insert into locations (locationID, Name) value ('1', 'Caerphilly'); +insert into locations (locationID, Name) value ('2', 'Penarth'); \ No newline at end of file diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql new file mode 100644 index 0000000000000000000000000000000000000000..8d9e102d1f6b02b1f864e396f591a4a61aad8b41 --- /dev/null +++ b/src/main/resources/schema.sql @@ -0,0 +1,18 @@ +drop table if exists trails; +create table if not exists trails +( + trailID bigint auto_increment primary key, + name varchar(128) +) engine=InnoDB; +drop table if exists locations; +create table if not exists locations +( + locationID bigint auto_increment primary key, + name varchar(128) +) engine=InnoDB; +drop table if exists users; +create table if not exists users +( + userID bigint auto_increment primary key, + name varchar(128) +) engine=InnoDB; \ No newline at end of file diff --git a/src/main/resources/static/css/allTrails.css b/src/main/resources/static/css/allTrails.css index 1b441111518afb14cea3c1d1debe553ad32d941f..ab706c5ba8ee5925faf8c774e1ec8711ffab4674 100644 --- a/src/main/resources/static/css/allTrails.css +++ b/src/main/resources/static/css/allTrails.css @@ -4,37 +4,40 @@ body { background-color: rgb(41, 41, 41); margin: 0; + display: flex; + flex-direction: column; + min-height: 100svh; } main { } + .centerFlex { display: flex; justify-content: center; } #allTrailsBar { - padding:0; - max-width: 80%; - height: 11svh; - margin: 1svh auto; + width: 100%; + height: auto; + /*margin: 1svh auto;*/ + padding: 0 5svh; display: flex; - justify-content: space-between; - /*border-bottom: solid grey 2px;*/ - /*border-top: solid grey 4px;*/ + flex-wrap: wrap; + justify-content: space-evenly; } .trailsImages { - margin: auto; - height: 10svh; - width: 10svh; + margin: 1svh auto; + height: 12svh; + width: auto; border-radius: 20px; border: solid grey 2px; transition: 0.5s ease-out 100ms; - + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.85); } + .trailsImages:hover { box-shadow: 0 0 20px 10px #bbbb00; transform: scale(1.2,1.2); - !important; overflow: visible; } .selected { @@ -49,10 +52,8 @@ main { } #trailInfoContainer { - margin: auto; - width: 95svw; - min-height: 40svh; - min-width: 30svw; + + overflow: scroll; } .trailInfoFrag { @@ -60,62 +61,74 @@ main { border: #000000 solid 2px; border-radius: 10px; box-shadow: 0 5px 20px 0 #000000; - margin:0; - padding:0; + margin: 2svh auto; + padding-bottom: 2svw; + width: 70vw; + height: auto; + min-height: 30svh; animation: fadeIn 3s; - overflow: hidden; - display: flex; - flex-direction: column; - min-width: 30svh; - & h1 { - color: white; + display: grid; + grid-template-areas: + "header header header" + "image text text"; + grid-template-columns: 30% 30% auto; + grid-template-rows: 10% auto; + grid-column-gap: 2vw; + grid-row-gap: 2svh; + & .trailInfoHeader { grid-area: header; - margin: 10px 25%; - font-size: xx-large; - text-align: center; - border-bottom: #1e1e1e solid 2px; - } -} + width: 100%; + height: 100%; + margin-top: 1svh; + padding: 0; + & h1 { + color: white; + padding:0; + margin:0 25%; + font-size: 2vw; + text-align: center; + box-shadow: 0 10px 10px -10px black; + } -#trailFragContent { - margin: 0; - padding: 0; - display: flex; - overflow: hidden; - min-height: 40svh; - max-height: 60svh; + } & img { + grid-area: image; border-radius: 10px; border: black solid 1px; - margin: 1%; - flex: 1 1; - - min-width: 20%; - max-width: 40%; - min-height: 20svh; - max-height: 90%; - overflow: hidden; + margin-left: 2vw; + margin-right: 2vw; + width: 100%; + height: auto; + box-shadow: 0 10px 20px -10px black; } & p { + grid-area: text; color: white; - flex: 1 1; - padding: 5%; - width: 60%; - border-left: solid darkgrey 2px; - font-size: x-large; + margin: 0; + padding: 0 2vw; + font-size: 1.3vw; text-align: justify; text-justify: inter-character; line-height: 1.5; + width: fit-content; + height: fit-content; + overflow: scroll; + } } +#trailFragContent { + margin: 0; + padding: 0; + display: flex; + min-height: 40svh; + flex-wrap: wrap; + +} + header { box-shadow: #1e1e1e 0 0 10px 10px; + font-size: 1vw; } - -footer { - position: relative; - bottom: 0; -} \ No newline at end of file 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/static/css/templatingstyle.css b/src/main/resources/static/css/templatingstyle.css index 7f975776b3acca318e9eee9d1e30d7bde4ea09d9..1ffc84d486810f03102e4a7534aa5d088c97bab0 100644 --- a/src/main/resources/static/css/templatingstyle.css +++ b/src/main/resources/static/css/templatingstyle.css @@ -3,13 +3,11 @@ border-bottom: 2px rgb(230, 230, 230) solid; margin-bottom: 20px; display: flex; - background: blueviolet; + background-color: rgb(84, 33, 128); } /* Navbar Links */ .navBar { - margin-top: 50px; - margin-left: auto; - margin-right:20px; + margin: 2svh 1vw 2svh auto; text-align: right; } .work{ @@ -61,15 +59,18 @@ /* Footer */ footer { - margin-top:20px; + margin-top:auto; display: flex; justify-content: center; + background-color: rgb(84, 33, 128); + border-top: 2px rgb(230, 230, 230) solid; + font-size: 1vw; } .footerBar{ - border-top: 2px rgb(230, 230, 230) solid; + text-align: left; display: flex; - background: blueviolet; + color: rgb(255, 255, 255); padding-left: 30px; } diff --git a/src/main/resources/static/images/Facebook.png b/src/main/resources/static/images/Facebook.png index 259359777e3e7c2ea4f31e00df81dbf075570f84..e510c31874240120ec7ce84676f8a486bbc86923 100644 Binary files a/src/main/resources/static/images/Facebook.png and b/src/main/resources/static/images/Facebook.png differ diff --git a/src/main/resources/static/images/Instagram.jpg b/src/main/resources/static/images/Instagram.jpg index 0c7f47366beef8b56464e6214276ab46e2c8ab66..59e94d4c36bac36d4cdc346293568721a23d0082 100644 Binary files a/src/main/resources/static/images/Instagram.jpg and b/src/main/resources/static/images/Instagram.jpg differ diff --git a/src/main/resources/static/images/LinkedIn.jpg b/src/main/resources/static/images/LinkedIn.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6bf094d20c89883756ec5a105ec2cea1f9eeaf76 Binary files /dev/null and b/src/main/resources/static/images/LinkedIn.jpg differ diff --git "a/src/main/resources/static/images/Twitter-Log\320\276.png" "b/src/main/resources/static/images/Twitter-Log\320\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..c475939bfacb4be3559aab3d58a9a5eadf036afb Binary files /dev/null and "b/src/main/resources/static/images/Twitter-Log\320\276.png" differ 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/static/images/trails/trail2.jpg b/src/main/resources/static/images/trails/trail2.jpg index 31e14eae5ac6e1132c33b7161dc2bc5e30c90dcf..683d275abb6772456d55082eb4940d0e606bf5f6 100644 Binary files a/src/main/resources/static/images/trails/trail2.jpg and b/src/main/resources/static/images/trails/trail2.jpg differ diff --git a/src/main/resources/static/images/trails/trail3.jpg b/src/main/resources/static/images/trails/trail3.jpg index 84763490556a7e758d2d56e8b649e051bd7a770d..f02b15249a3f0e2158023b8a98c8bf67fcc272c8 100644 Binary files a/src/main/resources/static/images/trails/trail3.jpg and b/src/main/resources/static/images/trails/trail3.jpg differ diff --git a/src/main/resources/static/images/trails/trail4.jpg b/src/main/resources/static/images/trails/trail4.jpg index c2b43e3a3488a4b4c7105948c4a9903bd15915e0..c8c405e4f332a4f9b495c98ecbac7988b2b27cda 100644 Binary files a/src/main/resources/static/images/trails/trail4.jpg and b/src/main/resources/static/images/trails/trail4.jpg differ diff --git a/src/main/resources/static/images/trails/trailNotFound.jpg b/src/main/resources/static/images/trails/trailNotFound.jpg index dc106d5033650fe232b4f01d8914a163c4462c75..9fd46288f31cf61cbce2d58244e69b908cf727c1 100644 Binary files a/src/main/resources/static/images/trails/trailNotFound.jpg and b/src/main/resources/static/images/trails/trailNotFound.jpg differ diff --git a/src/main/resources/static/scripts/allTrails.js b/src/main/resources/static/scripts/allTrails.js index 0e5132a7453bee04a1eed08dbcdb5401a68b72f7..e62cd3bbedf582442bf20874e9f877949935db0d 100644 --- a/src/main/resources/static/scripts/allTrails.js +++ b/src/main/resources/static/scripts/allTrails.js @@ -1,7 +1,7 @@ function updateOutputTrail(id) { /* Updates the trail being shown on screen to the one requested by ID */ $.get("/allTrails/" + id).done(function (fragment) { - $("#trailInfoContainer").html(fragment) + $(".trailInfoFrag").replaceWith(fragment); }); updateSelectedTrail(id); } diff --git a/src/main/resources/static/users.html b/src/main/resources/static/users.html new file mode 100644 index 0000000000000000000000000000000000000000..566549bdf8fae810809c1a81066000687cb338f6 --- /dev/null +++ b/src/main/resources/static/users.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/allTrails/allTrails.html b/src/main/resources/templates/allTrails/allTrails.html index 669020d15507bfcaeb8ca959df108269222ba8ec..746762b68f64b62190bf71e102edf0ff309772d9 100644 --- a/src/main/resources/templates/allTrails/allTrails.html +++ b/src/main/resources/templates/allTrails/allTrails.html @@ -2,6 +2,7 @@ <html lang="en"> <head> <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>All Trails</title> <link rel="stylesheet" th:href="@{css/allTrails.css}"> <link rel="stylesheet" th:href="@{css/templatingstyle.css}"> @@ -21,9 +22,12 @@ > </section> - <section id="trailInfoContainer"> - <h1 class="centerFlex">Please select your trail</h1> - <!--Loaded from thymeleaf--> + <section id="trailInfoContainer" class="trailInfoFrag"> + <!--All this section is loaded from thymeleaf, based on what tail is selected + in the #allTrailsBar --> + <div class="trailInfoHeader"> + <h1 class="centerFlex">Please select your trail</h1> + </div> </section> </main> diff --git a/src/main/resources/templates/fragments/allTrailsFrags.html b/src/main/resources/templates/fragments/allTrailsFrags.html index fc4da1492b07e6d7f3004a95554aeae13cf58bcb..7f7f41dba9f99ce028118a4b4da502a6039d6f2d 100644 --- a/src/main/resources/templates/fragments/allTrailsFrags.html +++ b/src/main/resources/templates/fragments/allTrailsFrags.html @@ -1,11 +1,7 @@ <article th:fragment="trailSection" class="trailInfoFrag"> - <h1 th:text="${trail.getName()}"></h1> - - <div id="trailFragContent"> - <img th:src="@{${trail.getImgPath()}}" th:alt="${trail.getName()} "> - <p th:text="${trail.getDescription()}"></p> + <div class="trailInfoHeader"> + <h1 th:text="${trail.getName()}"></h1> </div> - - - <!--TODO add more to this fragment and then add styling to it--> + <img th:src="@{${trail.getImgPath()}}" th:alt="${trail.getName()} "> + <p id="trailDesc" th:text="${trail.getDescription()}"></p> </article> 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/UserData.html b/src/main/resources/templates/towns/UserData.html new file mode 100644 index 0000000000000000000000000000000000000000..3545df540058819df3883482d36f916407e449c8 --- /dev/null +++ b/src/main/resources/templates/towns/UserData.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>User Information</title> +</head> +<body> +<div> + <ul th:each="user:${users}"> + <li th:text="${user}"></li> + </ul> +</div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/towns/locationData.html b/src/main/resources/templates/towns/locationData.html new file mode 100644 index 0000000000000000000000000000000000000000..f7636f05a3a0dbfc2ed2e87a8964f637b5e91046 --- /dev/null +++ b/src/main/resources/templates/towns/locationData.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Location Data</title> +</head> +<body> +<div> + <ul th:each="locations:${location}"> + <li th:text="${locations}"></li> + </ul> +</div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/towns/templates.server/Templating.html b/src/main/resources/templates/towns/templates.server/Templating.html new file mode 100644 index 0000000000000000000000000000000000000000..14343a76ea3cc2974dbdd50cc7bd3ade124adc17 --- /dev/null +++ b/src/main/resources/templates/towns/templates.server/Templating.html @@ -0,0 +1,149 @@ +<header class="headerBar th:fragment="header"> + + <div class="Logo"> + <img th:src="@{images/VZTA.png}" alt="VZTA Logo"> + </div> + <nav class="navBar"> + <ul> + <li>Home</li> + <li>FAQs</li> + <li>Contact us</li> + </ul> + <label class="work">Who we Work with:</label> + <select> + <ul> + <option value="localauthorities">Local Authorities</option> + <option value="towns">Towns</option> + <option value="businesses">Businesses</option> + <option value="consumers">Consumers</option> + </ul> + </select> + </nav> + </header> + + <div class="footerBar" th:fragment="footer"> + <div class="containerFooter"> + <div class="leftFooter"> + <h3>VZTA</h3> + Near Me Now LTD + <br>Britania House + <br>Caerphilly Business Park + <br>Caerphilly + <br>CF83 3GG + </div> + <div class="rightFooter"> + <h3>Connect with us</h3> + <p>Be the first to know about updates by joining out Community page</p> + (C) VZTA 2022<br> + Policy Terms and Conditions + </div> + <div class="centerFooter"> + <span class="footerText"> + <h3>Follow Us</h3> + <a th:href=="https://www.facebook.com/VZTAsmarttowns/" class="icon"></a><img th:src="@{images/Facebook.png}" alt="Facebook Logo" class="picture"> + <a th:href=="https://www.twitter.com/VZTAsmarttowns/" class="icon"></a><img th:src="@{images/Twitter-Logo.png}" alt="X (formally Twitter) Logo" class="picture"> + <a th:href=="https://www.instagram.com/vztasmarttowns/" class="icon"></a><img th:src="@{images/Instagram.jpg}" alt="Instagram Logo" class="picture"> + <a th:href=="https://'www.linkin.com/company/vztasmarttowns/" class="icon"></a><img th:src="@{images/LinkedIn.jpg}" alt="Linkedin Logo" class="picture"> <br> + </span> + </div> + <div class="copyright" style="text-align: left"> + + </div> + </div> + </div> +</div> +<style> + /* Header */ + .headerBar { + border-bottom: 2px rgb(230, 230, 230) solid; + margin-bottom: 20px; + display: flex; + background: blueviolet; + } + /* Navbar Links */ + .navBar { + margin-top: 50px; + margin-left: auto; + margin-right:20px; + text-align: right; + } + .work{ + color: rgb(255, 255, 255); + } + .navBar ul { + list-style: none; + display: flex; + margin-left: 100px; + } + .navBar a { + border-left: 2px rgb(185, 185, 185) solid; + padding: 10px 40px; + text-decoration: none; + color:rgb(87, 86, 86); + white-space: nowrap; + overflow: hidden; + float: right; + } + .navBar a:hover { + background-color: rgb(209, 209, 209); + } + .navBar li{ + margin-left: 10px; + margin-right: 10px; + color: rgb(255, 255, 255); + } + .navListLast { + border-right: 2px rgb(185, 185, 185) solid; + margin-right:40px; + } + + /* Navbar Logo */ + .Logo { + margin-left:10px; + padding: 20px; + width: fit-content; + } + .Logo img { + width: 120px; + margin-left:15px; + } + + /* Footer */ + footer { + margin-top:20px; + display: flex; + justify-content: center; + } + .footerBar{ + border-top: 2px rgb(230, 230, 230) solid; + text-align: left; + display: flex; + background: blueviolet; + color: rgb(255, 255, 255); + padding-left: 30px; + } + .footerBar ul { + list-style: none; + display: flex; + } + .copyright{ + text-align: left; + display: flex; + } + .containerFooter{ + display: flex; + flex-direction: row; + } + .leftFooter{ + flex:1; + color: rgb(255, 255,255); + } + .centerFooter{ + flex: 1; + color: rgb(255, 255,255); + } + .rightFooter{ + flex:1; + color: rgb(255, 255, 255); + } +</style> \ 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 diff --git a/src/main/resources/templates/towns/trailsData.html b/src/main/resources/templates/towns/trailsData.html new file mode 100644 index 0000000000000000000000000000000000000000..eed9252284628bd058083f4f1cb13878b71f5b2f --- /dev/null +++ b/src/main/resources/templates/towns/trailsData.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Trails Information</title> +</head> +<body> +<div> + <ul th:each="trail:${trails}"> + <li th:text="${trail}"></li> + </ul> +</div> +</body> +</html> \ No newline at end of file