add 'proper' homepage, fix season/episode pages not showing left directory properly

This commit is contained in:
Xevion
2020-03-09 18:19:26 -05:00
parent 7a42620fbd
commit 4126bdc596
5 changed files with 14 additions and 10 deletions

View File

@@ -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/<season>/")
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/<season>/<episode>/")
@@ -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/<season>/<episode>/")

View File

@@ -12,7 +12,6 @@
</style>
{% endblock head %}
{% block content %}
{{ super() }}section
<div class="field is-grouped" style="justify-content: center;">
<p class="control is-link">
<a class="button" href="{{ url_for('viewSeason', season=episode.season_id) }}">Go to Season {{ episode.season_id }}</a>

9
app/templates/home.html Normal file
View File

@@ -0,0 +1,9 @@
{% extends 'content.html' %}
{% block content %}
<p>
Serving <b>{{ nquotes }}</b> quotes over <b>{{ nepisodes }}</b> episodes.
Designed in <b>Bulma</b>, coded in <b>Python</b> using <b>Flask</b> and <b>SQLAlchemy</b>.<br>
Search Engine implemented in <b>Whoosh</b>, and hosted on <b>$HostingProvider</b>.<br>
Built by <b><a href="https://xevion.dev/">Xevion</a></b>.
</p>
{% endblock %}

View File

@@ -12,4 +12,4 @@ Season {{ season.id }}
<br>
{% endfor %}
{% endblock content %}
{% endblock content %}

View File

@@ -1,4 +0,0 @@
{% extends 'content.html' %}
{% block content %}
{{ super() }}
{% endblock content %}