mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-16 14:13:36 -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 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
|
from app import app
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
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>/")
|
@app.route("/view/<season>/")
|
||||||
def viewSeason(season):
|
def viewSeason(season):
|
||||||
return render_template(
|
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>/")
|
@app.route("/view/<season>/<episode>/")
|
||||||
@@ -20,7 +20,7 @@ def viewEpisode(season, episode):
|
|||||||
if not e.built:
|
if not e.built:
|
||||||
print("Rebuilding")
|
print("Rebuilding")
|
||||||
e.build()
|
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>/")
|
@app.route("/rebuild/<season>/<episode>/")
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
</style>
|
</style>
|
||||||
{% endblock head %}
|
{% endblock head %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}section
|
|
||||||
<div class="field is-grouped" style="justify-content: center;">
|
<div class="field is-grouped" style="justify-content: center;">
|
||||||
<p class="control is-link">
|
<p class="control is-link">
|
||||||
<a class="button" href="{{ url_for('viewSeason', season=episode.season_id) }}">Go to Season {{ episode.season_id }}</a>
|
<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 %}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{% extends 'content.html' %}
|
|
||||||
{% block content %}
|
|
||||||
{{ super() }}
|
|
||||||
{% endblock content %}
|
|
||||||
Reference in New Issue
Block a user