start of a WIP past events page
This commit is contained in:
parent
608b6baacb
commit
8d80bb7c17
@ -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__":
|
||||
|
@ -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)
|
||||
)
|
||||
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"]
|
||||
pubtitles.append(pubtitle)
|
||||
return pubtitles
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
|
@ -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>
|
||||
|
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