From d8848c7d56538d9c7a341c425aa79abbb7afa4b5 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 20 Oct 2017 18:20:45 +0200 Subject: [PATCH] Applied title language setting to anime lists --- pages/anime/anime.pixy | 2 +- pages/animelist/animelist.pixy | 4 ++-- pages/animelistitem/animelistitem.go | 6 +++--- pages/animelistitem/animelistitem.pixy | 4 ++-- pages/dashboard/dashboard.go | 2 +- pages/dashboard/dashboard.pixy | 4 ++-- pages/profile/profile.pixy | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pages/anime/anime.pixy b/pages/anime/anime.pixy index 7c4053ed..1b68f65a 100644 --- a/pages/anime/anime.pixy +++ b/pages/anime/anime.pixy @@ -4,7 +4,7 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]* .anime-header(data-id=anime.ID) if anime.Image.Small != "" .anime-image-container - img.anime-cover-image(src=anime.Image.Small, alt=anime.Title.Canonical) + img.anime-cover-image(src=anime.Image.Small, alt=anime.Title.ByUser(user)) if anime.StartDate != "" .anime-start-date diff --git a/pages/animelist/animelist.pixy b/pages/animelist/animelist.pixy index b0aea99a..96b7e4b1 100644 --- a/pages/animelist/animelist.pixy +++ b/pages/animelist/animelist.pixy @@ -45,10 +45,10 @@ component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User tr.anime-list-item.mountable(title=item.Notes, data-api="/api/animelist/" + animeList.UserID + "/field/Items[AnimeID=\"" + item.AnimeID + "\"]") td.anime-list-item-image-container a.ajax(href=item.Anime().Link()) - img.anime-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical) + img.anime-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.ByUser(user)) td.anime-list-item-name - a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.Canonical + a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.ByUser(user) td.anime-list-item-actions if user != nil && item.Status == arn.AnimeListStatusWatching && item.Anime().EpisodeByNumber(item.Episodes + 1) != nil diff --git a/pages/animelistitem/animelistitem.go b/pages/animelistitem/animelistitem.go index 5afa5a56..97365146 100644 --- a/pages/animelistitem/animelistitem.go +++ b/pages/animelistitem/animelistitem.go @@ -7,12 +7,12 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" + "github.com/animenotifier/notify.moe/utils" ) // Get anime page. func Get(ctx *aero.Context) string { - // user := utils.GetUser(ctx) - + user := utils.GetUser(ctx) nick := ctx.Get("nick") viewUser, err := arn.GetUserByNick(nick) @@ -35,7 +35,7 @@ func Get(ctx *aero.Context) string { anime := item.Anime() - return ctx.HTML(components.AnimeListItem(animeList.User(), item, anime)) + return ctx.HTML(components.AnimeListItem(animeList.User(), item, anime, user)) } // t := reflect.TypeOf(item).Elem() diff --git a/pages/animelistitem/animelistitem.pixy b/pages/animelistitem/animelistitem.pixy index 5313971e..54cb7b9e 100644 --- a/pages/animelistitem/animelistitem.pixy +++ b/pages/animelistitem/animelistitem.pixy @@ -1,7 +1,7 @@ -component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.Anime) +component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.Anime, user *arn.User) .widget-form.mountable .widget.anime-list-item-view(data-api="/api/animelist/" + viewUser.ID + "/field/Items[AnimeID=\"" + anime.ID + "\"]") - h1= anime.Title.Canonical + h1= anime.Title.ByUser(user) .anime-list-item-progress-edit .anime-list-item-episodes-edit diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index 1559ff10..6dac6725 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -82,5 +82,5 @@ func Get(ctx *aero.Context) string { } }) - return ctx.HTML(components.Dashboard(upcomingEpisodes, forumActivity, soundTracks, followingList)) + return ctx.HTML(components.Dashboard(upcomingEpisodes, forumActivity, soundTracks, followingList, user)) } diff --git a/pages/dashboard/dashboard.pixy b/pages/dashboard/dashboard.pixy index 95bbebeb..de34ab12 100644 --- a/pages/dashboard/dashboard.pixy +++ b/pages/dashboard/dashboard.pixy @@ -1,4 +1,4 @@ -component Dashboard(schedule []*arn.UpcomingEpisode, posts []arn.Postable, soundTracks []*arn.SoundTrack, following []*arn.User) +component Dashboard(schedule []*arn.UpcomingEpisode, posts []arn.Postable, soundTracks []*arn.SoundTrack, following []*arn.User, user *arn.User) h1.page-title Dashboard .widgets @@ -11,7 +11,7 @@ component Dashboard(schedule []*arn.UpcomingEpisode, posts []arn.Postable, sound .widget-ui-element-text a.schedule-item-link.ajax(href=schedule[i].Anime.Link()) Icon("calendar-o") - .schedule-item-title= schedule[i].Anime.Title.Canonical + .schedule-item-title= schedule[i].Anime.Title.ByUser(user) .spacer .schedule-item-date.utc-airing-date(data-start-date=schedule[i].Episode.AiringDate.Start, data-end-date=schedule[i].Episode.AiringDate.End, data-episode-number=schedule[i].Episode.Number) else diff --git a/pages/profile/profile.pixy b/pages/profile/profile.pixy index 9d9eeb61..51e6955a 100644 --- a/pages/profile/profile.pixy +++ b/pages/profile/profile.pixy @@ -106,8 +106,8 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, .profile-watching-list.mountable each item in animeList.Items if item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusCompleted - a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")") - img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical) + a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.ByUser(user) + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")") + img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.ByUser(user)) if user != nil && (user.Role == "admin" || user.Role == "editor") .footer