diff --git a/app.py b/app.py index 10a1a13..241f144 100644 --- a/app.py +++ b/app.py @@ -15,6 +15,7 @@ class WikiApp(Flask): self.route('/', methods=['GET'])(self.homepage) self.route('/', methods=['GET'])(self.page_content) self.route('/favicon.ico')(self.favicon) + self.route('/archive/', methods=['GET'])(self.get_collection) def fetch_pages_cat(self, category_page_list): all_pages_string = '|'.join(page for pages in category_page_list.values() for page in pages) @@ -45,10 +46,10 @@ class WikiApp(Flask): def fetch_all_pages(self, categories): category_page_list = {} - for category in categories: response = requests.get(self.MEDIAWIKI_BASE_URL + self.BASE_API, params={'action': 'ask', 'query': '[[Concept:'+category+']]|?Article:Date', 'format': 'json', 'formatversion': '2'}) data = response.json() + print(data) page_title_timestamps = {} for page_title, page_data in data['query']['results'].items(): if 'printouts' in page_data and 'Article:Date' in page_data['printouts']: @@ -142,6 +143,12 @@ class WikiApp(Flask): for img in thumbnail: img.decompose() return soup + + def get_collection(self, collection): + resp = self.fetch_all_pages([collection]) + data = self.fetch_pages_cat(resp) + return render_template('collection.html', nav_elements=self.get_nav_menu(), title=collection, collection=resp[collection]) + # Route for favicon.ico to prevent Flask from raising an error def favicon(self): return Response('', status=200) diff --git a/static/assets/styles.css b/static/assets/styles.css index a51c6c1..9dd2ffa 100644 --- a/static/assets/styles.css +++ b/static/assets/styles.css @@ -100,8 +100,11 @@ body { height: 100vh; margin-left: 40px; margin-top: 100px; - padding-right: 400px; + margin-right: 40px; +} +.article-cont { + width: 60%; } .content-cont h1{ @@ -129,7 +132,7 @@ body { line-height: 30px; } -.content-cont a { +.content-cont .article-cont a { color: black; text-decoration: none; background-color: white; @@ -171,13 +174,67 @@ body { } .section-cont { - width: 100% ; + width: 100vw; height: 100vh; display: flex; flex-direction: row; justify-content: space-between; } +.collection-cont { + width: 100% ; + height: 100vh; + display: flex; + flex-direction: row; + justify-content: space-evenly; + align-content: baseline; + flex-wrap: wrap; + gap:60px; +} + +.collection-title { + border: 2px; + border-radius: 20px; + border-style: solid; + border-color: white; + padding: 10px; +} + +.collection-element { + display: flex; + flex-direction: column; + align-items: center; + row-gap: 20px; +} + +.collection-header{ + font-size: 20px; + margin-top: 40px; +} + +.content-cont .collection-cont a { + text-decoration: underline; + color: white; +} + +.collection-cont .section-img{ + width: 100%; + padding-left: 0px; + margin-bottom: 0px; +} + +.collection-cont .section-img img{ + width: 100%; + height: auto; + max-width: 200px; + object-fit: contain; + border-radius: 0px; + border: white; + border-style: dashed; + transition: transform 0.3s ease-in-out; +} + + .section { width: calc(100% / 3); /* Each div takes up one-third of the container */ display: flex; @@ -242,9 +299,14 @@ body { align-items: center; } +.section-header{ + text-decoration: none; +} + .footer { position: absolute; right: 0px; + display: none; top: 25px; z-index: 500; } diff --git a/templates/article.html b/templates/article.html index 995b6d9..f06c7f9 100644 --- a/templates/article.html +++ b/templates/article.html @@ -3,8 +3,9 @@ {% block content %}

{{ title }}

- - {{ content | safe }} +
+ {{ content | safe }} +
diff --git a/templates/base.html b/templates/base.html index 7475e8a..5284fc1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -15,6 +15,8 @@ {% for key, element in nav_elements.items() %} {% endfor %} + + @@ -25,6 +27,6 @@ + diff --git a/templates/collection.html b/templates/collection.html new file mode 100644 index 0000000..e19db74 --- /dev/null +++ b/templates/collection.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} +{% block title %}Ø | {{ title }}{% endblock %} +{% block content %} +
+
{{ '(' + title + ')'}}
+
+ {% for key, values in collection.items() %} + +
+
{{ key }}
+
{{ values.date }}
+
+
+ + {% endfor %} + +
+
+
+ +{% endblock %} diff --git a/templates/home.html b/templates/home.html index b7dea9e..52b8924 100644 --- a/templates/home.html +++ b/templates/home.html @@ -3,7 +3,7 @@ {% block content %}
-
articles 
+
articles 
{% for key, values in articles.items() %} @@ -13,7 +13,7 @@
-
newsletters
+
newsletters
{% for key, values in newsletters.items() %} @@ -23,7 +23,7 @@
-
projects
+
projects
{% for key, values in projects.items() %}