mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
feat: add grid for threads
This commit is contained in:
parent
5c7551b6ad
commit
c3e4bf7204
1
main.go
1
main.go
@ -24,6 +24,7 @@ func main() {
|
|||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
router.LoadHTMLGlob("templates/*.html")
|
router.LoadHTMLGlob("templates/*.html")
|
||||||
router.Static("/uploads", "./uploads")
|
router.Static("/uploads", "./uploads")
|
||||||
|
router.Static("/static", "./static")
|
||||||
router.GET("/", Controllers.GetThreads)
|
router.GET("/", Controllers.GetThreads)
|
||||||
router.POST("/", Controllers.CreateThread)
|
router.POST("/", Controllers.CreateThread)
|
||||||
router.GET("/:threadId", Controllers.GetThread)
|
router.GET("/:threadId", Controllers.GetThread)
|
||||||
|
@ -43,7 +43,7 @@ func getThread(id int) Thread {
|
|||||||
var ThreadsDb = []Thread{}
|
var ThreadsDb = []Thread{}
|
||||||
|
|
||||||
func SeedMocks() {
|
func SeedMocks() {
|
||||||
for i := 1; i < 101; i++ {
|
for i := 1; i < 10; i++ {
|
||||||
ThreadsDb = append(ThreadsDb, getThread(i))
|
ThreadsDb = append(ThreadsDb, getThread(i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
static/index.css
Normal file
0
static/index.css
Normal file
@ -14,11 +14,16 @@
|
|||||||
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
|
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
|
||||||
crossorigin="anonymous">
|
crossorigin="anonymous">
|
||||||
</script>
|
</script>
|
||||||
|
<link
|
||||||
|
href="/static/index.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
>
|
||||||
|
|
||||||
<!-- Primary Meta Tags -->
|
<!-- Primary Meta Tags -->
|
||||||
<title>Micrach</title>
|
<title>Micrach</title>
|
||||||
<meta name="title" content="Micrach">
|
<meta name="title" content="Micrach">
|
||||||
<meta name="description" content="Single board imageboard.">
|
<meta name="description" content="Single board imageboard.">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
<!-- Open Graph / Facebook -->
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
@ -39,26 +44,31 @@
|
|||||||
<h1 class="display-1 text-center">Welcome to Micrach</h1>
|
<h1 class="display-1 text-center">Welcome to Micrach</h1>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{range $Thread := .}}
|
<div class="row row-cols-auto gy-4">
|
||||||
{{$FirstPost := index $Thread.Posts 0}}
|
|
||||||
|
|
||||||
<div class="card" style="width: 18rem;">
|
{{range $Thread := .}}
|
||||||
{{$FirstFile := index $FirstPost.Files 0}}
|
<div class="col col-sm-6 col-md-4 col-lg-3">
|
||||||
|
{{$FirstPost := index $Thread.Posts 0}}
|
||||||
|
|
||||||
<img
|
<div class="card">
|
||||||
src="{{$FirstFile.Name}}"
|
{{$FirstFile := index $FirstPost.Files 0}}
|
||||||
class="card-img-top"
|
|
||||||
alt="Uploaded picture"
|
<img
|
||||||
>
|
src="{{$FirstFile.Name}}"
|
||||||
<div class="card-body">
|
class="card-img-top"
|
||||||
<h5 class="card-title">{{$FirstPost.Title}}</h5>
|
alt="Uploaded picture"
|
||||||
<p class="card-text">{{$FirstPost.Text}}</p>
|
>
|
||||||
<a href="/{{$Thread.ID}}" class="btn btn-primary">Open</a>
|
<div class="card-body">
|
||||||
</div>
|
<h5 class="card-title">{{$FirstPost.Title}}</h5>
|
||||||
|
<p class="card-text">{{$FirstPost.Text}}</p>
|
||||||
|
<a href="/{{$Thread.ID}}" class="btn btn-primary">Open</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user