From 7579c52188811c1f8c5a1ffc482ed45efaab1b7d Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sat, 8 Jul 2017 21:11:03 +0200 Subject: [PATCH] Editor page --- main.go | 40 +++++++++++++++++++---------- pages/anime/anime.pixy | 4 +-- pages/anime/episode.scarlet | 2 +- pages/editor/editor.go | 27 +++++++++++++++++++ pages/editor/editor.pixy | 14 ++++++++++ pages/listimport/listimport.scarlet | 6 +---- styles/table.scarlet | 2 ++ 7 files changed, 74 insertions(+), 21 deletions(-) create mode 100644 pages/editor/editor.go create mode 100644 pages/editor/editor.pixy diff --git a/main.go b/main.go index 31b25a84..a52e76dd 100644 --- a/main.go +++ b/main.go @@ -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()) diff --git a/pages/anime/anime.pixy b/pages/anime/anime.pixy index 6461d1e6..d2f31656 100644 --- a/pages/anime/anime.pixy +++ b/pages/anime/anime.pixy @@ -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 diff --git a/pages/anime/episode.scarlet b/pages/anime/episode.scarlet index f8353360..2e06b9d9 100644 --- a/pages/anime/episode.scarlet +++ b/pages/anime/episode.scarlet @@ -1,5 +1,5 @@ .episodes - // + max-width 100% .episode horizontal diff --git a/pages/editor/editor.go b/pages/editor/editor.go new file mode 100644 index 00000000..73de1f37 --- /dev/null +++ b/pages/editor/editor.go @@ -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)) +} diff --git a/pages/editor/editor.pixy b/pages/editor/editor.pixy new file mode 100644 index 00000000..f9a1cd52 --- /dev/null +++ b/pages/editor/editor.pixy @@ -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 diff --git a/pages/listimport/listimport.scarlet b/pages/listimport/listimport.scarlet index 63b8d829..5f42a32f 100644 --- a/pages/listimport/listimport.scarlet +++ b/pages/listimport/listimport.scarlet @@ -1,6 +1,2 @@ .buttons-vertical - width 100% - -.import-list - max-width table-width-normal - margin 0 auto \ No newline at end of file + width 100% \ No newline at end of file diff --git a/styles/table.scarlet b/styles/table.scarlet index 95095801..713df6bc 100644 --- a/styles/table.scarlet +++ b/styles/table.scarlet @@ -1,5 +1,7 @@ table width 100% + max-width table-width-normal + margin 0 auto tr border-bottom-width 1px