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,28 +1,27 @@
<!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" />
<meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="../static/css/bootstrap.min.css" rel="stylesheet"/> <link href="../static/css/bootstrap.min.css" rel="stylesheet" />
<link href="../static/css/mosh.css" rel="stylesheet"/> <link href="../static/css/mosh.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div th:replace="fragments/skeleton :: navigation"> <div th:replace="fragments/skeleton :: navigation">
<div class="container"> <div class="container">
<nav>Navigation</nav> <nav>Navigation</nav>
</div> </div>
</div> </div>
<div class="container product"> <div class="container product">
<div class="row info"> <div class="row info">
<div class="col-md-4"> <div class="col-md-4">
<img class="featurette-image img-responsive center-block" <img class="featurette-image img-responsive center-block"
src="../static/images/rach-new_packaging-cc_by_2_0.jpg" src="../static/images/rach-new_packaging-cc_by_2_0.jpg"
th:src="@{/images/rach-new_packaging-cc_by_2_0.jpg}" th:src="@{/images/rach-new_packaging-cc_by_2_0.jpg}"
alt="Generic placeholder image"/> alt="Generic placeholder image" />
<div> <div>
<small class="text-muted" th:inline="text"> <small class="text-muted" th:inline="text">
[[#{general.sampleImage}]]: Rach. <span [[#{general.sampleImage}]]: Rach. <span
@ -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>
@ -46,12 +41,12 @@
<p>&copy; 2017</p> <p>&copy; 2017</p>
</footer> </footer>
</div> </div>
<script src="../static/js/jquery-3.1.1.min.js" <script src="../static/js/jquery-3.1.1.min.js"
th:src="@{/js/jquery-3.1.1.min.js}"></script> th:src="@{/js/jquery-3.1.1.min.js}"></script>
<!-- Include all compiled plugins (below), or include individual files as needed --> <!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../static/js/bootstrap.min.js" <script src="../static/js/bootstrap.min.js"
th:src="@{/js/bootstrap.min.js}"></script> th:src="@{/js/bootstrap.min.js}"></script>
</body> </body>
</html> </html>