add beatmap name and link to versions page

This commit is contained in:
Michael Zhang 2020-10-14 16:30:18 -05:00
parent 1ac3c9b982
commit 6dddd54e07
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 15 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import (
"io"
"net/http"
"path"
"strconv"
"time"
"github.com/dustin/go-humanize"
@ -18,6 +19,9 @@ func (web *Web) mapVersions(c *gin.Context) {
userId := c.Param("userId")
mapId := c.Param("mapId")
id, _ := strconv.Atoi(mapId)
bs, _ := web.api.GetBeatmapSet(id)
repoDir := path.Join(web.config.Repos, userId, mapId)
repo, _ := git.PlainOpen(repoDir)
@ -51,8 +55,9 @@ func (web *Web) mapVersions(c *gin.Context) {
}
c.HTML(http.StatusOK, "map-version.html", gin.H{
"LoggedIn": isLoggedIn(c),
"Versions": versions,
"Beatmapset": bs,
"LoggedIn": isLoggedIn(c),
"Versions": versions,
})
}

View file

@ -1,5 +1,13 @@
{{ define "content" }}
<h3>versions of {{ .Beatmapset.Artist }} - {{ .Beatmapset.Title }}</h3>
<p>
<a href="https://osu.ppy.sh/s/{{ .Beatmapset.ID }}" target="_blank">Map link</a>
&middot;
mapped by <a href="https://osu.ppy.sh/u/{{ .Beatmapset.UserID }}" target="_blank">{{ .Beatmapset.Creator }}</a>
</p>
<small>up to the latest 20 revisions, pagination coming later</small>
<table>