CSP update

This commit is contained in:
Eduard Urbach 2016-11-03 16:54:30 +09:00
parent 50db360272
commit b4e9b6a15e
6 changed files with 46 additions and 23 deletions

View File

@ -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) + ")")

View File

@ -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

View File

@ -0,0 +1,5 @@
h2
text-align center
.light-button
display inline-block

View File

@ -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) + ")")

View File

@ -1,9 +1,8 @@
component Layout(content string, css string) component Layout(content string)
html html
head head
title ARN 4.0 - Beta title ARN 4.0 - Beta
meta(name="viewport", content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes") meta(name="viewport", content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
style!= css
body body
#container #container
Header Header

View File

@ -20,12 +20,14 @@ func main() {
animeCSSBytes, _ := ioutil.ReadFile("anime.css") animeCSSBytes, _ := ioutil.ReadFile("anime.css")
css += string(animeCSSBytes) css += string(animeCSSBytes)
app.SetStyle(css)
scripts, _ := ioutil.ReadFile("scripts.js") scripts, _ := ioutil.ReadFile("scripts.js")
js := string(scripts) js := string(scripts)
// Define layout // Define layout
app.Layout = func(ctx *aero.Context, content string) string { 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 { app.Register("/", func(ctx *aero.Context) string {