start of a WIP past events page

This commit is contained in:
crunk 2021-02-06 17:08:07 +01:00
parent 608b6baacb
commit 8d80bb7c17
6 changed files with 54 additions and 23 deletions

View File

@ -3,7 +3,7 @@
import flask
from flask import render_template
from rnrfeed.rnrfeeder import getentries
from csvparser.csvparser import (
getlicenses,
getpublications,
@ -40,10 +40,11 @@ def show_book(publicationID):
return render_template("publication.html", fullpublication=fullpublication)
@APP.route("/<publication>")
def upload_book(publication):
"""upload a new book, still needs to be made"""
return render_template("upload.html")
@APP.route("/pastevents")
def pastevents():
"""show past events and book recommendations"""
events = getentries()
return render_template("pastevents.html", events=events)
if __name__ == "__main__":

View File

@ -7,7 +7,7 @@ feed = parse("http://varia.zone/en/feeds/all-en.rss.xml")
def getentries():
entries = {}
for entry in feed.entries:
if "Read & Repair" in entry.title:
if "readrepair" in entry.category:
entries[entry.title] = entry.description
return entries
@ -15,25 +15,29 @@ def getentries():
def gettitles():
titles = []
for entry in feed.entries:
if "Read & Repair" in entry.title:
if "readrepair" in entry.category:
titles.append(entry.title)
return titles
def rabbithole():
entries = getentries()
def rabbithole(entry):
pubtitles = []
fieldsofinterest = getfieldsofinterest()
for title, entry in entries.items():
entry = entry.lower()
for id, fields in fieldsofinterest.items():
if [f for f in fields if(f.lower() in entry)]:
publicationinfo = getfullpublication(id)
pubtitle = publicationinfo["Title"]
print(
"After {0} we recommend reading {1}".format(
title,
pubtitle)
)
pubtitles.append(pubtitle)
return pubtitles
print(rabbithole())
def getevents():
events = getentries()
for entry in events:
titles = rabbithole(entry)
print(titles)
return events
# print(rabbithole())

View File

@ -75,6 +75,19 @@ body:after {
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 {
z-index: 10;
border: 3px solid black;

View File

@ -17,8 +17,8 @@
</filter>
</svg>
<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="upcoming"><img src="{{ url_for('static', filename='svg/bookmark-upcoming.svg')}}" id="upcomingevents" /></a>
<a href="pastevents"><img src="{{ url_for('static', filename='svg/bookmark-past.svg')}}" id="pastevents" /></a>
<a href="upcomingevents"><img src="{{ url_for('static', filename='svg/bookmark-upcoming.svg')}}" id="upcomingevents" /></a>
{% block main %}
{% endblock main %}
</body>

View 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 %}