New genre overview

This commit is contained in:
2016-11-19 23:54:31 +09:00
parent 95ddd6774b
commit e17f377dc6
19 changed files with 220 additions and 147 deletions

19
pages/anime/anime.go Normal file
View File

@ -0,0 +1,19 @@
package anime
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
id, _ := ctx.GetInt("id")
anime, err := arn.GetAnime(id)
if err != nil {
return ctx.Text("Anime not found")
}
return ctx.HTML(components.Anime(anime))
}

14
pages/beta/beta.pixy Normal file
View File

@ -0,0 +1,14 @@
component Beta
section
header
h2 The future
p Shht! The next version of notify.moe is currently being built here.
hr
ul
li
a.ajax(href="/anime/21499") Sousei no Onmyouji
li
a.ajax(href="/anime/1000001") RWBY
li
a(href="/api/anime/1000001") RWBY (JSON API)

View File

@ -0,0 +1,11 @@
package dashboard
import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
return ctx.HTML(components.Dashboard())
}

View File

@ -1,17 +1,4 @@
component Dashboard
section
header
h2 ARN 4.0
p Shht! The next version of notify.moe is currently being built here.
hr
ul
li
a.ajax(href="/anime/21499") Sousei no Onmyouji
li
a.ajax(href="/anime/1000001") RWBY
li
a(href="/api/anime/1000001") RWBY (JSON API)
li
a.ajax(href="/genres") Genre Overview
li
a(href="/all/anime") All anime titles on notify.moe (text file)
h2 Dash

29
pages/forum/forum.go Normal file
View File

@ -0,0 +1,29 @@
package forum
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const threadsPerPage = 20
// Get ...
func Get(ctx *aero.Context) string {
tag := ctx.Get("tag")
threads, _ := arn.GetThreadsByTag(tag)
sort.Sort(threads)
if len(threads) > threadsPerPage {
threads = threads[:threadsPerPage]
}
for _, thread := range threads {
thread.Init()
}
return ctx.HTML(components.Forum(threads))
}

21
pages/genre/genre.go Normal file
View File

@ -0,0 +1,21 @@
package genre
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
genreName := ctx.Get("name")
genreInfo := new(arn.Genre)
err := arn.GetObject("Genres", genreName, genreInfo)
if err != nil {
return err.Error()
}
return ctx.HTML(components.Genre(genreInfo.Genre, genreInfo.AnimeList))
}

6
pages/genre/genre.pixy Normal file
View File

@ -0,0 +1,6 @@
component Genre(genre string, animeList []*arn.Anime)
h2.genre-header= arn.Capitalize(genre)
.grid
each anime in animeList
a.grid-cell.ajax(href="/anime/" + toString(anime.ID))
img.anime-image.grid-cell-content.grid-cell-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + toString(anime.Watching) + ")")

28
pages/genre/genre.styl Normal file
View File

@ -0,0 +1,28 @@
.grid
display flex
flex-flow row wrap
float none !important
justify-content center
.grid-cell
margin 0.5em
flex-grow 0
flex-shrink 0
.grid-cell-content
width 16vw
height 9vw
min-width 90px
min-height 127px
max-width 200px
max-height 282px
.grid-cell-image
object-fit cover
.grid-cell-text
display flex
flex-flow column
align-items center
justify-content center
padding 0.75em

11
pages/genres/genres.go Normal file
View File

@ -0,0 +1,11 @@
package genres
import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
return ctx.HTML(components.Genres())
}

View File

@ -1,15 +1,9 @@
component GenreOverview
component Genres
h2.genre-header Genres
div
.grid
each genre in arn.Genres
a.light-button.ajax(href="/genres/" + arn.FixGenre(genre))
Icon(arn.GetGenreIcon(genre))
span= genre
component AnimeInGenre(genre string, animeList []*arn.Anime)
h2.genre-header= arn.Capitalize(genre)
.genre-anime-list
each anime in animeList
a.genre-anime-link.ajax(href="/anime/" + toString(anime.ID))
img.anime-image.genre-anime-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + toString(anime.Watching) + ")")
a.grid-cell.light-button.ajax(href="/genres/" + arn.FixGenre(genre))
.genre.grid-cell-content.grid-cell-text
Icon(arn.GetGenreIcon(genre))
span= genre

View File

@ -1,22 +1,9 @@
.genre-header
text-align center
.genre-anime-list
display flex
flex-flow row wrap
float none !important
justify-content center
.genre-anime-image
width 16vw
height 9vw
min-width 90px
min-height 127px
max-width 200px
max-height 282px
object-fit cover
.genre-anime-link
margin 0.5em
flex-grow 0
flex-shrink 0
.genre
font-size 1rem
.fa
font-size 2rem
margin-right 0
margin-bottom 1rem

33
pages/threads/threads.go Normal file
View File

@ -0,0 +1,33 @@
package threads
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
thread, err := arn.GetThread(id)
if err != nil {
return ctx.Text("Thread not found")
}
thread.Author, _ = arn.GetUser(thread.AuthorID)
replies, filterErr := arn.FilterPosts(func(post *arn.Post) bool {
return post.ThreadID == thread.ID
})
sort.Sort(replies)
if filterErr != nil {
return ctx.Text("Error fetching thread replies")
}
return ctx.HTML(components.Thread(thread, replies))
}

View File

@ -1,16 +1,15 @@
component Thread(thread *arn.Thread)
component Thread(thread *arn.Thread, posts []*arn.Post)
.thread
h2.thread-title= thread.Title
.posts
Post(thread.ToPostable(), nil, "Threads", "Thread", thread.AuthorID)
//- +renderMessage(thread, user, "Threads", thread.author.ID)
Post(thread.ToPostable(), nil, "Threads", "Thread", thread.Author.ID)
//- each post in posts
//- +renderMessage(post, user, "Posts", thread.author.ID)
each post in posts
Post(post.ToPostable(), nil, "Posts", "Post", thread.Author.ID)
component Post(post arn.Postable, viewUser *arn.User, postType string, postTypeSingular string, highlightAuthorID string)
.post(class=[]string{"", "special-post"}[post.Author().ID == highlightAuthorID])
.post(data-highlight=post.Author().ID == highlightAuthorID)
.post-author
Avatar(post.Author())