Browse Source

Changed design

master
David Alasow 4 years ago
parent
commit
8c9355ffbb
  1. 6
      main.go
  2. 30
      static/stylesheet.css
  3. 20
      templates/pages/list.gohtml

6
main.go

@ -60,12 +60,12 @@ type meikanAPIIDs struct {
func main() {
r := router.New()
r.Renderer = NewRenderer()
r.ErrorHandler = errorHandler
r.GET(`/static/*asset`, getStatic)
r.GET(`/`, home)
r.GET(`/compare`, compare)
err := r.Start(`:8070`)
check(err)
r.ErrorHandler = errorHandler
}
func check(e error) {
@ -80,13 +80,11 @@ func home(c *router.Context) error {
func compare(c *router.Context) error {
user := c.QueryParam(`name`)
fmt.Println(user)
//https://api.jikan.moe/v3/user/nekomata1037/animelist/all
//https://api.meikan.moe/v1/ids/anime
jikanList := jikanAPIGetUserAnimelist(user)
var list meikanList
list.User = user
anime := list.Anime
fmt.Println("Getting IDs")
IDs := meikanAPIGetIDs()
for i := 0; i < len(jikanList.Anime); i++ {
@ -113,7 +111,7 @@ func compare(c *router.Context) error {
case 2:
temp.Anime.State = "Finished"
}
anime = append(anime, temp)
list.Anime = append(list.Anime, temp)
}
return c.Render(200, `list`, list)

30
static/stylesheet.css

@ -1,3 +1,31 @@
body {
color: black;
background: #FFF;
color: #333;
}
a {
text-decoration: none;
color: #7331e8;
}
a:visited {
color: #7331e8;
}
a:hover {
color: #a06cfc;
}
#list {
margin: auto;
border-collapse:collapse;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
#list tr:nth-child(odd) {
background: #F5F5F5;
}
h1 {
text-align: center;
}

20
templates/pages/list.gohtml

@ -1,3 +1,21 @@
{{ define "body" }}
<h1>List for {{.List.User}}</h1>
<h1 id="title">List for {{.Content.User}}</h1>
<table id="list">
<tr>
<th width="30">ID</th>
<th width="60">Title</th>
<th width="30" align="center">Score</th>
<th width="30" align="center">Type</th>
<th width="30" align="center">Progress</th>
</tr>
{{range .Content.Anime}}
<tr>
<td align="center">{{.Anime.ID}}</td>
<td><a href="https://api.meikan.moe/v1/anime/{{.Anime.ID}}">{{.Anime.Title}}</a></td>
<td align="center">{{.Rating}}</td>
<td align="center">{{.Anime.Type}}</td>
<td align="center">{{.Episode}}/{{.Anime.Episodes}}</td>
</tr>
{{end}}
</table>
{{ end }}
Loading…
Cancel
Save