diff --git a/formula10.py b/formula10.py index 4d923d7..c45058a 100644 --- a/formula10.py +++ b/formula10.py @@ -18,6 +18,25 @@ def index(): return render_template("index.jinja") +@app.route("/seasons/") +def default_season(): + return redirect("/seasons/2023/p10") + + +@app.route("/seasons//") +def default_statistic(year): + return redirect("/seasons/" + year + "/p10") + + +@app.route("/seasons///") +def seasons(year, statistic): + seasons = Season.query.all() + + return render_template( + "season.jinja", year=year, statistic=statistic, seasons=seasons + ) + + # @app.route("/teams", methods=["GET", "POST"]) # def teams(): # if request.method == "POST": diff --git a/static/style/bootstrap-custom.css b/static/style/bootstrap-custom.css new file mode 100644 index 0000000..e9e4c06 --- /dev/null +++ b/static/style/bootstrap-custom.css @@ -0,0 +1,4 @@ +.dropdown-menu { + max-height: 250px; + overflow-y: auto; +} \ No newline at end of file diff --git a/templates/base.jinja b/templates/base.jinja index 36d0ad8..06d97e0 100644 --- a/templates/base.jinja +++ b/templates/base.jinja @@ -1,37 +1,45 @@ +{% macro sentence_case(text) %} + {{ text[0] | upper }}{{ text[1:] }} +{% endmacro %} + - - + + - - {% block title %}{% endblock title %} - + + {% block title %}{% endblock title %} + - - - + + + + - - {% block body %}{% endblock body %} + {% block body %}{% endblock body %} diff --git a/templates/season.jinja b/templates/season.jinja new file mode 100644 index 0000000..891e78e --- /dev/null +++ b/templates/season.jinja @@ -0,0 +1,40 @@ +{% extends 'base.jinja' %} +{% block title %}Formula 10 - {{year}} Season{% endblock title %} + +{% block navbar_extra %} +
+ + +
+{% endblock navbar_extra %} + +{% block body %} +{% if statistic == "p10" %}{% include "season-p10.jinja" %}{% endif %} +{% if statistic == "races" %}{% include "season-races.jinja" %}{% endif %} +{% if statistic == "drivers" %}{% include "season-drivers.jinja" %}{% endif %} +{% if statistic == "constructors" %}{% include "season-constructors.jinja" %}{% endif %} +{% endblock body %} \ No newline at end of file