2017-05-03 15:53:32 +02:00
|
|
|
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;
|
2017-05-19 11:12:17 +02:00
|
|
|
private final String STOCKADMINFRONTENDTEMPLATE = "https://stock.pub.warehost.de/index.html";
|
2017-05-03 15:53:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Redirect
|
|
|
|
*
|
|
|
|
* @param model Template model
|
2017-05-19 11:12:17 +02:00
|
|
|
* @return The constant template name for the stock admin frontend.
|
2017-05-03 15:53:32 +02:00
|
|
|
*/
|
2017-05-15 10:57:12 +02:00
|
|
|
@RequestMapping(value = "/stockadmin", method = RequestMethod.GET)
|
2017-05-19 11:12:17 +02:00
|
|
|
public String redirect(Model model) {return "redirect:"+ this.STOCKADMINFRONTENDTEMPLATE;
|
2017-05-03 15:53:32 +02:00
|
|
|
}
|
2017-05-19 11:12:17 +02:00
|
|
|
|
2017-05-03 15:53:32 +02:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|