Improved list item editor
This commit is contained in:
parent
5173ba2a83
commit
ad561c5652
@ -43,7 +43,7 @@ func Get(ctx *aero.Context) string {
|
|||||||
friendAnimeList := friends[j].AnimeList()
|
friendAnimeList := friends[j].AnimeList()
|
||||||
friendAnimeListItem := friendAnimeList.Find(anime.ID)
|
friendAnimeListItem := friendAnimeList.Find(anime.ID)
|
||||||
|
|
||||||
if friendAnimeListItem == nil {
|
if friendAnimeListItem == nil || friendAnimeListItem.Private {
|
||||||
friends = friends[:j+copy(friends[j:], friends[j+1:])]
|
friends = friends[:j+copy(friends[j:], friends[j+1:])]
|
||||||
deleted++
|
deleted++
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,6 @@ 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/pages/frontpage"
|
|
||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
"github.com/animenotifier/notify.moe/utils/infinitescroll"
|
"github.com/animenotifier/notify.moe/utils/infinitescroll"
|
||||||
)
|
)
|
||||||
@ -21,11 +20,6 @@ const (
|
|||||||
func FilterByStatus(status string) aero.Handle {
|
func FilterByStatus(status string) aero.Handle {
|
||||||
return func(ctx *aero.Context) string {
|
return func(ctx *aero.Context) string {
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
|
|
||||||
if user == nil {
|
|
||||||
return frontpage.Get(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
return AnimeList(ctx, user, status)
|
return AnimeList(ctx, user, status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,6 +43,11 @@ func AnimeList(ctx *aero.Context, user *arn.User, status string) string {
|
|||||||
|
|
||||||
statusList := animeList.FilterStatus(status)
|
statusList := animeList.FilterStatus(status)
|
||||||
|
|
||||||
|
// Filter private items
|
||||||
|
if user == nil || user.ID != viewUser.ID {
|
||||||
|
statusList = statusList.WithoutPrivateItems()
|
||||||
|
}
|
||||||
|
|
||||||
// Sort the items
|
// Sort the items
|
||||||
statusList.Sort()
|
statusList.Sort()
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
component AnimeListPage(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User, status string)
|
component AnimeListPage(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User, status string)
|
||||||
h1.page-title= viewUser.Nick + "'s anime list"
|
h1.page-title= viewUser.Nick + "'s anime list"
|
||||||
|
|
||||||
if user.ID != viewUser.ID
|
if user == nil || user.ID != viewUser.ID
|
||||||
.anime-list-user-avatar
|
.anime-list-user-avatar
|
||||||
AvatarNoTip(viewUser)
|
AvatarNoTip(viewUser)
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.Anime, user *arn.User)
|
component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.Anime, user *arn.User)
|
||||||
.widget-form.mountable
|
.anime-list-item-view.mountable(data-api="/api/animelist/" + viewUser.ID + "/field/Items[AnimeID=\"" + anime.ID + "\"]")
|
||||||
.widget.anime-list-item-view(data-api="/api/animelist/" + viewUser.ID + "/field/Items[AnimeID=\"" + anime.ID + "\"]")
|
h1.anime-list-item-title.mountable= anime.Title.ByUser(user)
|
||||||
h1= anime.Title.ByUser(user)
|
|
||||||
|
|
||||||
.anime-list-item-progress-edit
|
.anime-list-item-progress-edit
|
||||||
.anime-list-item-episodes-edit
|
.anime-list-item-episodes-edit
|
||||||
@ -16,13 +15,15 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
|
|||||||
option(value=arn.AnimeListStatusHold) On hold
|
option(value=arn.AnimeListStatusHold) On hold
|
||||||
option(value=arn.AnimeListStatusDropped) Dropped
|
option(value=arn.AnimeListStatusDropped) Dropped
|
||||||
|
|
||||||
.anime-list-item-rating-edit
|
.anime-list-item-rating-edit(data-status=item.Status)
|
||||||
InputNumber("Rating.Overall", item.Rating.Overall, arn.OverallRatingName(item.Episodes), "Overall rating on a scale of 0 to 10", "0", "10", "0.1")
|
InputNumber("Rating.Overall", item.Rating.Overall, arn.OverallRatingName(item.Episodes), "Overall rating on a scale of 0 to 10", "0", "10", "0.1")
|
||||||
InputNumber("Rating.Story", item.Rating.Story, "Story", "Story rating on a scale of 0 to 10", "0", "10", "0.1")
|
InputNumber("Rating.Story", item.Rating.Story, "Story", "Story rating on a scale of 0 to 10", "0", "10", "0.1")
|
||||||
InputNumber("Rating.Visuals", item.Rating.Visuals, "Visuals", "Visuals rating on a scale of 0 to 10", "0", "10", "0.1")
|
InputNumber("Rating.Visuals", item.Rating.Visuals, "Visuals", "Visuals rating on a scale of 0 to 10", "0", "10", "0.1")
|
||||||
InputNumber("Rating.Soundtrack", item.Rating.Soundtrack, "Soundtrack", "Soundtrack rating on a scale of 0 to 10", "0", "10", "0.1")
|
InputNumber("Rating.Soundtrack", item.Rating.Soundtrack, "Soundtrack", "Soundtrack rating on a scale of 0 to 10", "0", "10", "0.1")
|
||||||
|
|
||||||
|
.anime-list-item-others
|
||||||
InputNumber("RewatchCount", float64(item.RewatchCount), "Rewatched", "How often you rewatched this anime", "0", "100", "1")
|
InputNumber("RewatchCount", float64(item.RewatchCount), "Rewatched", "How often you rewatched this anime", "0", "100", "1")
|
||||||
|
InputBool("Private", item.Private, "Private", "Hidden entry")
|
||||||
|
|
||||||
InputTextArea("Notes", item.Notes, "Notes", "Your notes")
|
InputTextArea("Notes", item.Notes, "Notes", "Your notes")
|
||||||
|
|
||||||
@ -30,9 +31,16 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
|
|||||||
a.button(href="/+" + viewUser.Nick + "/animelist/" + item.Status)
|
a.button(href="/+" + viewUser.Nick + "/animelist/" + item.Status)
|
||||||
Icon("list")
|
Icon("list")
|
||||||
span View collection
|
span View collection
|
||||||
|
|
||||||
a.button(href=anime.Link())
|
a.button(href=anime.Link())
|
||||||
Icon("search-plus")
|
Icon("search-plus")
|
||||||
span View anime
|
span View anime
|
||||||
|
|
||||||
button.action(data-action="removeAnimeFromCollection", data-trigger="click", data-api="/api/animelist/" + viewUser.ID, data-anime-id=anime.ID, data-nick=viewUser.Nick)
|
button.action(data-action="removeAnimeFromCollection", data-trigger="click", data-api="/api/animelist/" + viewUser.ID, data-anime-id=anime.ID, data-nick=viewUser.Nick)
|
||||||
Icon("trash")
|
Icon("trash")
|
||||||
span Remove from collection
|
span Remove from collection
|
||||||
|
|
||||||
|
a.anime-list-item-cover.mountable(href=anime.Link(), title="View anime")
|
||||||
|
img.anime-cover-image.lazy(data-src=anime.ImageLink("medium"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
|
||||||
|
RawIcon("arrow-left")
|
||||||
|
|
@ -10,9 +10,49 @@
|
|||||||
// .anime-list-item-status-edit
|
// .anime-list-item-status-edit
|
||||||
// flex-basis 50%
|
// flex-basis 50%
|
||||||
|
|
||||||
|
.anime-list-item-view
|
||||||
|
vertical
|
||||||
|
width 100%
|
||||||
|
max-width 530px
|
||||||
|
margin 0 auto
|
||||||
|
margin-top calc(content-padding / 2)
|
||||||
|
|
||||||
|
.anime-list-item-others
|
||||||
|
display grid
|
||||||
|
grid-template-columns repeat(auto-fill, calc(50% - content-padding / 2))
|
||||||
|
grid-gap content-padding
|
||||||
|
|
||||||
|
.anime-list-item-cover
|
||||||
|
display none
|
||||||
|
|
||||||
|
> 1200px
|
||||||
|
.anime-list-item-cover
|
||||||
|
display block
|
||||||
|
position absolute
|
||||||
|
left content-padding
|
||||||
|
top content-padding
|
||||||
|
|
||||||
|
img
|
||||||
|
width anime-image-medium-width
|
||||||
|
height anime-image-medium-height
|
||||||
|
|
||||||
|
.raw-icon
|
||||||
|
font-size 2.5rem
|
||||||
|
position absolute
|
||||||
|
left 0
|
||||||
|
top calc(anime-image-medium-height / 2)
|
||||||
|
transform translateY(-50%) translateX(-50%)
|
||||||
|
opacity 0.85
|
||||||
|
|
||||||
.anime-list-item-rating-edit
|
.anime-list-item-rating-edit
|
||||||
horizontal
|
horizontal
|
||||||
justify-content space-between
|
justify-content space-between
|
||||||
width 100%
|
width 100%
|
||||||
|
|
||||||
.widget-section
|
.widget-section
|
||||||
max-width 20%
|
max-width 20%
|
||||||
|
|
||||||
|
.anime-list-item-rating-edit
|
||||||
|
[data-status="completed"]
|
||||||
|
input[value="0"]
|
||||||
|
border-color rgb(232, 0, 0)
|
@ -25,6 +25,11 @@ func Get(ctx *aero.Context) string {
|
|||||||
func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
animeList := viewUser.AnimeList()
|
animeList := viewUser.AnimeList()
|
||||||
|
|
||||||
|
if user == nil || user.ID != viewUser.ID {
|
||||||
|
animeList = animeList.WithoutPrivateItems()
|
||||||
|
}
|
||||||
|
|
||||||
animeList.SortByRating()
|
animeList.SortByRating()
|
||||||
|
|
||||||
openGraph := &arn.OpenGraph{
|
openGraph := &arn.OpenGraph{
|
||||||
|
@ -32,7 +32,7 @@ ui-disabled-color = rgb(224, 224, 224)
|
|||||||
const ui-element-border-radius = 3px
|
const ui-element-border-radius = 3px
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
input-height = 2.4rem
|
input-height = 2.5rem
|
||||||
input-focus-border-color = rgb(248, 165, 130)
|
input-focus-border-color = rgb(248, 165, 130)
|
||||||
|
|
||||||
// Button
|
// Button
|
||||||
|
@ -39,11 +39,11 @@ input
|
|||||||
|
|
||||||
button, .button
|
button, .button
|
||||||
horizontal
|
horizontal
|
||||||
line-height 1.5em
|
|
||||||
padding 0.5rem 1rem
|
padding 0.5rem 1rem
|
||||||
color link-color
|
color link-color
|
||||||
align-items center
|
align-items center
|
||||||
pointer-events all
|
pointer-events all
|
||||||
|
height input-height
|
||||||
|
|
||||||
button-hover
|
button-hover
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user