Improved anime list

This commit is contained in:
Eduard Urbach 2017-06-25 14:58:27 +02:00
parent 2496f26bf4
commit 8ece017a82
6 changed files with 62 additions and 40 deletions

View File

@ -7,11 +7,13 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get anime list.
func Get(ctx *aero.Context) string {
nick := ctx.Get("nick")
user := utils.GetUser(ctx)
viewUser, err := arn.GetUserByNick(nick)
if err != nil {
@ -28,5 +30,5 @@ func Get(ctx *aero.Context) string {
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
})
return ctx.HTML(components.AnimeList(animeList))
return ctx.HTML(components.AnimeList(animeList, user))
}

View File

@ -1,17 +1,26 @@
component AnimeList(animeList *arn.AnimeList)
component AnimeList(animeList *arn.AnimeList, user *arn.User)
table.anime-list
thead
tr
th.anime-list-item-name Anime
th.anime-list-item-episodes Progress
th.anime-list-item-episodes Episodes
th.anime-list-item-rating Rating
if user != nil
th.anime-list-item-actions Actions
tbody
each item in animeList.Items
tr.anime-list-item.mountable(title=item.Notes)
td.anime-list-item-name
a.ajax(href=item.Anime().Link())= item.Anime().Title.Canonical
td.anime-list-item-episodes
span.anime-list-item-episodes-watched= item.Episodes
span.anime-list-item-episodes-separator /
span.anime-list-item-episodes-max= item.Anime().EpisodeCountString()
.anime-list-item-episodes-watched= item.Episodes
.anime-list-item-episodes-separator /
.anime-list-item-episodes-max= item.Anime().EpisodeCountString()
.anime-list-item-episodes-edit
a.ajax(href=item.Link(animeList.User().Nick), title="Edit anime")
RawIcon("pencil")
td.anime-list-item-rating= item.FinalRating()
if user != nil
td.anime-list-item-actions
a(href=arn.Nyaa.GetLink(item.Anime()), title="Search on Nyaa", target="_blank", rel="noopener")
RawIcon("download")

View File

@ -5,16 +5,52 @@
tr
horizontal
thead
display none
.anime-list-item-name
flex 0.8
flex 1
white-space nowrap
text-overflow ellipsis
overflow hidden
.anime-list-item-episodes
flex 0.1
text-align center
horizontal
justify-content flex-end
text-align right
white-space nowrap
flex-basis 120px
.anime-list-item-episodes-watched
flex 0.4
.anime-list-item-episodes-separator
flex 0.2
opacity 0.5
.anime-list-item-episodes-max
flex 0.4
opacity 0.5
.anime-list-item-episodes-edit
flex 0.5
// Beautify icon alignment
.raw-icon
margin-bottom -2px
.anime-list-item-rating
flex 0.1
flex-basis 100px
text-align center
.anime-list-item-actions
flex-basis 40px
text-align right
// Beautify icon alignment
.raw-icon
margin-bottom -4px
< 1100px
.anime-list-item-rating
display none

View File

@ -4,6 +4,7 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
h2= anime.Title.Canonical
InputNumber("Episodes", item.Episodes, "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount))
InputNumber("Rating.Overall", int(item.Rating.Overall + 0.5), "Overall rating", "Overall rating on a scale of 0 to 10", "0", "10")
InputNumber("RewatchCount", item.RewatchCount, "Rewatched", "How often you rewatched this anime", "0", "100")
InputTextArea("Notes", item.Notes, "Notes", "Your notes")

View File

@ -27,5 +27,5 @@ func Get(ctx *aero.Context) string {
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
})
return utils.AllowEmbed(ctx, ctx.HTML(components.AnimeList(animeList)))
return utils.AllowEmbed(ctx, ctx.HTML(components.AnimeList(animeList, user)))
}

View File

@ -1,36 +1,10 @@
.embedded
// Put navigation to the bottom of the screen
flex-direction column-reverse !important
.anime-list
max-width 500px
margin -1.1rem
thead
display none
.anime-list-item
// ui-element
// margin-bottom 0.5rem
.anime-list-item-episodes
horizontal
text-align right
white-space nowrap
flex 0.2
.anime-list-item-episodes-watched
flex 0.4
.anime-list-item-episodes-max
opacity 0.5
flex 0.4
.anime-list-item-episodes-separator
opacity 0.5
flex 0.2
.anime-list-item-rating
display none
#navigation
font-size 0.9rem