feat(presentation): domyslna lokalizacja = Szpital Barlickiego, Lodz
QoL: formularze (horoskop / interpretacje / kalendarz) maja wstepnie wpisana lokalizacje urodzenia wlasciciela — Szpital Barlickiego w Lodzi (51.7739N, 19.4829E; potwierdzone reverse-geokodowaniem OSM: Kopcinskiego 22/28). Nie trzeba jej wpisywac za kazdym razem. - config.py: jedno zrodlo prawdy (DEFAULT_LAT/LON/LABEL, nadpisywalne ENV) + helper default_form(). - main.py: GET wstrzykuje default_form() + location_label do 3 formularzy z polami lokalizacji (significators pominiete — nie ma tam lat/lon). - szablony: dyskretna podpowiedz z nazwa lokalizacji, widoczna tylko na czystym formularzu (po POST znika, wygrywa wpisana wartosc). - „Tu i teraz" nadal nadpisuje domyslne wspolrzedne geolokalizacja. Zweryfikowane TestClientem: 3 strony renderuja 51.7739/19.4829 + etykiete; POST z innymi wspolrzednymi je zachowuje i chowa podpowiedz. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -15,3 +15,17 @@ class Settings:
|
|||||||
|
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
|
# Domyślna (wklepana) lokalizacja formularzy — miejsce urodzenia właściciela:
|
||||||
|
# Szpital Barlickiego w Łodzi, 51°46'26.1"N 19°28'58.6"E (potwierdzone reverse-
|
||||||
|
# geokodowaniem OSM: Kopcińskiego 22/28). QoL — nie trzeba wpisywać jej za każdym
|
||||||
|
# razem. Przycisk „Tu i teraz" nadal ją nadpisuje geolokalizacją przeglądarki.
|
||||||
|
# Można nadpisać zmiennymi środowiskowymi (np. inny współpracownik).
|
||||||
|
DEFAULT_LAT: float = float(os.getenv("DEFAULT_LAT", "51.7739"))
|
||||||
|
DEFAULT_LON: float = float(os.getenv("DEFAULT_LON", "19.4829"))
|
||||||
|
DEFAULT_LOCATION_LABEL: str = os.getenv("DEFAULT_LOCATION_LABEL", "Szpital Barlickiego, Łódź")
|
||||||
|
|
||||||
|
|
||||||
|
def default_form() -> dict:
|
||||||
|
"""Wstępnie wypełnione pola lokalizacji na czystym formularzu (GET)."""
|
||||||
|
return {"lat": DEFAULT_LAT, "lon": DEFAULT_LON}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from fastapi.staticfiles import StaticFiles
|
|||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
from app.clients.logic_client import LogicClient
|
from app.clients.logic_client import LogicClient
|
||||||
|
from app.config import DEFAULT_LOCATION_LABEL, default_form
|
||||||
|
|
||||||
app = FastAPI(title="astrololo · warstwa prezentacji")
|
app = FastAPI(title="astrololo · warstwa prezentacji")
|
||||||
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
||||||
@@ -48,7 +49,10 @@ def _logic_error(e: Exception) -> str:
|
|||||||
# ---------------- Horoskop: pozycje (strona główna) ----------------
|
# ---------------- Horoskop: pozycje (strona główna) ----------------
|
||||||
@app.get("/", response_class=HTMLResponse)
|
@app.get("/", response_class=HTMLResponse)
|
||||||
def chart_form(request: Request):
|
def chart_form(request: Request):
|
||||||
return templates.TemplateResponse(request, "chart.html", {"result": None, "form": {}})
|
return templates.TemplateResponse(
|
||||||
|
request, "chart.html",
|
||||||
|
{"result": None, "form": default_form(), "location_label": DEFAULT_LOCATION_LABEL},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/", response_class=HTMLResponse)
|
@app.post("/", response_class=HTMLResponse)
|
||||||
@@ -105,7 +109,10 @@ def significators_search(
|
|||||||
# ---------------- Interpretacje (wynik obliczeń szukany w bazie) ----------------
|
# ---------------- Interpretacje (wynik obliczeń szukany w bazie) ----------------
|
||||||
@app.get("/interpret", response_class=HTMLResponse)
|
@app.get("/interpret", response_class=HTMLResponse)
|
||||||
def interpret_form(request: Request):
|
def interpret_form(request: Request):
|
||||||
return templates.TemplateResponse(request, "interpret.html", {"result": None, "form": {}})
|
return templates.TemplateResponse(
|
||||||
|
request, "interpret.html",
|
||||||
|
{"result": None, "form": default_form(), "location_label": DEFAULT_LOCATION_LABEL},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/interpret", response_class=HTMLResponse)
|
@app.post("/interpret", response_class=HTMLResponse)
|
||||||
@@ -135,7 +142,10 @@ def interpret_run(
|
|||||||
# ---------------- Kalendarz (oś czasu z technik + interpretacje) ----------------
|
# ---------------- Kalendarz (oś czasu z technik + interpretacje) ----------------
|
||||||
@app.get("/timeline", response_class=HTMLResponse)
|
@app.get("/timeline", response_class=HTMLResponse)
|
||||||
def timeline_form(request: Request):
|
def timeline_form(request: Request):
|
||||||
return templates.TemplateResponse(request, "timeline.html", {"result": None, "form": {}})
|
return templates.TemplateResponse(
|
||||||
|
request, "timeline.html",
|
||||||
|
{"result": None, "form": default_form(), "location_label": DEFAULT_LOCATION_LABEL},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/timeline", response_class=HTMLResponse)
|
@app.post("/timeline", response_class=HTMLResponse)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<label><input type="checkbox" name="stations" value="true" {{ 'checked' if form.stations else '' }}>
|
<label><input type="checkbox" name="stations" value="true" {{ 'checked' if form.stations else '' }}>
|
||||||
licz stacje planet (wolniejsze)</label>
|
licz stacje planet (wolniejsze)</label>
|
||||||
</div>
|
</div>
|
||||||
|
{% if location_label %}<p class="muted small">Wstępnie wpisano lokalizację: <strong>{{ location_label }}</strong> ({{ form.lat }}, {{ form.lon }}). Zmień pola lub kliknij „Tu i teraz".</p>{% endif %}
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="button" id="nowBtn" class="ghost">Tu i teraz</button>
|
<button type="button" id="nowBtn" class="ghost">Tu i teraz</button>
|
||||||
<button type="submit">Policz horoskop</button>
|
<button type="submit">Policz horoskop</button>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<div class="opts">
|
<div class="opts">
|
||||||
<label><input type="checkbox" name="group" value="true" {{ 'checked' if form.group else '' }}> grupuj identyczne opisy</label>
|
<label><input type="checkbox" name="group" value="true" {{ 'checked' if form.group else '' }}> grupuj identyczne opisy</label>
|
||||||
</div>
|
</div>
|
||||||
|
{% if location_label %}<p class="muted small">Wstępnie wpisano lokalizację: <strong>{{ location_label }}</strong> ({{ form.lat }}, {{ form.lon }}). Zmień pola lub kliknij „Tu i teraz".</p>{% endif %}
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="button" id="nowBtn" class="ghost">Tu i teraz</button>
|
<button type="button" id="nowBtn" class="ghost">Tu i teraz</button>
|
||||||
<button type="submit">Szukaj interpretacji</button>
|
<button type="submit">Szukaj interpretacji</button>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<input type="number" name="lon" step="0.0001" value="{{ form.lon if form.lon is not none else 0 }}">
|
<input type="number" name="lon" step="0.0001" value="{{ form.lon if form.lon is not none else 0 }}">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
{% if location_label %}<p class="muted small">Wstępnie wpisano lokalizację: <strong>{{ location_label }}</strong> ({{ form.lat }}, {{ form.lon }}). Zmień pola lub kliknij „Tu i teraz".</p>{% endif %}
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>Zakres od
|
<label>Zakres od
|
||||||
<input type="date" name="from_date" value="{{ form.from_date or '' }}" required>
|
<input type="date" name="from_date" value="{{ form.from_date or '' }}" required>
|
||||||
|
|||||||
Reference in New Issue
Block a user