commit
6bb95fb52e
11 changed files with 277 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,24 @@ |
|||
import csv |
|||
import os |
|||
|
|||
script_dir = os.path.dirname(__file__) |
|||
|
|||
|
|||
def parsecsv(): |
|||
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r") |
|||
with libcsv: |
|||
csv_as_dict = csv.DictReader(libcsv) |
|||
return csv_as_dict |
|||
|
|||
|
|||
def getpublications(): |
|||
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r") |
|||
with libcsv: |
|||
csv_as_dict = csv.DictReader(libcsv) |
|||
listofbooks = [] |
|||
for row in csv_as_dict: |
|||
listofbooks.append(row["Publication"]) |
|||
return listofbooks |
|||
|
|||
|
|||
parsecsv() |
@ -0,0 +1,36 @@ |
|||
"""This is the main flask page code""" |
|||
|
|||
|
|||
import flask |
|||
from flask import render_template |
|||
|
|||
from csvparser.csvparser import getpublications |
|||
|
|||
APP = flask.Flask(__name__, static_folder="static") |
|||
|
|||
|
|||
@APP.route("/") |
|||
def index(): |
|||
"""Main path""" |
|||
# parse csv, render template with a few elements from the csv |
|||
titles = getpublications() |
|||
return render_template("index.html", titles=titles) |
|||
|
|||
|
|||
@APP.route("/<publication>") |
|||
def show_book(publication): |
|||
"""Path for a publication""" |
|||
# parse csv, render template with full list. |
|||
return render_template("publication.html", publication=publication) |
|||
|
|||
|
|||
@APP.route("/<publication>") |
|||
def upload_book(publication): |
|||
"""upload a new book""" |
|||
# |
|||
return render_template("upload form") |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
APP.debug = True |
|||
APP.run(port=5000) |
@ -0,0 +1,56 @@ |
|||
html, body { |
|||
margin: 0; |
|||
} |
|||
|
|||
body:after { |
|||
font-size: .8em; |
|||
background-color: #EB4377; |
|||
/*color: rgba(223, 183, 180, .3);*/ |
|||
position: fixed; |
|||
width: 100%; |
|||
bottom: 1em; |
|||
text-align: center; |
|||
} |
|||
|
|||
#cloud { |
|||
overflow: hidden; |
|||
width: 1px; height: 1px; |
|||
transform: translate(-100%, -100%); |
|||
border-radius: 50%; |
|||
filter: url(#filter); |
|||
z-index: -1; |
|||
} |
|||
|
|||
@font-face { |
|||
font-family: alphaClouds; |
|||
src: url(../fonts/AlphaClouds.ttf); |
|||
} |
|||
|
|||
#varia { |
|||
line-height: 1.03em; |
|||
position: absolute; |
|||
top: 10%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
color: #FFFFFF; |
|||
text-shadow: 2px 2px #8B5B7F; |
|||
font-size: 60px; |
|||
text-align: center; |
|||
font-family: alphaClouds; |
|||
mix-blend-mode: exclusion; |
|||
} |
|||
@supports (-webkit-text-stroke: 1px lightpink) { |
|||
#varia { |
|||
-webkit-text-stroke: 1px lightpink; |
|||
} |
|||
} |
|||
.container { |
|||
margin 0 auto; |
|||
} |
|||
button { |
|||
z-index: 10; |
|||
border: 5px solid black; |
|||
color: black; |
|||
min-width: auto; |
|||
background-color: white; |
|||
} |
Binary file not shown.
@ -0,0 +1,26 @@ |
|||
function rn(from, to) { |
|||
return ~~(Math.random() * (to - from + 1)) + from; |
|||
} |
|||
|
|||
function rs() { |
|||
return arguments[rn(1, arguments.length) - 1]; |
|||
} |
|||
|
|||
function boxShadows(max) { |
|||
let ret = []; |
|||
for (let i = 0; i < max; ++i) { |
|||
ret.push(` |
|||
${ rn(1, 100) }vw ${ rn(1, 100) }vh ${ rn(20, 40) }vmin ${ rn(1, 20) }vmin |
|||
${ rs('#F52D75', '#CCBD4F', '#32497F', '#EB4377') } |
|||
`)
|
|||
} |
|||
return ret.join(','); |
|||
} |
|||
|
|||
const cloud = document.querySelector('#cloud'); |
|||
function update() { |
|||
cloud.style.boxShadow = boxShadows(120); |
|||
} |
|||
|
|||
window.addEventListener('load', update); |
|||
document.addEventListener('click', update); |
@ -0,0 +1,76 @@ |
|||
html, body { |
|||
margin: 0; |
|||
} |
|||
|
|||
body:after { |
|||
font-size: .8em; |
|||
background-color: #EB4377; |
|||
/*color: rgba(223, 183, 180, .3);*/ |
|||
position: fixed; |
|||
width: 100%; |
|||
bottom: 1em; |
|||
text-align: center; |
|||
} |
|||
|
|||
#cloud { |
|||
overflow: hidden; |
|||
width: 1px; height: 1px; |
|||
transform: translate(-100%, -100%); |
|||
border-radius: 50%; |
|||
filter: url(#filter); |
|||
} |
|||
|
|||
@font-face { |
|||
font-family: alphaClouds; |
|||
src: url(../fonts/AlphaClouds.ttf); |
|||
} |
|||
|
|||
#varia { |
|||
line-height: 1.03em; |
|||
position: absolute; |
|||
top: 10%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
color: #FFFFFF; |
|||
text-shadow: 2px 2px #8B5B7F; |
|||
font-size: 60px; |
|||
text-align: center; |
|||
font-family: alphaClouds; |
|||
} |
|||
|
|||
.container { |
|||
margin 0 auto; |
|||
width: 100vw; |
|||
display: grid; |
|||
grid-template-columns: 250px 250px 250px 250px; |
|||
grid-template-rows: 200px 200px 200px; |
|||
grid-column-gap: 10px; |
|||
grid-row-gap: 15px; |
|||
justify-content: space-evenly; |
|||
} |
|||
.item-a { |
|||
z-index: 10; |
|||
border: 5px solid black; |
|||
color: black; |
|||
min-width: auto; |
|||
background-color: white; |
|||
} |
|||
.item-b { |
|||
z-index: 10; |
|||
border: 5px solid black; |
|||
width: auto; |
|||
background-color: white; |
|||
} |
|||
.item-c { |
|||
z-index: 10; |
|||
border: 5px solid black; |
|||
width: auto; |
|||
background-color: white; |
|||
} |
|||
|
|||
td, th { |
|||
border: 1px solid black; |
|||
} |
|||
table { |
|||
border-collapse: collapse; |
|||
} |
@ -0,0 +1,28 @@ |
|||
<!DOCTYPE html> |
|||
<html lang='en'> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<title>varia library zone</title> |
|||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css')}}"> |
|||
</head> |
|||
<body> |
|||
<div id="cloud"></div> |
|||
<svg width="0"> |
|||
<filter id="filter"> |
|||
<feTurbulence type="fractalNoise" |
|||
baseFrequency=".001" numOctaves="7" /> |
|||
<feDisplacementMap in="SourceGraphic" scale="240" /> |
|||
</filter> |
|||
</svg> |
|||
<h1 id="varia">VARIA LIBRARY COLLECTION</h1> |
|||
<div id="nav" class="container"> |
|||
<a href="/"><button>index</button></a> |
|||
<a href="/upload"><button>upload</button></a> |
|||
</div> |
|||
<div id="main"> |
|||
{% block main %} |
|||
{% endblock %} |
|||
</div> |
|||
</body> |
|||
<script src="{{ url_for('static', filename='js/script.js')}}"></script> |
|||
</html> |
@ -0,0 +1,9 @@ |
|||
{% extends "base.html" %} |
|||
|
|||
{% block main %} |
|||
|
|||
{% for titles in titles %} |
|||
<a href="{{ titles }}">{{ titles }}</a> |
|||
{% endfor%} |
|||
|
|||
{% endblock %} |
Loading…
Reference in new issue