From b4e9b6a15e8e9b1d97c6db3b4b70a4c26064ee8b Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 3 Nov 2016 16:54:30 +0900 Subject: [PATCH] CSP update --- components/genres.pixy | 20 -------------------- components/genres/AnimeInGenre.styl | 22 ++++++++++++++++++++++ components/genres/GenreOverview.styl | 5 +++++ components/genres/genres.pixy | 15 +++++++++++++++ components/layout.pixy | 3 +-- main.go | 4 +++- 6 files changed, 46 insertions(+), 23 deletions(-) delete mode 100644 components/genres.pixy create mode 100644 components/genres/AnimeInGenre.styl create mode 100644 components/genres/GenreOverview.styl create mode 100644 components/genres/genres.pixy diff --git a/components/genres.pixy b/components/genres.pixy deleted file mode 100644 index b84dd3d7..00000000 --- a/components/genres.pixy +++ /dev/null @@ -1,20 +0,0 @@ -component GenreOverview - // TODO: Add this to the stylus file later - style!= "h2{ text-align: center; } .light-button{ display: inline-block; }" - section - header - h2 Genres - - div - each genre in Genres - a.light-button.ajax(href="/genres/" + arn.FixGenre(genre)) - Icon(GenreIcons[genre]) - span= genre - -component AnimeInGenre(genre string, animeList []*arn.Anime) - style!= "h2 { 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; }" - h2= "#" + genre - .genre-anime-list - each anime in animeList - a.genre-anime-link.ajax(href="/anime/" + s(anime.ID)) - img.anime-image.genre-anime-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + s(anime.Watching) + ")") \ No newline at end of file diff --git a/components/genres/AnimeInGenre.styl b/components/genres/AnimeInGenre.styl new file mode 100644 index 00000000..a6bb2bfd --- /dev/null +++ b/components/genres/AnimeInGenre.styl @@ -0,0 +1,22 @@ +h2 + 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 \ No newline at end of file diff --git a/components/genres/GenreOverview.styl b/components/genres/GenreOverview.styl new file mode 100644 index 00000000..d98f9832 --- /dev/null +++ b/components/genres/GenreOverview.styl @@ -0,0 +1,5 @@ +h2 + text-align center + +.light-button + display inline-block \ No newline at end of file diff --git a/components/genres/genres.pixy b/components/genres/genres.pixy new file mode 100644 index 00000000..5cdf0ac8 --- /dev/null +++ b/components/genres/genres.pixy @@ -0,0 +1,15 @@ +component GenreOverview + h2 Genres + + div + each genre in Genres + a.light-button.ajax(href="/genres/" + arn.FixGenre(genre)) + Icon(GenreIcons[genre]) + span= genre + +component AnimeInGenre(genre string, animeList []*arn.Anime) + h2= "#" + genre + .genre-anime-list + each anime in animeList + a.genre-anime-link.ajax(href="/anime/" + s(anime.ID)) + img.anime-image.genre-anime-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + s(anime.Watching) + ")") \ No newline at end of file diff --git a/components/layout.pixy b/components/layout.pixy index e1f30705..6627251b 100644 --- a/components/layout.pixy +++ b/components/layout.pixy @@ -1,9 +1,8 @@ -component Layout(content string, css string) +component Layout(content string) html head title ARN 4.0 - Beta meta(name="viewport", content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes") - style!= css body #container Header diff --git a/main.go b/main.go index 3c4e0583..67a7695d 100644 --- a/main.go +++ b/main.go @@ -20,12 +20,14 @@ func main() { animeCSSBytes, _ := ioutil.ReadFile("anime.css") css += string(animeCSSBytes) + app.SetStyle(css) + scripts, _ := ioutil.ReadFile("scripts.js") js := string(scripts) // Define layout app.Layout = func(ctx *aero.Context, content string) string { - return Render.Layout(content, css) + return Render.Layout(content) } app.Register("/", func(ctx *aero.Context) string {