diff options
author | knotteye <knotteye@airmail.cc> | 2021-07-02 07:43:54 -0500 |
---|---|---|
committer | knotteye <knotteye@airmail.cc> | 2021-07-02 07:43:54 -0500 |
commit | d98441da108725a76d697e358d161c06783cb066 (patch) | |
tree | 4a32df3435407f15039eecf4b210d21f305a64ae | |
parent | 9180db359438a4d2833c2e094ebc870da37262ef (diff) |
Display most recents news item and create a table for boards
-rw-r--r-- | client.go | 2 | ||||
-rw-r--r-- | static/index.html | 24 |
2 files changed, 16 insertions, 10 deletions
@@ -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 @@ <p style="text-align: justify">{{ .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 <a href="https://github.com/FChannel0">here</a>.</p> <div style="margin-top:50px;"> - <table align="center" style="text-align: left;"> - <th> - <tr>Local boards</tr> - </th> + <div style="display: grid;border-right: 2px solid #820404"> + <div style="display: inline-grid;grid-column: 1 / 4;border-bottom: 2px solid #820404;border-left: 2px solid #820404;border-top: 2px solid #820404;"><span style="font-size: 1.5em;font-weight: bold;">Local boards</span></div> {{ range .Boards }} - <tr> - <td><a href="{{.Location}}">{{.Name}} - {{.PrefName}}</a></td> - </tr> + <div style="whitespace: nowrap;display: inline-grid;text-align: left;padding: 5px;border-bottom: 2px solid #820404;border-left: 2px solid #820404;"><a href="{{.Location}}">{{.Name}} - {{.PrefName}}</a></div> {{ end }} - </table> + {{ range .BoardRemainer }} + <div style="whitespace: nowrap;display: inline-grid;text-align: left;padding: 5px;border-bottom: 2px solid #820404;border-left: 2px solid #820404;"></div> + {{ end }} + </div> + </div> <div style="margin-top:50px;"> @@ -42,9 +42,13 @@ <tr>{{ .PreferredUsername }} news</tr> </th> - {{ range .NewsItems }} + {{ range $i, $e := .NewsItems }} <tr> - <td><a href="/news/{{.Time}}">{{unixtoreadable .Time}} - {{.Title}}</a></td> + <td><a href="/news/{{.Time}}">{{unixtoreadable $e.Time}} - {{$e.Title}}</a> + {{ if eq $i 0 }} + <br><p>{{$e.Content}}</p> + {{ end }} + </td> </tr> {{ end }} </table> |