From b73a20567ada4e293d0e79856a3ac359f503af8e Mon Sep 17 00:00:00 2001 From: mlabusch Date: Wed, 3 May 2017 15:53:32 +0200 Subject: [PATCH] [Task]: edit the monolith Replace these files in the monolith and type url/admin, you will be redirected to the stock admin front end --- changes_to_monolith/HomepageController.java | 47 +++++++++++++ changes_to_monolith/admin.html | 32 +++++++++ changes_to_monolith/product.html | 73 ++++++++++----------- 3 files changed, 113 insertions(+), 39 deletions(-) create mode 100644 changes_to_monolith/HomepageController.java create mode 100644 changes_to_monolith/admin.html diff --git a/changes_to_monolith/HomepageController.java b/changes_to_monolith/HomepageController.java new file mode 100644 index 0000000..7a8f6ed --- /dev/null +++ b/changes_to_monolith/HomepageController.java @@ -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; + } + +} \ No newline at end of file diff --git a/changes_to_monolith/admin.html b/changes_to_monolith/admin.html new file mode 100644 index 0000000..f80b4b6 --- /dev/null +++ b/changes_to_monolith/admin.html @@ -0,0 +1,32 @@ + + + + + + + + + + +
+
+ +
+
+
+ + +
+

© 2017

+
+
+ + + + + \ No newline at end of file diff --git a/changes_to_monolith/product.html b/changes_to_monolith/product.html index c8bbc64..0d7bc31 100644 --- a/changes_to_monolith/product.html +++ b/changes_to_monolith/product.html @@ -1,57 +1,52 @@ - + - - - - - + + + + + -
+
- +
-
+
-
+
-
- Generic placeholder image -
- - [[#{general.sampleImage}]]: Rach. New Packaging. CC BY 2.0 - -
-
-
-

Product Name

-

0,00 Euro

- - < - - -

Description.

-
+
+ Generic placeholder image +
+ + [[#{general.sampleImage}]]: Rach. New Packaging. CC BY 2.0 +
+
+
+

Product Name

+

0,00 Euro

+

Description.

+
+
-

© 2017

+

© 2017

-
+
- - - + + + \ No newline at end of file