Editor page

This commit is contained in:
Eduard Urbach 2017-07-08 21:11:03 +02:00
parent 0be7eca8cd
commit 7579c52188
7 changed files with 74 additions and 21 deletions

40
main.go
View File

@ -17,6 +17,7 @@ import (
"github.com/animenotifier/notify.moe/pages/best"
"github.com/animenotifier/notify.moe/pages/dashboard"
"github.com/animenotifier/notify.moe/pages/editanime"
"github.com/animenotifier/notify.moe/pages/editor"
"github.com/animenotifier/notify.moe/pages/embed"
"github.com/animenotifier/notify.moe/pages/explore"
"github.com/animenotifier/notify.moe/pages/forum"
@ -73,6 +74,14 @@ func configure(app *aero.Application) *aero.Application {
app.Ajax("/threads/:id", threads.Get)
app.Ajax("/posts/:id", posts.Get)
app.Ajax("/tracks/:id", tracks.Get)
app.Ajax("/new/thread", newthread.Get)
app.Ajax("/new/soundtrack", newsoundtrack.Get)
app.Ajax("/settings", settings.Get)
app.Ajax("/music", music.Get)
app.Ajax("/users", users.Get)
app.Ajax("/login", login.Get)
// User profiles
app.Ajax("/user", user.Get)
app.Ajax("/user/:nick", profile.Get)
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser)
@ -85,27 +94,32 @@ func configure(app *aero.Application) *aero.Application {
app.Ajax("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold))
app.Ajax("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped))
app.Ajax("/user/:nick/animelist/anime/:id", animelistitem.Get)
app.Ajax("/new/thread", newthread.Get)
app.Ajax("/new/soundtrack", newsoundtrack.Get)
app.Ajax("/settings", settings.Get)
app.Ajax("/music", music.Get)
// Search
app.Ajax("/search", search.Get)
app.Ajax("/search/:term", search.Get)
// Admin
app.Ajax("/admin", admin.Get)
app.Ajax("/editor", editor.Get)
app.Ajax("/statistics", statistics.Get)
app.Ajax("/statistics/anime", statistics.Anime)
app.Ajax("/webdev", webdev.Get)
// Import
app.Ajax("/import", listimport.Get)
app.Ajax("/import/anilist/animelist", listimportanilist.Preview)
app.Ajax("/import/anilist/animelist/finish", listimportanilist.Finish)
app.Ajax("/import/myanimelist/animelist", listimportmyanimelist.Preview)
app.Ajax("/import/myanimelist/animelist/finish", listimportmyanimelist.Finish)
app.Ajax("/admin", admin.Get)
app.Ajax("/statistics", statistics.Get)
app.Ajax("/statistics/anime", statistics.Anime)
app.Ajax("/search", search.Get)
app.Ajax("/search/:term", search.Get)
app.Ajax("/users", users.Get)
app.Ajax("/login", login.Get)
app.Ajax("/webdev", webdev.Get)
app.Ajax("/extension/embed", embed.Get)
// Genres
// app.Ajax("/genres", genres.Get)
// app.Ajax("/genres/:name", genre.Get)
// Browser extension
app.Ajax("/extension/embed", embed.Get)
// Middleware
app.Use(middleware.Log())
app.Use(middleware.Session())

View File

@ -152,8 +152,8 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User, epis
h3.anime-section-name Latest episodes
else
h3.anime-section-name Episodes
table
tbody.episodes
table.episodes
tbody
each episode in anime.Episodes
tr.episode
td.episode-number= episode.Number

View File

@ -1,5 +1,5 @@
.episodes
//
max-width 100%
.episode
horizontal

27
pages/editor/editor.go Normal file
View File

@ -0,0 +1,27 @@
package editor
import (
"net/http"
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
return anime.GetMapping("anilist/anime") == ""
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "Couldn't filter anime", err)
}
sort.Slice(missing, func(i, j int) bool {
return missing[i].StartDate > missing[j].StartDate
})
return ctx.HTML(components.AniListMissingMapping(missing))
}

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

@ -0,0 +1,14 @@
component AniListMissingMapping(missing []*arn.Anime)
h1 Anime without Anilist links
table
tbody
each anime in missing
tr
td
if len(anime.StartDate) >= 4
span= anime.StartDate[:4]
td
a(href=anime.Link(), target="_blank", rel="noopener")= anime.Title.Canonical
td
a(href="https://anilist.co/search?type=anime&q=" + anime.Title.Canonical, target="_blank", rel="noopener") Search

View File

@ -1,6 +1,2 @@
.buttons-vertical
width 100%
.import-list
max-width table-width-normal
margin 0 auto
width 100%

View File

@ -1,5 +1,7 @@
table
width 100%
max-width table-width-normal
margin 0 auto
tr
border-bottom-width 1px