From 4126bdc596551ab71456f45389b9a7f0f55dc25f Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 9 Mar 2020 18:19:26 -0500 Subject: [PATCH] add 'proper' homepage, fix season/episode pages not showing left directory properly --- app/routes.py | 8 ++++---- app/templates/episode.html | 1 - app/templates/home.html | 9 +++++++++ app/templates/season.html | 2 +- app/templates/view.html | 4 ---- 5 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 app/templates/home.html delete mode 100644 app/templates/view.html diff --git a/app/routes.py b/app/routes.py index 7bbe10a..b805ff7 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,17 +1,17 @@ from flask import send_from_directory, redirect, url_for, render_template, request -from app.models import Season, Episode +from app.models import Season, Episode, Quote from app import app @app.route("/") def index(): - return render_template("view.html", seasons=Season.query.all()) + return render_template("home.html", seasons=Season.query.all(), nquotes=len(Quote.query.all()), nepisodes=len(Episode.query.all())) @app.route("/view//") def viewSeason(season): return render_template( - "season.html", season=Season.query.filter_by(id=season).first_or_404() + "season.html", season=Season.query.filter_by(id=season).first_or_404(), seasons=Season.query.all() ) @app.route("/view///") @@ -20,7 +20,7 @@ def viewEpisode(season, episode): if not e.built: print("Rebuilding") e.build() - return render_template("episode.html", episode=e) + return render_template("episode.html", episode=e, seasons=Season.query.all()) @app.route("/rebuild///") diff --git a/app/templates/episode.html b/app/templates/episode.html index ae07437..6bf1452 100644 --- a/app/templates/episode.html +++ b/app/templates/episode.html @@ -12,7 +12,6 @@ {% endblock head %} {% block content %} - {{ super() }}section

+ Serving {{ nquotes }} quotes over {{ nepisodes }} episodes. + Designed in Bulma, coded in Python using Flask and SQLAlchemy.
+ Search Engine implemented in Whoosh, and hosted on $HostingProvider.
+ Built by Xevion. +

+{% endblock %} \ No newline at end of file diff --git a/app/templates/season.html b/app/templates/season.html index 3d8fb72..7c948b4 100644 --- a/app/templates/season.html +++ b/app/templates/season.html @@ -12,4 +12,4 @@ Season {{ season.id }}
{% endfor %} -{% endblock content %} \ No newline at end of file +{% endblock content %} \ No newline at end of file diff --git a/app/templates/view.html b/app/templates/view.html deleted file mode 100644 index 87ebaf4..0000000 --- a/app/templates/view.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends 'content.html' %} -{% block content %} -{{ super() }} -{% endblock content %} \ No newline at end of file