Skip to content
Snippets Groups Projects
Commit f63b1bd1 authored by Rhys Nute's avatar Rhys Nute
Browse files

updated

parent f6149996
No related branches found
No related tags found
2 merge requests!38Draft: Businesses,!31Resolve "As a user, I want to see a page of local authorities so that I can easily source contact details for a variety of different local authorities."
...@@ -21,6 +21,7 @@ public class organisationControllers { ...@@ -21,6 +21,7 @@ public class organisationControllers {
public ModelAndView getLocalAuthoritiesPage(){ public ModelAndView getLocalAuthoritiesPage(){
ModelAndView mav = new ModelAndView("local-authorities"); ModelAndView mav = new ModelAndView("local-authorities");
List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority(); List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority();
mav.addObject("localAuth", localAuthority);
return mav; return mav;
} }
@GetMapping("/localForm") @GetMapping("/localForm")
...@@ -33,6 +34,7 @@ public class organisationControllers { ...@@ -33,6 +34,7 @@ public class organisationControllers {
private localAuthorityRepository localAuthorityRepository; private localAuthorityRepository localAuthorityRepository;
@PostMapping("/local-auth-data") @PostMapping("/local-auth-data")
public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) { public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
List<localAuthority> localAuthorityList = localAuthorityRepository.getAllLocalAuthority();
if (bindingResult.hasErrors()){ if (bindingResult.hasErrors()){
ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap()); ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap());
return modelAndView; return modelAndView;
......
...@@ -19,15 +19,15 @@ public class localAuthority { ...@@ -19,15 +19,15 @@ public class localAuthority {
private URL website; private URL website;
@Override @Override
public String toString() { public String toString() {
return "localAuthority" + return "Local Authority:" + " " +
localAuthorityName + '\'' + localAuthorityName + '\'' + " " +
address1 + '\'' + address1 + '\'' + " " +
address2 + '\'' + address2 + '\'' + " " +
city + '\'' + city + '\'' + " " +
county + '\'' + county + '\'' + " " +
postcode + '\'' + postcode + '\'' + " " +
website + website +
'.'; " ";
} }
public String getLocalAuthorityName() { public String getLocalAuthorityName() {
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
<body> <body>
<h1>Local Authorities</h1> <h1>Local Authorities</h1>
<div id="councils"> <div id="councils">
<ul th:each="localAuthority:${localAuthority}"> <ul th:each="local:${localAuth}">
<li th:text="${localAuthority}"></li> <li th:text="${local}"></li>
</ul> </ul>
</div> </div>
<a href="/localForm" id="authority"><button>Local Authorities please enter here</a></button> <button><a href="/localForm" id="authority">Local Authorities please enter here</a></button>
<footer th:insert="~{/towns/Templating.html::footer}"></footer> <footer th:insert="~{/towns/Templating.html::footer}"></footer>
</body> </body>
</html> </html>
\ No newline at end of file
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