Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
Improved download list
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Jun 26, 2017
1 parent 78480b2 commit 3bd4f04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ func DownloadHandler(w http.ResponseWriter, r *http.Request) {

if bid == "download" {
w.Header().Set("Content-Type", "text/html")
for _, b := range books {
io.WriteString(w, fmt.Sprintf("<a href=\"/download/%s\">%s</a><br>", b.ID, b.Title))
sbl := sortedBookList(books, func(b Book) bool {
return true
}, func(a Book, b Book) bool {
return a.Title < b.Title
})
for _, b := range sbl {
io.WriteString(w, fmt.Sprintf("<a href=\"/download/%s\">%s - %s - %s - %s</a><br>", b.ID, b.Title, b.Author, b.Series.Name, b.Series.Index))
}
return
}
Expand Down

0 comments on commit 3bd4f04

Please sign in to comment.