Updated to latest aero version

This commit is contained in:
Eduard Urbach 2017-11-11 15:09:30 +01:00
parent 2c37bcf6dd
commit 560f87d3f2
3 changed files with 93 additions and 90 deletions

View File

@ -1,4 +1,4 @@
package layout package fullpage
import ( import (
"sort" "sort"

View File

@ -6,7 +6,6 @@ import (
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/auth" "github.com/animenotifier/notify.moe/auth"
"github.com/animenotifier/notify.moe/components/css" "github.com/animenotifier/notify.moe/components/css"
"github.com/animenotifier/notify.moe/layout"
"github.com/animenotifier/notify.moe/middleware" "github.com/animenotifier/notify.moe/middleware"
"github.com/animenotifier/notify.moe/pages" "github.com/animenotifier/notify.moe/pages"
) )
@ -23,9 +22,6 @@ func configure(app *aero.Application) *aero.Application {
app.Sessions.Duration = 3600 * 24 * 30 * 6 app.Sessions.Duration = 3600 * 24 * 30 * 6
app.Sessions.Store = nanostore.New(arn.DB.Collection("Session")) app.Sessions.Store = nanostore.New(arn.DB.Collection("Session"))
// Layout
app.Layout = layout.Render
// CSS // CSS
app.SetStyle(css.Bundle()) app.SetStyle(css.Bundle())

View File

@ -2,8 +2,10 @@ package pages
import ( import (
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/aerogo/layout"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/layout"
"github.com/animenotifier/notify.moe/pages/admin" "github.com/animenotifier/notify.moe/pages/admin"
"github.com/animenotifier/notify.moe/pages/anime" "github.com/animenotifier/notify.moe/pages/anime"
"github.com/animenotifier/notify.moe/pages/animelist" "github.com/animenotifier/notify.moe/pages/animelist"
@ -47,137 +49,142 @@ import (
// Configure registers the page routes in the application. // Configure registers the page routes in the application.
func Configure(app *aero.Application) { func Configure(app *aero.Application) {
layout := layout.New(app)
// Set render function for the layout
layout.Render = fullpage.Render
// Main menu // Main menu
app.Ajax("/", home.Get) layout.Page("/", home.Get)
app.Ajax("/explore", explore.Get) layout.Page("/explore", explore.Get)
app.Ajax("/explore/anime/:year/:status/:type", explore.Filter) layout.Page("/explore/anime/:year/:status/:type", explore.Filter)
app.Ajax("/login", login.Get) layout.Page("/login", login.Get)
app.Ajax("/api", apiview.Get) layout.Page("/api", apiview.Get)
// app.Ajax("/dashboard", dashboard.Get) // layout.Ajax("/dashboard", dashboard.Get)
// app.Ajax("/best/anime", best.Get) // layout.Ajax("/best/anime", best.Get)
// app.Ajax("/artworks", artworks.Get) // layout.Ajax("/artworks", artworks.Get)
// app.Ajax("/amvs", amvs.Get) // layout.Ajax("/amvs", amvs.Get)
// Forum // Forum
app.Ajax("/forum", forums.Get) layout.Page("/forum", forums.Get)
app.Ajax("/forum/:tag", forum.Get) layout.Page("/forum/:tag", forum.Get)
app.Ajax("/thread/:id", threads.Get) layout.Page("/thread/:id", threads.Get)
app.Ajax("/post/:id", posts.Get) layout.Page("/post/:id", posts.Get)
app.Ajax("/new/thread", newthread.Get) layout.Page("/new/thread", newthread.Get)
// User lists // User lists
app.Ajax("/users", users.Active) layout.Page("/users", users.Active)
app.Ajax("/users/osu", users.Osu) layout.Page("/users/osu", users.Osu)
app.Ajax("/users/staff", users.Staff) layout.Page("/users/staff", users.Staff)
// Statistics // Statistics
app.Ajax("/statistics", statistics.Get) layout.Page("/statistics", statistics.Get)
app.Ajax("/statistics/anime", statistics.Anime) layout.Page("/statistics/anime", statistics.Anime)
// Anime // Anime
app.Ajax("/anime/:id", anime.Get) layout.Page("/anime/:id", anime.Get)
app.Ajax("/anime/:id/episodes", anime.Episodes) layout.Page("/anime/:id/episodes", anime.Episodes)
app.Ajax("/anime/:id/characters", anime.Characters) layout.Page("/anime/:id/characters", anime.Characters)
app.Ajax("/anime/:id/tracks", anime.Tracks) layout.Page("/anime/:id/tracks", anime.Tracks)
app.Ajax("/anime/:id/edit", editanime.Get) layout.Page("/anime/:id/edit", editanime.Get)
// Characters // Characters
app.Ajax("/character/:id", character.Get) layout.Page("/character/:id", character.Get)
// Settings // Settings
app.Ajax("/settings", settings.Get(components.SettingsPersonal)) layout.Page("/settings", settings.Get(components.SettingsPersonal))
app.Ajax("/settings/accounts", settings.Get(components.SettingsAccounts)) layout.Page("/settings/accounts", settings.Get(components.SettingsAccounts))
app.Ajax("/settings/notifications", settings.Get(components.SettingsNotifications)) layout.Page("/settings/notifications", settings.Get(components.SettingsNotifications))
app.Ajax("/settings/apps", settings.Get(components.SettingsApps)) layout.Page("/settings/apps", settings.Get(components.SettingsApps))
app.Ajax("/settings/avatar", settings.Get(components.SettingsAvatar)) layout.Page("/settings/avatar", settings.Get(components.SettingsAvatar))
app.Ajax("/settings/formatting", settings.Get(components.SettingsFormatting)) layout.Page("/settings/formatting", settings.Get(components.SettingsFormatting))
app.Ajax("/settings/pro", settings.Get(components.SettingsPro)) layout.Page("/settings/pro", settings.Get(components.SettingsPro))
// Soundtracks // Soundtracks
app.Ajax("/soundtracks", soundtracks.Get) layout.Page("/soundtracks", soundtracks.Get)
app.Ajax("/soundtracks/from/:index", soundtracks.From) layout.Page("/soundtracks/from/:index", soundtracks.From)
app.Ajax("/soundtrack/:id", soundtrack.Get) layout.Page("/soundtrack/:id", soundtrack.Get)
app.Ajax("/soundtrack/:id/edit", soundtrack.Edit) layout.Page("/soundtrack/:id/edit", soundtrack.Edit)
// Groups // Groups
app.Ajax("/groups", groups.Get) layout.Page("/groups", groups.Get)
app.Ajax("/group/:id", group.Get) layout.Page("/group/:id", group.Get)
app.Ajax("/group/:id/edit", group.Edit) layout.Page("/group/:id/edit", group.Edit)
app.Ajax("/group/:id/forum", group.Forum) layout.Page("/group/:id/forum", group.Forum)
// User profiles // User profiles
app.Ajax("/user", user.Get) layout.Page("/user", user.Get)
app.Ajax("/user/:nick", profile.Get) layout.Page("/user/:nick", profile.Get)
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser) layout.Page("/user/:nick/threads", profile.GetThreadsByUser)
app.Ajax("/user/:nick/posts", profile.GetPostsByUser) layout.Page("/user/:nick/posts", profile.GetPostsByUser)
app.Ajax("/user/:nick/soundtracks", profile.GetSoundTracksByUser) layout.Page("/user/:nick/soundtracks", profile.GetSoundTracksByUser)
app.Ajax("/user/:nick/stats", profile.GetStatsByUser) layout.Page("/user/:nick/stats", profile.GetStatsByUser)
app.Ajax("/user/:nick/followers", profile.GetFollowers) layout.Page("/user/:nick/followers", profile.GetFollowers)
app.Ajax("/user/:nick/animelist", animelist.Get) layout.Page("/user/:nick/animelist", animelist.Get)
app.Ajax("/user/:nick/animelist/watching", animelist.FilterByStatus(arn.AnimeListStatusWatching)) layout.Page("/user/:nick/animelist/watching", animelist.FilterByStatus(arn.AnimeListStatusWatching))
app.Ajax("/user/:nick/animelist/completed", animelist.FilterByStatus(arn.AnimeListStatusCompleted)) layout.Page("/user/:nick/animelist/completed", animelist.FilterByStatus(arn.AnimeListStatusCompleted))
app.Ajax("/user/:nick/animelist/planned", animelist.FilterByStatus(arn.AnimeListStatusPlanned)) layout.Page("/user/:nick/animelist/planned", animelist.FilterByStatus(arn.AnimeListStatusPlanned))
app.Ajax("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold)) layout.Page("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold))
app.Ajax("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped)) layout.Page("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped))
app.Ajax("/user/:nick/animelist/anime/:id", animelistitem.Get) layout.Page("/user/:nick/animelist/anime/:id", animelistitem.Get)
// Anime list // Anime list
app.Ajax("/animelist/watching", home.FilterByStatus(arn.AnimeListStatusWatching)) layout.Page("/animelist/watching", home.FilterByStatus(arn.AnimeListStatusWatching))
app.Ajax("/animelist/completed", home.FilterByStatus(arn.AnimeListStatusCompleted)) layout.Page("/animelist/completed", home.FilterByStatus(arn.AnimeListStatusCompleted))
app.Ajax("/animelist/planned", home.FilterByStatus(arn.AnimeListStatusPlanned)) layout.Page("/animelist/planned", home.FilterByStatus(arn.AnimeListStatusPlanned))
app.Ajax("/animelist/hold", home.FilterByStatus(arn.AnimeListStatusHold)) layout.Page("/animelist/hold", home.FilterByStatus(arn.AnimeListStatusHold))
app.Ajax("/animelist/dropped", home.FilterByStatus(arn.AnimeListStatusDropped)) layout.Page("/animelist/dropped", home.FilterByStatus(arn.AnimeListStatusDropped))
// Compare // Compare
app.Ajax("/compare/animelist/:nick-1/:nick-2", compare.AnimeList) layout.Page("/compare/animelist/:nick-1/:nick-2", compare.AnimeList)
// Search // Search
app.Ajax("/search", search.Get) layout.Page("/search", search.Get)
app.Ajax("/search/:term", search.Get) layout.Page("/search/:term", search.Get)
// Shop // Shop
app.Ajax("/shop", shop.Get) layout.Page("/shop", shop.Get)
app.Ajax("/inventory", inventory.Get) layout.Page("/inventory", inventory.Get)
app.Ajax("/charge", charge.Get) layout.Page("/charge", charge.Get)
app.Ajax("/shop/history", shop.PurchaseHistory) layout.Page("/shop/history", shop.PurchaseHistory)
app.Post("/api/shop/buy/:item/:quantity", shop.BuyItem) app.Post("/api/shop/buy/:item/:quantity", shop.BuyItem)
// Admin // Admin
app.Ajax("/admin", admin.Get) layout.Page("/admin", admin.Get)
app.Ajax("/admin/webdev", admin.WebDev) layout.Page("/admin/webdev", admin.WebDev)
app.Ajax("/admin/purchases", admin.PurchaseHistory) layout.Page("/admin/purchases", admin.PurchaseHistory)
// Editor // Editor
app.Ajax("/editor", editor.Get) layout.Page("/editor", editor.Get)
app.Ajax("/editor/anilist", editor.AniList) layout.Page("/editor/anilist", editor.AniList)
app.Ajax("/editor/shoboi", editor.Shoboi) layout.Page("/editor/shoboi", editor.Shoboi)
// Mixed // Mixed
app.Ajax("/database", database.Get) layout.Page("/database", database.Get)
app.Get("/api/select/:data-type/where/:field/is/:field-value", database.Select) app.Get("/api/select/:data-type/where/:field/is/:field-value", database.Select)
// Import // Import
app.Ajax("/import", listimport.Get) layout.Page("/import", listimport.Get)
app.Ajax("/import/anilist/animelist", listimportanilist.Preview) layout.Page("/import/anilist/animelist", listimportanilist.Preview)
app.Ajax("/import/anilist/animelist/finish", listimportanilist.Finish) layout.Page("/import/anilist/animelist/finish", listimportanilist.Finish)
app.Ajax("/import/myanimelist/animelist", listimportmyanimelist.Preview) layout.Page("/import/myanimelist/animelist", listimportmyanimelist.Preview)
app.Ajax("/import/myanimelist/animelist/finish", listimportmyanimelist.Finish) layout.Page("/import/myanimelist/animelist/finish", listimportmyanimelist.Finish)
app.Ajax("/import/kitsu/animelist", listimportkitsu.Preview) layout.Page("/import/kitsu/animelist", listimportkitsu.Preview)
app.Ajax("/import/kitsu/animelist/finish", listimportkitsu.Finish) layout.Page("/import/kitsu/animelist/finish", listimportkitsu.Finish)
// Browser extension // Browser extension
app.Ajax("/extension/embed", embed.Get) layout.Page("/extension/embed", embed.Get)
// API // API
app.Get("/api/me", me.Get) app.Get("/api/me", me.Get)
app.Get("/api/test/notification", notifications.Test) app.Get("/api/test/notification", notifications.Test)
// PayPal // PayPal
app.Ajax("/paypal/success", paypal.Success) layout.Page("/paypal/success", paypal.Success)
app.Ajax("/paypal/cancel", paypal.Cancel) layout.Page("/paypal/cancel", paypal.Cancel)
app.Post("/api/paypal/payment/create", paypal.CreatePayment) app.Post("/api/paypal/payment/create", paypal.CreatePayment)
// Genres // Genres
// app.Ajax("/genres", genres.Get) // layout.Ajax("/genres", genres.Get)
// app.Ajax("/genres/:name", genre.Get) // layout.Ajax("/genres/:name", genre.Get)
} }