genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0

[Task]: edit the monolith

Replace these files in the monolith and type url/admin, you will be
redirected to the stock admin front end
This commit is contained in:
mlabusch 2017-05-03 15:53:32 +02:00
parent 45d76a8b34
commit b73a20567a
3 changed files with 113 additions and 39 deletions

View File

@ -0,0 +1,47 @@
package de.mstock.monolith.web;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import de.mstock.monolith.service.ShopService;
@Controller
public class HomepageController {
private static final String TEMPLATE = "homepage";
@Autowired
private ShopService shopService;
private final String STOCKADMINFRONTENDTEMPLATE = "admin";
/**
* Redirect
*
* @param model Template model
* @return The constant template name fpr the stock admin frontend.
*/
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String redirect(Model model) {
return this.STOCKADMINFRONTENDTEMPLATE;
}
/**
* Homepage
*
* @param model Template model
* @param locale Current locale
* @return The template's name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String homepage(Model model, Locale locale) {
model.addAttribute("categories", shopService.getCategories(locale));
return TEMPLATE;
}
}

View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments/skeleton :: head">
<meta charset="utf-8" />
<meta http-equiv="refresh" content="5; URL=http://localhost:65000/"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="../static/css/bootstrap.min.css" rel="stylesheet" />
<link href="../static/css/mosh.css" rel="stylesheet" />
</head>
<body>
<div th:replace="fragments/skeleton :: navigation">
<div class="container">
<nav>Navigation</nav>
</div>
</div>
<div class="container product">
<div class="row info">
<p align="center"><a href="http://localhost:65000/">If the automatic redirection to the stock management admin
front end does not work, click here.</a></p>
</div>
<footer th:replace="fragments/skeleton :: footer">
<p>&copy; 2017</p>
</footer>
</div>
<script src="../static/js/jquery-3.1.1.min.js"
th:src="@{/js/jquery-3.1.1.min.js}"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../static/js/bootstrap.min.js"
th:src="@{/js/bootstrap.min.js}"></script>
</body>
</html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <html lang="en" xmlns:th="http://www.thymeleaf.org">
xsi:schemaLocation="http://www.thymeleaf.org ">
<head th:replace="fragments/skeleton :: head"> <head th:replace="fragments/skeleton :: head">
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ -33,10 +32,6 @@
<div class="col-md-8"> <div class="col-md-8">
<h2 th:text="${product.name}">Product Name</h2> <h2 th:text="${product.name}">Product Name</h2>
<p class="text-info text-uppercase" th:text="${product.price}">0,00 Euro</p> <p class="text-info text-uppercase" th:text="${product.price}">0,00 Euro</p>
<<!-- Traffic light food labeling system -->
<img class="icon" src="./api/good/availablity/{{item.id}}"/>
<p class="lead" th:text="${product.description}">Description.</p> <p class="lead" th:text="${product.description}">Description.</p>
<div th:replace="fragments/reviews :: reviews"></div> <div th:replace="fragments/reviews :: reviews"></div>
</div> </div>