Applied title language setting to anime lists

This commit is contained in:
Eduard Urbach 2017-10-20 18:20:45 +02:00
parent 4bbe0ea7d5
commit d8848c7d56
7 changed files with 13 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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