From f9424a79e495a3e683bb01829cff91deac80df79 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 13 Nov 2016 01:40:16 +0900 Subject: [PATCH] Upgraded to latest pixy version --- .gitignore | 2 +- app.go => main.go | 10 ++++++++-- router.go | 9 +++++---- {components => templates}/anime/anime.pixy | 0 {components => templates}/anime/anime.styl | 0 {components => templates}/anime/anime.ts | 0 {components => templates}/dashboard.pixy | 0 {components => templates}/genres/genres.pixy | 0 {components => templates}/genres/genres.styl | 0 {components => templates}/icon.pixy | 0 {components => templates}/layout.pixy | 0 11 files changed, 14 insertions(+), 7 deletions(-) rename app.go => main.go (64%) rename {components => templates}/anime/anime.pixy (100%) rename {components => templates}/anime/anime.styl (100%) rename {components => templates}/anime/anime.ts (100%) rename {components => templates}/dashboard.pixy (100%) rename {components => templates}/genres/genres.pixy (100%) rename {components => templates}/genres/genres.styl (100%) rename {components => templates}/icon.pixy (100%) rename {components => templates}/layout.pixy (100%) diff --git a/.gitignore b/.gitignore index e3b35307..80552e2d 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ node_modules/ debug # pixy -$.go +/components # binaries /notify.moe \ No newline at end of file diff --git a/app.go b/main.go similarity index 64% rename from app.go rename to main.go index 34de8ce2..5c17a583 100644 --- a/app.go +++ b/main.go @@ -4,12 +4,14 @@ import ( "io/ioutil" "github.com/aerogo/aero" + "github.com/animenotifier/notify.moe/components" ) var app = aero.New() func main() { - app.SetStyle(bundledCSS) + // app.SetStyle(bundledCSS) + app.SetStyle("") scripts, _ := ioutil.ReadFile("temp/scripts.js") js := string(scripts) @@ -19,8 +21,12 @@ func main() { return js }) + app.Get("/hello", func(ctx *aero.Context) string { + return "Hello World" + }) + app.Layout = func(ctx *aero.Context, content string) string { - return Render.Layout(content) + return components.Layout(content) } app.Run() diff --git a/router.go b/router.go index a819e472..b66460f3 100644 --- a/router.go +++ b/router.go @@ -5,11 +5,12 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/arn" + "github.com/animenotifier/notify.moe/components" ) func init() { app.Ajax("/", func(ctx *aero.Context) string { - return ctx.HTML(Render.Dashboard()) + return ctx.HTML(components.Dashboard()) }) app.Ajax("/anime/:id", func(ctx *aero.Context) string { @@ -20,11 +21,11 @@ func init() { return ctx.Text("Anime not found") } - return ctx.HTML(Render.Anime(anime)) + return ctx.HTML(components.Anime(anime)) }) app.Ajax("/genres", func(ctx *aero.Context) string { - return ctx.HTML(Render.GenreOverview()) + return ctx.HTML(components.GenreOverview()) }) app.Ajax("/genres/:name", func(ctx *aero.Context) string { @@ -37,6 +38,6 @@ func init() { return err.Error() } - return ctx.HTML(Render.AnimeInGenre(genreInfo.Genre, genreInfo.AnimeList)) + return ctx.HTML(components.AnimeInGenre(genreInfo.Genre, genreInfo.AnimeList)) }) } diff --git a/components/anime/anime.pixy b/templates/anime/anime.pixy similarity index 100% rename from components/anime/anime.pixy rename to templates/anime/anime.pixy diff --git a/components/anime/anime.styl b/templates/anime/anime.styl similarity index 100% rename from components/anime/anime.styl rename to templates/anime/anime.styl diff --git a/components/anime/anime.ts b/templates/anime/anime.ts similarity index 100% rename from components/anime/anime.ts rename to templates/anime/anime.ts diff --git a/components/dashboard.pixy b/templates/dashboard.pixy similarity index 100% rename from components/dashboard.pixy rename to templates/dashboard.pixy diff --git a/components/genres/genres.pixy b/templates/genres/genres.pixy similarity index 100% rename from components/genres/genres.pixy rename to templates/genres/genres.pixy diff --git a/components/genres/genres.styl b/templates/genres/genres.styl similarity index 100% rename from components/genres/genres.styl rename to templates/genres/genres.styl diff --git a/components/icon.pixy b/templates/icon.pixy similarity index 100% rename from components/icon.pixy rename to templates/icon.pixy diff --git a/components/layout.pixy b/templates/layout.pixy similarity index 100% rename from components/layout.pixy rename to templates/layout.pixy