From d98441da108725a76d697e358d161c06783cb066 Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 2 Jul 2021 07:43:54 -0500 Subject: Display most recents news item and create a table for boards --- client.go | 2 ++ static/index.html | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/client.go b/client.go index 38f0d6f..074b645 100644 --- a/client.go +++ b/client.go @@ -49,6 +49,7 @@ type PageData struct { InstanceIndex []ObjectBase ReturnTo string NewsItems []NewsItem + BoardRemainer []int } type AdminPage struct { @@ -98,6 +99,7 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { data.Board.Actor = actor data.Board.Post.Actor = actor.Id data.Board.Restricted = actor.Restricted + data.BoardRemainer = make([]int, (len(data.Boards) % 3)+1) data.InstanceIndex = GetCollectionFromReq("https://fchan.xyz/followers").Items data.NewsItems = getNewsFromDB(db) diff --git a/static/index.html b/static/index.html index 05197c0..518c012 100644 --- a/static/index.html +++ b/static/index.html @@ -23,17 +23,17 @@

{{ .PreferredUsername }} is a federated image board based on activitypub. The current version of the code running the server is still a work in progress, expect a bumpy ride for the time being. Get the server code here.

- - Local boards - +
+
Local boards
{{ range .Boards }} -
- - +
{{.Name}} - {{.PrefName}}
{{ end }} -
-
{{.Name}} - {{.PrefName}}
+ {{ range .BoardRemainer }} +
+ {{ end }} +
+
@@ -42,9 +42,13 @@ {{ .PreferredUsername }} news - {{ range .NewsItems }} + {{ range $i, $e := .NewsItems }} - {{unixtoreadable .Time}} - {{.Title}} + {{unixtoreadable $e.Time}} - {{$e.Title}} + {{ if eq $i 0 }} +

{{$e.Content}}

+ {{ end }} + {{ end }} -- cgit v1.2.3