WIP feature/listedArticles #15
|
@ -22,10 +22,10 @@ public class RequestController {
|
|||
|
||||
static int notSoRandom = 0;
|
||||
|
||||
@GetMapping("/")
|
||||
public String home() {
|
||||
return "redirect:/shop/";
|
||||
}
|
||||
// @GetMapping("/")
|
||||
// public String home() {
|
||||
// return "redirect:/shop/";
|
||||
// }
|
||||
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
|
@ -88,10 +88,10 @@ public class RequestController {
|
|||
return "redirect:/";
|
||||
}
|
||||
|
||||
@GetMapping("/shop/")
|
||||
public String shop() {
|
||||
return "shop/index";
|
||||
}
|
||||
// @GetMapping("/shop/")
|
||||
// public String shop() {
|
||||
// return "shop/index";
|
||||
// }
|
||||
|
||||
@GetMapping("/shop/search")
|
||||
public String shopSearch() {
|
||||
|
@ -137,20 +137,20 @@ public class RequestController {
|
|||
// }
|
||||
// }
|
||||
|
||||
@GetMapping("/about")
|
||||
public String about() {
|
||||
return "about";
|
||||
}
|
||||
|
||||
@GetMapping("/terms")
|
||||
public String terms() {
|
||||
return "terms";
|
||||
}
|
||||
|
||||
@GetMapping("/privacy")
|
||||
public String privacy() {
|
||||
return "privacy";
|
||||
}
|
||||
// @GetMapping("/about")
|
||||
// public String about() {
|
||||
// return "about";
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/terms")
|
||||
// public String terms() {
|
||||
// return "terms";
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/privacy")
|
||||
// public String privacy() {
|
||||
// return "privacy";
|
||||
// }
|
||||
|
||||
|
||||
@GetMapping("/intern/")
|
||||
|
|
|
@ -1,8 +1,83 @@
|
|||
package org.hso.ecommerce.controller.shop;
|
||||
|
||||
import org.hso.ecommerce.entities.shop.Article;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Controller
|
||||
//@RequestMapping("...")
|
||||
@RequestMapping("/")
|
||||
public class ShopIndexController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String home() {
|
||||
return "redirect:/shop/";
|
||||
}
|
||||
|
||||
@GetMapping("/shop/")
|
||||
public String shop(Model model) {
|
||||
|
||||
ArrayList<Article> dummyArticles = getArticles();
|
||||
|
||||
model.addAttribute("articles", dummyArticles);
|
||||
return "shop/index";
|
||||
}
|
||||
|
||||
@GetMapping("/about")
|
||||
public String about() {
|
||||
return "about";
|
||||
}
|
||||
|
||||
@GetMapping("/terms")
|
||||
public String terms() {
|
||||
return "terms";
|
||||
}
|
||||
|
||||
@GetMapping("/privacy")
|
||||
public String privacy() {
|
||||
return "privacy";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArrayList<Article> getArticles(){
|
||||
ArrayList<Article> dummyArticles = new ArrayList<Article>();
|
||||
|
||||
Article d1 = new Article();
|
||||
d1.description = "this is dummy1";
|
||||
d1.title = "dummy1";
|
||||
d1.shopPricePerUnitNetCent = 1500;
|
||||
d1.id = 1234;
|
||||
dummyArticles.add(d1);
|
||||
|
||||
Article d2 = new Article();
|
||||
d2.description = "this is dummy2";
|
||||
d2.title = "dummy2";
|
||||
d2.shopPricePerUnitNetCent = 2000;
|
||||
d2.id = 2345;
|
||||
dummyArticles.add(d2);
|
||||
|
||||
Article d3 = new Article();
|
||||
d3.description = "this is dummy3";
|
||||
d3.title = "dummy3";
|
||||
d3.shopPricePerUnitNetCent = 2500;
|
||||
d3.id = 3456;
|
||||
dummyArticles.add(d3);
|
||||
|
||||
Article d4 = new Article();
|
||||
d4.description = "this is dummy4";
|
||||
d4.title = "dummy4";
|
||||
d4.shopPricePerUnitNetCent = 3000;
|
||||
d4.id = 4567;
|
||||
dummyArticles.add(d4);
|
||||
|
||||
return dummyArticles;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -18,54 +18,13 @@
|
|||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="shop" data-name="Zurück zur Startseite." data-insert="false"></div>
|
||||
<div class='grid m base shadow'>
|
||||
<section><a th:href="@{/shop/articles/1234}" class="section">
|
||||
<section th:each="article: ${articles}">
|
||||
<a th:href="@{/shop/articles/{id}(id=${article.id})}" class="section">
|
||||
|
||||
<img th:src="@{/img/product-1.jpg}"/>
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p class='price'> 25.14 EUR</p>
|
||||
<p>
|
||||
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte.
|
||||
</p>
|
||||
</a>
|
||||
</section>
|
||||
<section><a th:href="@{/shop/articles/1234}" class="section">
|
||||
|
||||
<img th:src="@{/img/product-2.jpg}"/>
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p class='price'> 10.14 EUR</p>
|
||||
<p>
|
||||
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte.
|
||||
</p>
|
||||
</a>
|
||||
</section>
|
||||
<section><a th:href="@{/shop/articles/1234}" class="section">
|
||||
|
||||
<img th:src="@{/img/product-3.jpg}"/>
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p class='price'> 25.14 EUR</p>
|
||||
<p>
|
||||
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte.
|
||||
</p>
|
||||
</a>
|
||||
</section>
|
||||
<section><a th:href="@{/shop/articles/1234}" class="section">
|
||||
|
||||
<img th:src="@{/img/product-4.jpg}"/>
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p class='price'> 10.14 EUR</p>
|
||||
<p>
|
||||
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte.
|
||||
</p>
|
||||
</a>
|
||||
</section>
|
||||
<section>
|
||||
<a th:href="@{/shop/articles/1234}" class="section">
|
||||
<img th:src="@{/img/product-5.jpg}"/>
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p class='price'> 44.14 EUR</p>
|
||||
<p>
|
||||
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte.
|
||||
</p>
|
||||
<img th:src="@{/img/product-1.jpg}"/>
|
||||
<h2 th:text="${article.title}" />
|
||||
<p class='price' th:text="${article.shopPricePerUnitNetCent}" />
|
||||
<p th:text="${article.description}" />
|
||||
</a>
|
||||
</section>
|
||||
<section class="spacer"></section>
|
||||
|
|
Reference in New Issue