start of a WIP past events page
This commit is contained in:
parent
608b6baacb
commit
8d80bb7c17
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import flask
|
import flask
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
from rnrfeed.rnrfeeder import getentries
|
||||||
from csvparser.csvparser import (
|
from csvparser.csvparser import (
|
||||||
getlicenses,
|
getlicenses,
|
||||||
getpublications,
|
getpublications,
|
||||||
@ -40,10 +40,11 @@ def show_book(publicationID):
|
|||||||
return render_template("publication.html", fullpublication=fullpublication)
|
return render_template("publication.html", fullpublication=fullpublication)
|
||||||
|
|
||||||
|
|
||||||
@APP.route("/<publication>")
|
@APP.route("/pastevents")
|
||||||
def upload_book(publication):
|
def pastevents():
|
||||||
"""upload a new book, still needs to be made"""
|
"""show past events and book recommendations"""
|
||||||
return render_template("upload.html")
|
events = getentries()
|
||||||
|
return render_template("pastevents.html", events=events)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -7,7 +7,7 @@ feed = parse("http://varia.zone/en/feeds/all-en.rss.xml")
|
|||||||
def getentries():
|
def getentries():
|
||||||
entries = {}
|
entries = {}
|
||||||
for entry in feed.entries:
|
for entry in feed.entries:
|
||||||
if "Read & Repair" in entry.title:
|
if "readrepair" in entry.category:
|
||||||
entries[entry.title] = entry.description
|
entries[entry.title] = entry.description
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
@ -15,25 +15,29 @@ def getentries():
|
|||||||
def gettitles():
|
def gettitles():
|
||||||
titles = []
|
titles = []
|
||||||
for entry in feed.entries:
|
for entry in feed.entries:
|
||||||
if "Read & Repair" in entry.title:
|
if "readrepair" in entry.category:
|
||||||
titles.append(entry.title)
|
titles.append(entry.title)
|
||||||
return titles
|
return titles
|
||||||
|
|
||||||
|
|
||||||
def rabbithole():
|
def rabbithole(entry):
|
||||||
entries = getentries()
|
pubtitles = []
|
||||||
fieldsofinterest = getfieldsofinterest()
|
fieldsofinterest = getfieldsofinterest()
|
||||||
for title, entry in entries.items():
|
entry = entry.lower()
|
||||||
entry = entry.lower()
|
for id, fields in fieldsofinterest.items():
|
||||||
for id, fields in fieldsofinterest.items():
|
if [f for f in fields if(f.lower() in entry)]:
|
||||||
if [f for f in fields if(f.lower() in entry)]:
|
publicationinfo = getfullpublication(id)
|
||||||
publicationinfo = getfullpublication(id)
|
pubtitle = publicationinfo["Title"]
|
||||||
pubtitle = publicationinfo["Title"]
|
pubtitles.append(pubtitle)
|
||||||
print(
|
return pubtitles
|
||||||
"After {0} we recommend reading {1}".format(
|
|
||||||
title,
|
|
||||||
pubtitle)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
print(rabbithole())
|
def getevents():
|
||||||
|
events = getentries()
|
||||||
|
for entry in events:
|
||||||
|
titles = rabbithole(entry)
|
||||||
|
print(titles)
|
||||||
|
return events
|
||||||
|
|
||||||
|
|
||||||
|
# print(rabbithole())
|
||||||
|
@ -75,6 +75,19 @@ body:after {
|
|||||||
margin-top: 3em;
|
margin-top: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
margin: 0 1em 1em;
|
||||||
|
max-width: 90%;
|
||||||
|
margin-top: 3em;
|
||||||
|
padding: 6px;
|
||||||
|
display: block;
|
||||||
|
border: 3px solid black;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
border-spacing: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
border: 3px solid black;
|
border: 3px solid black;
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
</filter>
|
</filter>
|
||||||
</svg>
|
</svg>
|
||||||
<h1 id="varia">VARIA LIBRARY COLLECTION</h1>
|
<h1 id="varia">VARIA LIBRARY COLLECTION</h1>
|
||||||
<a href="/events"><img src="{{ url_for('static', filename='svg/bookmark-past.svg')}}" id="pastevents" /></a>
|
<a href="pastevents"><img src="{{ url_for('static', filename='svg/bookmark-past.svg')}}" id="pastevents" /></a>
|
||||||
<a href="upcoming"><img src="{{ url_for('static', filename='svg/bookmark-upcoming.svg')}}" id="upcomingevents" /></a>
|
<a href="upcomingevents"><img src="{{ url_for('static', filename='svg/bookmark-upcoming.svg')}}" id="upcomingevents" /></a>
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{% endblock main %}
|
{% endblock main %}
|
||||||
</body>
|
</body>
|
||||||
|
13
library/templates/pastevents.html
Normal file
13
library/templates/pastevents.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block main %}
|
||||||
|
<div id="nav" class="container">
|
||||||
|
<button id="leftmostbtn"><a href="/">All books</a></button>
|
||||||
|
<button><a href="/upload">Upload</a></button>
|
||||||
|
</div>
|
||||||
|
{% for title, text in events.items() %}
|
||||||
|
<div class="event">
|
||||||
|
<h2>{{ title }}</h2>
|
||||||
|
{{ text|safe }}
|
||||||
|
</div>
|
||||||
|
{% endfor%}
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user