Skip to content

Commit

Permalink
Merge branch 'f8-frontpage' of https://github.com/erikhofer/GrowthLec…
Browse files Browse the repository at this point in the history
…tures into f8-frontpage
  • Loading branch information
erikhofer committed May 12, 2017
2 parents c8b845c + f5ae494 commit 8acbc84
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/assets/javascripts/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$(function() {
alert("Hallo");
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
package com.xinra.growthlectures.frontend;

import com.xinra.growthlectures.entity.Category;
import com.xinra.growthlectures.entity.Lecture;
import com.xinra.growthlectures.service.ContainerDto;
import com.xinra.growthlectures.service.ContainerDtoImpl;
import java.util.ArrayList;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

@RequestMapping("/")
public String index() {
public String index(Model model) {

// PopularLecures
ArrayList<Lecture> popularLectures = new ArrayList<Lecture>();
model.addAttribute("popularLectures", popularLectures );

// Recent Lecturers
ArrayList<Lecture> recentLectures = new ArrayList<Lecture>();
model.addAttribute("recentLectures", recentLectures );

// Popular Categories
ArrayList<ContainerDtoImpl> popularCategories = new ArrayList<ContainerDtoImpl>();
model.addAttribute("popularCategories", popularCategories);

// Pupular Lecuturers
ArrayList<ContainerDtoImpl> popularLecturers = new ArrayList<ContainerDtoImpl>();
model.addAttribute("popularLecturers", popularLecturers);

return "index";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.xinra.growthlectures.service

import groovy.transform.CompileStatic

@CompileStatic
class ContainerDtoImpl extends NamedDtoImpl {

def Integer amount;


}
33 changes: 33 additions & 0 deletions src/main/resources/templates/fragments/lecture-summary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="panel panel-default lecture" th:fragment="lecture-summary (lecture)">
<div class="panel-body">
<div class="row">
<div class="col-sm-3">
<a href="#" class="thumbnail">
<img src="http://lorempixel.com/400/200" alt="TODO" />
</a>
</div>
<div class="col-sm-9">
<h3><a href="#"><span th:text="${lecture.category.name}" class="label label-default"></span></a> <a th:text="${lecture.name}" href="#"></a> <span class="glyphicon glyphicon-ok listened"></span></h3>
<p th:text="${lecture.description}"></p>
<div class="row">
<div class="col-sm-4">
<input id="input-id" name="input-name" type="number" class="rating" min="1" max="5" step="1" data-size="xs" data-show-caption="false" />
</div>
<div class="col-sm-4">
Clicks
</div>
<div class="col-sm-4">
<span class="glyphicon glyphicon-time"></span> 13:37
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
56 changes: 55 additions & 1 deletion src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,60 @@
<title>This is title</title>
</header>
<body>
<div layout:fragment="content">Hello world</div>
<div layout:fragment="content">
<div class="container">
<form class="form-inline search">
<div class="input-group input-group-lg">
<input type="text" class="form-control" placeholder="Search for..." />
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</div>
<div class="container">
<h2>Recently Added</h2>
<div th:each="recentLecture : ${recentLectures}">
<div th:replace="fragments/lecture-summary :: lecture-summary (lecture = ${recentLecture})"></div>
</div>
</div>

<div class="secondary-background">
<div class="container">
<h2>Popular</h2>
<div th:each="popularLecture : ${popularLectures}">
<div th:replace="fragments/lecture-summary :: lecture-summary (lecture = ${popularLecture})"></div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Popular Categories</div>
<ul class="list-group">
<a th:each="popularCategory : ${popularCategories}" th:href="#" class="list-group-item">
<span th:text="${popularCategory.name}"></span>
<span th:text="${popularCategory.amount}" class="badge"></span>
</a>
</ul>
<div class="panel-footer"><a href="#">Show all <span class="glyphicon glyphicon-chevron-right"></span></a></div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Popular Lecturers</div>
<ul class="list-group">
<a th:each="popularLecturer : ${popularLecturers}" href="#" class="list-group-item">
<span th:text="${popularLecturer.name}"></span>
<span th:text="${popularLecturer.amount}" class="badge"></span>
</a>
</ul>
<div class="panel-footer"><a href="#">Show all <span class="glyphicon glyphicon-chevron-right"></span></a></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions src/main/resources/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.1/js/star-rating.min.js"></script> -->
<script src="/assets/script.js"></script>
</body>
</html>

0 comments on commit 8acbc84

Please sign in to comment.