fix: remove dictionary and add uniform view names

Refs: OPS-11
This commit is contained in:
0xjrx 2025-02-25 14:54:24 +01:00
parent 322d0684a1
commit ce42cb4eea
3 changed files with 9 additions and 13 deletions

View file

@ -2,14 +2,11 @@ from flask import Flask, render_template
app = Flask(__name__)
urls = {
"home": "index_view",
"haiku":"haiku_view"
}
@app.route("/")
def index_view():
return render_template("index.jinja", title="Senju", urls=urls)
return render_template("index.jinja", title="Senju")
@app.route("/haiku")
@ -17,5 +14,4 @@ def haiku_view():
return render_template(
"haiku.jinja",
title="Haiku of the Day",
urls = urls)
title="Haiku of the Day")

View file

@ -25,16 +25,16 @@
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<a href="{{ url_for(urls['home']) }}"
<a href="{{ url_for('index_view') }}"
class="rounded-md px-3 py-2 text-sm font-medium
{% if request.endpoint == urls['home'] %} bg-gray-900 text-white {% else %} text-gray-300 hover:bg-gray-700 hover:text-white {% endif %}"
{% if request.endpoint == 'index_view' %} bg-gray-900 text-white {% else %} text-gray-300 hover:bg-gray-700 hover:text-white {% endif %}"
>
Start
</a>
<a href="{{ url_for(urls['haiku']) }}"
class="rounded-md px-3 py-2 text-sm font-medium
{% if request.endpoint == urls['haiku'] %} bg-gray-900 text-white {% else %} text-gray-300 hover:bg-gray-700 hover:text-white {% endif %}"
<a href="{{ url_for('haiku_view') }}"
class="rounded-md px-3 py-2 text-sm font-mediRefs: OPS-11um
{% if request.endpoint == 'haiku_view' %} bg-gray-900 text-white {% else %} text-gray-300 hover:bg-gray-700 hover:text-white {% endif %}"
>
Haiku
</a>

View file

@ -11,7 +11,7 @@
Splash! Silence again.
</p>
</div>
<a href="{{ url_for(urls['home']) }}" class=" inline-block bg-violet-600 hover:bg-violet-700 text-white font-bold py-2 px-4 rounded-lg">
<a href="{{ url_for('index_view') }}" class=" inline-block bg-violet-600 hover:bg-violet-700 text-white font-bold py-2 px-4 rounded-lg">
Back to Home
</a>
</div>