UI improvements

This commit is contained in:
Eduard Urbach 2017-06-19 22:16:01 +02:00
parent 7fdfeb935b
commit c42ec17b84
9 changed files with 72 additions and 30 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/animenotifier/notify.moe/pages/admin"
"github.com/animenotifier/notify.moe/pages/airing"
"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/awards"
"github.com/animenotifier/notify.moe/pages/dashboard"
@ -51,6 +52,7 @@ func main() {
app.Ajax("/posts/:id", posts.Get)
app.Ajax("/user/:nick", profile.Get)
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser)
app.Ajax("/user/:nick/animelist", animelist.Get)
app.Ajax("/user/:nick/animelist/:id", animelistitem.Get)
app.Ajax("/settings", settings.Get)
app.Ajax("/admin", admin.Get)

View File

@ -28,16 +28,16 @@ component Anime(anime *arn.Anime, user *arn.User)
h3.anime-section-name Ratings
.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
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
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
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
Rating(anime.Rating.Music)

View 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))
}

View 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()

View File

@ -0,0 +1,2 @@
.anime-list
//

View File

@ -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

View File

@ -50,25 +50,24 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
//- a.light-button(href="#") Forum
.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
p No anime in the collection.
else
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) + ")")
img.anime-cover-image.anime-list-item-image(src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
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.profile-watching-list-item-image(src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
.profile-category
h3 Forum
h3
a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads
if len(animeList.Items) == 0
p No activity on the forum.
if len(threads) == 0
p No threads on the forum.
else
each thread in threads
ThreadLink(thread)
.side-note
a.ajax(href="/+" + viewUser.Nick + "/threads") View all threads

View 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

View File

@ -13,7 +13,7 @@ h3
text-align left
margin-top 0.6em
h2
h2, h3
a
color text-color