Skip to content
Snippets Groups Projects
Commit b938dd7c authored by Rhys Evans's avatar Rhys Evans
Browse files

Rough final story-product of dynamic page showing a list of checkpoints per trail

parent a4c6c1f0
No related branches found
No related tags found
1 merge request!40Resolve "As a user I would like to see a map containing all landmarks for a trail and a suggested path between them, so that I can easily follow the trail"
......@@ -67,12 +67,9 @@ public class PlacesController {
locationID= i;
break;
} workAroundID++;
}System.out.println(locationCoordsWorkaround);
System.out.println("ag"+locationID);
}
ModelAndView modelAndView= new ModelAndView("fragments/locationPageFrags :: locationSection");
System.out.println("ag"+locationID);
modelAndView.addObject("locCoord", locCoords.get(locationID));
System.out.println("sd"+workAroundID);
modelAndView.addObject("location", locationCoordsWorkaround.get(locationID));
return modelAndView;
}
......@@ -113,40 +110,44 @@ public class PlacesController {
List<Trail> trailslocations = trailsRepo.getAllTrails();
List<Integer> locationIDIndex = new ArrayList<Integer>();
List<Location> locationCoordsWorkaround = new ArrayList<Location>();
int locationID = 999;
int trailID = 999;
int workAroundID=0;// otherwise cases errors e.g. null used. 999 unlikely to be used so safe until then
for (int i=0;i<trailslocations.size();i++){ /// for loop iterating over coordinates table need to match coordinate index with location index manually
locationIDIndex.add(trailslocations.get(i).getLocationID()-1); // gets location ID and therefore location list index number
locationCoordsWorkaround.add(locations.get(trailslocations.get(i).getLocationID()-1));
if ( (locations.get(trailslocations.get(i).getLocationID() - 1).getLocationName().replace(' ', '-').trim().equals(location)) ){
locationID= i;
break;
} workAroundID++;
}System.out.println(locationCoordsWorkaround);
ModelAndView modelAndView= new ModelAndView("fragments/locationPageFrags :: locationSection");
modelAndView.addObject("locCoord", locCoords.get(locationID));
modelAndView.addObject("location", locationCoordsWorkaround.get(locationID));
modelAndView.addObject("trails", trailslocations);
List<Trail> trailslocations = trailsRepo.getAllTrails();
List<Location> locations = locationRepo.getAllLocation();
List<LocationsCoordinates> locCoords = placeRepo.getAllLocationCoords();
List<Integer> locationIDIndex = new ArrayList<Integer>();
List<Location> locationCoordsWorkaround = new ArrayList<Location>();
for (LocationsCoordinates coord: locCoords){
locationIDIndex.add(coord.getLocationID()-1);
locationCoordsWorkaround.add(locations.get(coord.getLocationID()-1));
}
modelAndView.addObject("trails", trailslocations);
for (int i=0;i<trailslocations.size();i++){
System.out.println(trail);
System.out.println(i);
System.out.println(trailslocations.get(i).getTrailName());
System.out.println(trailslocations.get(i).getTrailName().replace(' ', '-').trim());
if (trailslocations.get(i).getTrailName().replace(' ', '-').trim().equals(trail)){
trailID=i;
break;}
}
ModelAndView modelAndView= new ModelAndView("fragments/trailsPageFrags :: trailsSection");
modelAndView.addObject("trail", trailslocations.get(trailID));
modelAndView.addObject("locCoords", locCoords);
modelAndView.addObject("locations", locationCoordsWorkaround);
modelAndView.addObject("locationCoords", locCoords);
return modelAndView;
// List<Trail> trailslocations = trailsRepo.getAllTrails();
// List<Location> locations = locationRepo.getAllLocation();
// List<LocationsCoordinates> locCoords = placeRepo.getAllLocationCoords();
// List<Integer> locationIDIndex = new ArrayList<Integer>();
// List<Location> locationCoordsWorkaround = new ArrayList<Location>();
// for (LocationsCoordinates coord: locCoords){
// locationIDIndex.add(coord.getLocationID()-1);
// locationCoordsWorkaround.add(locations.get(coord.getLocationID()-1));
// }
// modelAndView.addObject("trails", trailslocations);
// modelAndView.addObject("locations", locationCoordsWorkaround);
// modelAndView.addObject("locationCoords", locCoords);
// return modelAndView;
}
}
.trailsFragment{
background-color: rgb(206, 153, 253);
color: black;
border-color: white;
align-content: center;
text-align: center;
border-radius: 25px;
max-width: 800px;
margin: 0 auto;
}
.trailsPageFrag{
background: rgb(41, 41, 41);
color: wheat;
}
iframe{
margin-top: 20px;
margin-bottom: 20px;
border: white 2px solid;
}
H1{
padding-top: 15px;
padding-bottom:3px ;
margin-bottom: 0;
}
#trailHeader{
margin: 0;
padding: 0;
}
#checkpointList{
list-style: none;
padding-bottom: 10px;
}
\ No newline at end of file
......@@ -5,41 +5,9 @@
<title th:text="${trail.getTrailName()}"></title>
<link rel="stylesheet" th:href="@{/css/templatingstyle.css}">
<!-- <link rel="stylesheet" th:href="@{/css/locationPageFragsStyle.css}">-->
<style>
.trailsFragment{
background-color: rgb(206, 153, 253);
color: black;
border-color: white;
align-content: center;
text-align: center;
border-radius: 25px;
max-width: 800px;
margin: 0 auto;
}
.trailsPageFrag{
background: rgb(41, 41, 41);
color: wheat;
}
iframe{
margin-top: 20px;
margin-bottom: 60px;
border: white 2px solid;
}
H1{
padding-top: 5px;
padding-bottom:3px ;
margin-bottom: 0;
}
#trailHeader{
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" th:href="@{/css/trailsPageFragsStyle.css}">
</head>
<body >
<header th:insert="~{/fragments/Templating.html::header}"></header>
......@@ -71,7 +39,7 @@
scrolling="yes"
marginheight="0"
marginwidth="0"
th:src="'https://www.google.com/maps/dir/51.57239,-3.21992/51.57230,-3.21938//@11z'">
th:src="'https://www.google.com/maps/dir/51.57239,-3.21992/51.57230,-3.21938//@&hl=en&z=20&amp;output=embed'">
</iframe>
</div>
......@@ -113,10 +81,10 @@
</div>
<H3>Checkpoints:</H3>
<!-- With the trial name, we go through locations list to get -->
<div th:each="locationCoord, indexValue:${locationCoords}" >
<div th:each="locationCoord, indexValue:${locCoords}" >
<div th:if="${locations[indexValue.index].getLocationTrailID()==trail.getTrailsId()}">
<li style="list-style: none">
<a th:href="'/checkpoints/'+${locations[indexValue.index].getLocationName().replace(' ', '-')}" th:text="${locations[indexValue2.index].getLocationName()}"></a>
<li id="checkpointList">
<a th:href="'/checkpoints/'+${locations[indexValue.index].getLocationName().replace(' ', '-')}" th:text="${locations[indexValue.index].getLocationName()}"></a>
<ul></ul>
</li>
......@@ -131,8 +99,10 @@
</div>
<hr style="height:40px; visibility:hidden;" />
</article>
<hr style="height:40px; visibility:hidden;" />
</main>
<footer th:insert="~{/fragments/Templating.html::footer}"></footer>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment