Skip to content
Snippets Groups Projects
Commit 3178ae6b authored by John Watkins's avatar John Watkins
Browse files

tags load from db

parent 6a0f520b
No related branches found
No related tags found
4 merge requests!56tags will be saved to userFavTags table (needs user ID of current logged in user),!22Branch Update,!19created signUp page and form that sends data to controller,!18Finished issueThree
...@@ -17,6 +17,7 @@ public class HomeController { ...@@ -17,6 +17,7 @@ public class HomeController {
public String index(Model model){ public String index(Model model){
System.out.println(shopsRepo.findAll()); System.out.println(shopsRepo.findAll());
model.addAttribute("shops", shopsRepo.findAll()); model.addAttribute("shops", shopsRepo.findAll());
model.addAttribute("tags", new String[]{"Coffee", "Vegan", "Sustainable"});
return "index"; return "index";
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<title>Title</title> <title>Title</title>
</head> </head>
<body th:fragment="tag"> <body th:fragment="tag">
<div class="control"> <div class="control mr-3">
<div class="tags has-addons"> <div class="tags has-addons">
<span class="tag gradient" th:text="${text}"></span> <span class="tag gradient" th:text="${text}"></span>
<a class="tag is-delete"></a> <a class="tag is-delete"></a>
......
...@@ -60,17 +60,15 @@ ...@@ -60,17 +60,15 @@
</div> </div>
<!--Tags--> <!--Tags-->
<div class="field is-grouped is-grouped-multiline" style="width: 60%;"> <div class="field is-grouped is-grouped-multiline" style="width: 60%;">
<div th:replace="fragments/tag.html :: tag(text='Test')"></div> <div th:each="tag: ${tags}" th:include="fragments/tag.html :: tag"
<div th:replace="fragments/tag.html :: tag(text='Vegan')"></div> th:with="text=${tag}"></div>
<div th:replace="fragments/tag.html :: tag(text='Food')"></div>
<div th:replace="fragments/tag.html :: tag(text='John')"></div>
</div> </div>
</div> </div>
<div class="container is-full-width is-flex is-justify-content-center is-align-items-center is-flex-wrap-wrap"> <div class="container is-full-width is-flex is-justify-content-center is-align-items-center is-flex-wrap-wrap">
<div th:each="shop: ${shops}" th:include="fragments/business_card.html :: business_card" <div th:each="shop,i: ${shops}" th:include="fragments/business_card.html :: business_card"
th:with="title=${shop.shopName}, reward_text='Free coffee at 6 stamps', reward_amount=4, th:with="title=${shop.shopName}, reward_text='Free coffee at 6 stamps', reward_amount=4,
img_path='imgs/coffee.jpg'"></div> img_path=${shop.shopImage}"></div>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment