mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-15 10:13:30 -06:00
add 'proper' homepage, fix season/episode pages not showing left directory properly
This commit is contained in:
@@ -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>/")
|
||||
|
||||
@@ -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
9
app/templates/home.html
Normal 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 %}
|
||||
@@ -12,4 +12,4 @@ Season {{ season.id }}
|
||||
<br>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock content %}
|
||||
{% endblock content %}
|
||||
@@ -1,4 +0,0 @@
|
||||
{% extends 'content.html' %}
|
||||
{% block content %}
|
||||
{{ super() }}
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user