Use preferred title settings

This commit is contained in:
Eduard Urbach 2018-04-23 10:30:25 +02:00
parent d58530aafc
commit f088a4324e
6 changed files with 26 additions and 25 deletions

View File

@ -1,17 +1,17 @@
component SoundTrack(track *arn.SoundTrack) component SoundTrack(track *arn.SoundTrack, user *arn.User)
.soundtrack.mountable(id=track.ID) .soundtrack.mountable(id=track.ID)
SoundTrackContent(track) SoundTrackContent(track, user)
SoundTrackFooter(track) SoundTrackFooter(track, user)
component SoundTrackMini(track *arn.SoundTrack) component SoundTrackMini(track *arn.SoundTrack, user *arn.User)
.soundtrack.mountable(id=track.ID) .soundtrack.mountable(id=track.ID)
SoundTrackContent(track) SoundTrackContent(track, user)
SoundTrackMiniFooter(track) SoundTrackMiniFooter(track, user)
component SoundTrackContent(track *arn.SoundTrack) component SoundTrackContent(track *arn.SoundTrack, user *arn.User)
.soundtrack-content .soundtrack-content
if track.MainAnime() != nil if track.MainAnime() != nil
a.soundtrack-anime-link(href="/anime/" + track.MainAnime().ID, title=track.MainAnime().Title.ByUser(nil)) a.soundtrack-anime-link(href="/anime/" + track.MainAnime().ID, title=track.MainAnime().Title.ByUser(user))
img.soundtrack-anime-image.lazy(data-src=track.MainAnime().ImageLink("medium"), data-webp="true", data-color=track.MainAnime().AverageColor(), alt=track.MainAnime().Title.Canonical) img.soundtrack-anime-image.lazy(data-src=track.MainAnime().ImageLink("medium"), data-webp="true", data-color=track.MainAnime().AverageColor(), alt=track.MainAnime().Title.Canonical)
SoundTrackMedia(track) SoundTrackMedia(track)
@ -31,23 +31,23 @@ component SoundTrackMedia(track *arn.SoundTrack)
else else
ExternalMedia(track.Media[0]) ExternalMedia(track.Media[0])
component SoundTrackFooter(track *arn.SoundTrack) component SoundTrackFooter(track *arn.SoundTrack, user *arn.User)
.soundtrack-footer .soundtrack-footer
if track.Title.ByUser(nil) == "" if track.Title.ByUser(user) == ""
a(href=track.Link() + "/edit") untitled a(href=track.Link() + "/edit") untitled
else else
a(href=track.Link())= track.Title.ByUser(nil) a(href=track.Link())= track.Title.ByUser(user)
span posted span posted
span.utc-date.no-tip(data-date=track.Created) span.utc-date.no-tip(data-date=track.Created)
span by span by
a(href=track.Creator().Link())= track.Creator().Nick + " " a(href=track.Creator().Link())= track.Creator().Nick + " "
component SoundTrackMiniFooter(track *arn.SoundTrack) component SoundTrackMiniFooter(track *arn.SoundTrack, user *arn.User)
.soundtrack-footer .soundtrack-footer
if track.Title.ByUser(nil) == "" if track.Title.ByUser(user) == ""
a(href=track.Link() + "/edit") untitled a(href=track.Link() + "/edit") untitled
else else
a(href=track.Link())= track.Title.ByUser(nil) a(href=track.Link())= track.Title.ByUser(user)
component ExternalMedia(media *arn.ExternalMedia) component ExternalMedia(media *arn.ExternalMedia)
iframe.lazy(data-src=media.EmbedLink(), allowfullscreen="allowfullscreen") iframe.lazy(data-src=media.EmbedLink(), allowfullscreen="allowfullscreen")

View File

@ -1,9 +1,9 @@
component Character(character *arn.Character, user *arn.User) component Character(character *arn.Character, user *arn.User)
a.character(href="/character/" + character.ID) a.character(href="/character/" + character.ID)
img.character-image-medium.lazy(data-src=character.ImageLink("medium"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.Canonical) img.character-image-medium.lazy(data-src=character.ImageLink("medium"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.ByUser(user))
.image-title .image-title
.image-title-text= character.Name.Canonical .image-title-text= character.Name.ByUser(user)
component CharacterSmall(character *arn.Character, user *arn.User) component CharacterSmall(character *arn.Character, user *arn.User)
a.character.tip(href="/character/" + character.ID, aria-label=character.Name.Canonical) a.character.tip(href="/character/" + character.ID, aria-label=character.Name.ByUser(user))
img.character-image-small.lazy(data-src=character.ImageLink("small"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.Canonical) img.character-image-small.lazy(data-src=character.ImageLink("small"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.ByUser(user))

View File

@ -10,4 +10,4 @@ component AnimeTracks(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User
.soundtracks.anime-soundtracks .soundtracks.anime-soundtracks
each track in tracks each track in tracks
SoundTrackMini(track) SoundTrackMini(track, user)

View File

@ -52,9 +52,10 @@ func GetEmptySearch(ctx *aero.Context) string {
func Anime(ctx *aero.Context) string { func Anime(ctx *aero.Context) string {
term := ctx.Get("term") term := ctx.Get("term")
term = strings.TrimPrefix(term, "/") term = strings.TrimPrefix(term, "/")
user := utils.GetUser(ctx)
animes := search.Anime(term, maxAnime) animes := search.Anime(term, maxAnime)
return ctx.HTML(components.AnimeSearchResults(animes)) return ctx.HTML(components.AnimeSearchResults(animes, user))
} }
// Characters search. // Characters search.

View File

@ -8,7 +8,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
span Anime span Anime
#anime-search-results #anime-search-results
AnimeSearchResults(animes) AnimeSearchResults(animes, user)
.widget .widget
h3.widget-title h3.widget-title
@ -58,14 +58,14 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
#user-search-results #user-search-results
UserSearchResults(users) UserSearchResults(users)
component AnimeSearchResults(animes []*arn.Anime) component AnimeSearchResults(animes []*arn.Anime, user *arn.User)
if len(animes) == 0 if len(animes) == 0
p.no-search-results.mountable No anime found. p.no-search-results.mountable No anime found.
else else
.profile-watching-list.anime-search .profile-watching-list.anime-search
each anime in animes each anime in animes
a.profile-watching-list-item.tip.mountable(href=anime.Link(), aria-label=anime.Title.Canonical, data-mountable-type="anime") a.profile-watching-list-item.tip.mountable(href=anime.Link(), aria-label=anime.Title.ByUser(user), data-mountable-type="anime")
img.anime-cover-image.anime-search-result.lazy(data-src=anime.ImageLink("small"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.Canonical) img.anime-cover-image.anime-search-result.lazy(data-src=anime.ImageLink("small"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
component CharacterSearchResults(characters []*arn.Character, user *arn.User) component CharacterSearchResults(characters []*arn.Character, user *arn.User)
if len(characters) == 0 if len(characters) == 0

View File

@ -23,7 +23,7 @@ component SoundTracks(tracks []*arn.SoundTrack, nextIndex int, tag string, user
component SoundTracksScrollable(tracks []*arn.SoundTrack, user *arn.User) component SoundTracksScrollable(tracks []*arn.SoundTrack, user *arn.User)
each track in tracks each track in tracks
SoundTrack(track) SoundTrack(track, user)
component SoundTracksTabs(tag string) component SoundTracksTabs(tag string)
.tab-groups .tab-groups