Improved anime list
This commit is contained in:
parent
2496f26bf4
commit
8ece017a82
@ -7,11 +7,13 @@ import (
|
|||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get anime list.
|
// Get anime list.
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
nick := ctx.Get("nick")
|
nick := ctx.Get("nick")
|
||||||
|
user := utils.GetUser(ctx)
|
||||||
viewUser, err := arn.GetUserByNick(nick)
|
viewUser, err := arn.GetUserByNick(nick)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -28,5 +30,5 @@ func Get(ctx *aero.Context) string {
|
|||||||
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
|
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
|
||||||
})
|
})
|
||||||
|
|
||||||
return ctx.HTML(components.AnimeList(animeList))
|
return ctx.HTML(components.AnimeList(animeList, user))
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
component AnimeList(animeList *arn.AnimeList)
|
component AnimeList(animeList *arn.AnimeList, user *arn.User)
|
||||||
table.anime-list
|
table.anime-list
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th.anime-list-item-name Anime
|
th.anime-list-item-name Anime
|
||||||
th.anime-list-item-episodes Progress
|
th.anime-list-item-episodes Episodes
|
||||||
th.anime-list-item-rating Rating
|
th.anime-list-item-rating Rating
|
||||||
|
if user != nil
|
||||||
|
th.anime-list-item-actions Actions
|
||||||
tbody
|
tbody
|
||||||
each item in animeList.Items
|
each item in animeList.Items
|
||||||
tr.anime-list-item.mountable(title=item.Notes)
|
tr.anime-list-item.mountable(title=item.Notes)
|
||||||
td.anime-list-item-name
|
td.anime-list-item-name
|
||||||
a.ajax(href=item.Anime().Link())= item.Anime().Title.Canonical
|
a.ajax(href=item.Anime().Link())= item.Anime().Title.Canonical
|
||||||
td.anime-list-item-episodes
|
td.anime-list-item-episodes
|
||||||
span.anime-list-item-episodes-watched= item.Episodes
|
.anime-list-item-episodes-watched= item.Episodes
|
||||||
span.anime-list-item-episodes-separator /
|
.anime-list-item-episodes-separator /
|
||||||
span.anime-list-item-episodes-max= item.Anime().EpisodeCountString()
|
.anime-list-item-episodes-max= item.Anime().EpisodeCountString()
|
||||||
td.anime-list-item-rating= item.FinalRating()
|
.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")
|
@ -4,17 +4,53 @@
|
|||||||
|
|
||||||
tr
|
tr
|
||||||
horizontal
|
horizontal
|
||||||
|
|
||||||
|
thead
|
||||||
|
display none
|
||||||
|
|
||||||
.anime-list-item-name
|
.anime-list-item-name
|
||||||
flex 0.8
|
flex 1
|
||||||
white-space nowrap
|
white-space nowrap
|
||||||
text-overflow ellipsis
|
text-overflow ellipsis
|
||||||
overflow hidden
|
overflow hidden
|
||||||
|
|
||||||
.anime-list-item-episodes
|
.anime-list-item-episodes
|
||||||
flex 0.1
|
horizontal
|
||||||
text-align center
|
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
|
.anime-list-item-rating
|
||||||
flex 0.1
|
flex-basis 100px
|
||||||
text-align center
|
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
|
@ -4,6 +4,7 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
|
|||||||
h2= anime.Title.Canonical
|
h2= anime.Title.Canonical
|
||||||
|
|
||||||
InputNumber("Episodes", item.Episodes, "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount))
|
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")
|
InputNumber("RewatchCount", item.RewatchCount, "Rewatched", "How often you rewatched this anime", "0", "100")
|
||||||
|
|
||||||
InputTextArea("Notes", item.Notes, "Notes", "Your notes")
|
InputTextArea("Notes", item.Notes, "Notes", "Your notes")
|
||||||
|
@ -27,5 +27,5 @@ func Get(ctx *aero.Context) string {
|
|||||||
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
|
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)))
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,10 @@
|
|||||||
.embedded
|
.embedded
|
||||||
|
// Put navigation to the bottom of the screen
|
||||||
flex-direction column-reverse !important
|
flex-direction column-reverse !important
|
||||||
|
|
||||||
.anime-list
|
.anime-list
|
||||||
max-width 500px
|
max-width 500px
|
||||||
margin -1.1rem
|
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
|
#navigation
|
||||||
font-size 0.9rem
|
font-size 0.9rem
|
Loading…
Reference in New Issue
Block a user