Added basic anime list item view
This commit is contained in:
@ -1,19 +1,23 @@
|
||||
package anime
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"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 {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
anime, err := arn.GetAnime(id)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(404, "Anime not found", err)
|
||||
return ctx.Error(http.StatusNotFound, "Anime not found", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Anime(anime))
|
||||
return ctx.HTML(components.Anime(anime, user))
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
component Anime(anime *arn.Anime)
|
||||
component Anime(anime *arn.Anime, user *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.Romaji)
|
||||
img.anime-cover-image(src=anime.Image.Small, alt=anime.Title.Canonical)
|
||||
|
||||
.space
|
||||
|
||||
@ -13,13 +13,18 @@ component Anime(anime *arn.Anime)
|
||||
//- span.second-title(title=anime.Title.English !== anime.Title.Romaji ? anime.Title.English : null)= anime.Title.Romaji
|
||||
//- else
|
||||
if anime.Title.Japanese != anime.Title.Canonical
|
||||
a.anime-alternative-title(href="http://jisho.org/search/" + anime.Title.Japanese, target="_blank", title="Look up reading on jisho.org", rel="nofollow")= anime.Title.Japanese
|
||||
.anime-alternative-title
|
||||
a(href="http://jisho.org/search/" + anime.Title.Japanese, target="_blank", title="Look up reading on jisho.org", rel="nofollow")= anime.Title.Japanese
|
||||
|
||||
//- h3.anime-section-name.anime-summary-header Summary
|
||||
p.anime-summary= anime.Summary
|
||||
|
||||
.anime-actions
|
||||
a.light-button.action-button(href="#") Add to collection
|
||||
if user != nil
|
||||
.anime-actions
|
||||
if user.AnimeList().Contains(anime.ID)
|
||||
a.button.ajax(href="/+" + user.Nick + "/animelist/" + anime.ID) View in collection
|
||||
else
|
||||
button Add to collection
|
||||
|
||||
h3.anime-section-name Ratings
|
||||
.anime-rating-categories
|
||||
|
@ -39,12 +39,14 @@
|
||||
.anime-alternative-title
|
||||
font-size 0.9em
|
||||
margin-bottom 0.5rem
|
||||
color rgba(60, 60, 60, 0.5) !important
|
||||
a
|
||||
color rgba(60, 60, 60, 0.5) !important
|
||||
|
||||
.anime-actions
|
||||
horizontal
|
||||
justify-content center
|
||||
margin content-padding 0
|
||||
z-index 10
|
||||
|
||||
> 900px
|
||||
.anime-actions
|
||||
|
Reference in New Issue
Block a user