UI improvements
This commit is contained in:
parent
7fdfeb935b
commit
c42ec17b84
2
main.go
2
main.go
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/animenotifier/notify.moe/pages/admin"
|
"github.com/animenotifier/notify.moe/pages/admin"
|
||||||
"github.com/animenotifier/notify.moe/pages/airing"
|
"github.com/animenotifier/notify.moe/pages/airing"
|
||||||
"github.com/animenotifier/notify.moe/pages/anime"
|
"github.com/animenotifier/notify.moe/pages/anime"
|
||||||
|
"github.com/animenotifier/notify.moe/pages/animelist"
|
||||||
"github.com/animenotifier/notify.moe/pages/animelistitem"
|
"github.com/animenotifier/notify.moe/pages/animelistitem"
|
||||||
"github.com/animenotifier/notify.moe/pages/awards"
|
"github.com/animenotifier/notify.moe/pages/awards"
|
||||||
"github.com/animenotifier/notify.moe/pages/dashboard"
|
"github.com/animenotifier/notify.moe/pages/dashboard"
|
||||||
@ -51,6 +52,7 @@ func main() {
|
|||||||
app.Ajax("/posts/:id", posts.Get)
|
app.Ajax("/posts/:id", posts.Get)
|
||||||
app.Ajax("/user/:nick", profile.Get)
|
app.Ajax("/user/:nick", profile.Get)
|
||||||
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser)
|
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser)
|
||||||
|
app.Ajax("/user/:nick/animelist", animelist.Get)
|
||||||
app.Ajax("/user/:nick/animelist/:id", animelistitem.Get)
|
app.Ajax("/user/:nick/animelist/:id", animelistitem.Get)
|
||||||
app.Ajax("/settings", settings.Get)
|
app.Ajax("/settings", settings.Get)
|
||||||
app.Ajax("/admin", admin.Get)
|
app.Ajax("/admin", admin.Get)
|
||||||
|
@ -28,16 +28,16 @@ component Anime(anime *arn.Anime, user *arn.User)
|
|||||||
|
|
||||||
h3.anime-section-name Ratings
|
h3.anime-section-name Ratings
|
||||||
.anime-rating-categories
|
.anime-rating-categories
|
||||||
.anime-rating-category(title=toString(anime.Rating.Overall))
|
.anime-rating-category(title=toString(anime.Rating.Overall / 10))
|
||||||
.anime-rating-category-name Overall
|
.anime-rating-category-name Overall
|
||||||
Rating(anime.Rating.Overall)
|
Rating(anime.Rating.Overall)
|
||||||
.anime-rating-category(title=toString(anime.Rating.Story))
|
.anime-rating-category(title=toString(anime.Rating.Story / 10))
|
||||||
.anime-rating-category-name Story
|
.anime-rating-category-name Story
|
||||||
Rating(anime.Rating.Story)
|
Rating(anime.Rating.Story)
|
||||||
.anime-rating-category(title=toString(anime.Rating.Visuals))
|
.anime-rating-category(title=toString(anime.Rating.Visuals / 10))
|
||||||
.anime-rating-category-name Visuals
|
.anime-rating-category-name Visuals
|
||||||
Rating(anime.Rating.Visuals)
|
Rating(anime.Rating.Visuals)
|
||||||
.anime-rating-category(title=toString(anime.Rating.Music))
|
.anime-rating-category(title=toString(anime.Rating.Music / 10))
|
||||||
.anime-rating-category-name Music
|
.anime-rating-category-name Music
|
||||||
Rating(anime.Rating.Music)
|
Rating(anime.Rating.Music)
|
||||||
|
|
||||||
|
32
pages/animelist/animelist.go
Normal file
32
pages/animelist/animelist.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package animelist
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/aerogo/aero"
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get anime list.
|
||||||
|
func Get(ctx *aero.Context) string {
|
||||||
|
nick := ctx.Get("nick")
|
||||||
|
viewUser, err := arn.GetUserByNick(nick)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Error(http.StatusNotFound, "User not found", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
animeList := viewUser.AnimeList()
|
||||||
|
|
||||||
|
if animeList == nil {
|
||||||
|
return ctx.Error(http.StatusNotFound, "Anime list not found", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(animeList.Items, func(i, j int) bool {
|
||||||
|
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
|
||||||
|
})
|
||||||
|
|
||||||
|
return ctx.HTML(components.AnimeList(animeList))
|
||||||
|
}
|
13
pages/animelist/animelist.pixy
Normal file
13
pages/animelist/animelist.pixy
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
component AnimeList(animeList *arn.AnimeList)
|
||||||
|
table.anime-list
|
||||||
|
thead
|
||||||
|
tr
|
||||||
|
th Anime
|
||||||
|
th Progress
|
||||||
|
th Rating
|
||||||
|
tbody
|
||||||
|
each item in animeList.Items
|
||||||
|
tr.anime-list-item
|
||||||
|
td= item.Anime().Title.Canonical
|
||||||
|
td= toString(item.Episodes) + " / " + item.Anime().EpisodeCountString()
|
||||||
|
td= item.FinalRating()
|
2
pages/animelist/animelist.scarlet
Normal file
2
pages/animelist/animelist.scarlet
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.anime-list
|
||||||
|
//
|
@ -1,15 +0,0 @@
|
|||||||
.anime-list
|
|
||||||
horizontal-wrap
|
|
||||||
|
|
||||||
.anime-list-item
|
|
||||||
margin 0.25rem
|
|
||||||
// padding calc(content-padding / 4) calc(content-padding / 2)
|
|
||||||
// margin 0.25rem 0
|
|
||||||
// position relative
|
|
||||||
|
|
||||||
.anime-list-item-image
|
|
||||||
width 55px !important
|
|
||||||
border-radius 2px
|
|
||||||
// position absolute
|
|
||||||
// left 0
|
|
||||||
// top 0
|
|
@ -50,25 +50,24 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
|
|||||||
//- a.light-button(href="#") Forum
|
//- a.light-button(href="#") Forum
|
||||||
|
|
||||||
.profile-category
|
.profile-category
|
||||||
h3 Anime
|
h3
|
||||||
|
a.ajax(href="/+" + viewUser.Nick + "/animelist", title="View all anime") Anime
|
||||||
|
|
||||||
.anime-list
|
.profile-watching-list
|
||||||
if len(animeList.Items) == 0
|
if len(animeList.Items) == 0
|
||||||
p No anime in the collection.
|
p No anime in the collection.
|
||||||
else
|
else
|
||||||
each item in animeList.Items
|
each item in animeList.Items
|
||||||
a.anime-list-item.ajax(href="/+" + viewUser.Nick + "/animelist/" + item.Anime().ID, title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
|
a.profile-watching-list-item.ajax(href="/+" + viewUser.Nick + "/animelist/" + item.Anime().ID, title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
|
||||||
img.anime-cover-image.anime-list-item-image(src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
|
img.anime-cover-image.profile-watching-list-item-image(src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
|
||||||
|
|
||||||
.profile-category
|
.profile-category
|
||||||
h3 Forum
|
h3
|
||||||
|
a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads
|
||||||
|
|
||||||
if len(animeList.Items) == 0
|
if len(threads) == 0
|
||||||
p No activity on the forum.
|
p No threads on the forum.
|
||||||
else
|
else
|
||||||
each thread in threads
|
each thread in threads
|
||||||
ThreadLink(thread)
|
ThreadLink(thread)
|
||||||
|
|
||||||
.side-note
|
|
||||||
a.ajax(href="/+" + viewUser.Nick + "/threads") View all threads
|
|
||||||
|
|
9
pages/profile/watching.scarlet
Normal file
9
pages/profile/watching.scarlet
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.profile-watching-list
|
||||||
|
horizontal-wrap
|
||||||
|
|
||||||
|
.profile-watching-list-item
|
||||||
|
margin 0.25rem
|
||||||
|
|
||||||
|
.profile-watching-list-item-image
|
||||||
|
width 55px !important
|
||||||
|
border-radius 2px
|
@ -13,7 +13,7 @@ h3
|
|||||||
text-align left
|
text-align left
|
||||||
margin-top 0.6em
|
margin-top 0.6em
|
||||||
|
|
||||||
h2
|
h2, h3
|
||||||
a
|
a
|
||||||
color text-color
|
color text-color
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user