customizable footer
This commit is contained in:
parent
62f570aaca
commit
1d760f91db
4 changed files with 30 additions and 5 deletions
|
@ -13,7 +13,7 @@ class User(BaseModel):
|
||||||
|
|
||||||
class Puzzle(BaseModel):
|
class Puzzle(BaseModel):
|
||||||
# Titel
|
# Titel
|
||||||
# TODO neue Route GET /user/title
|
# TODO penner neue Route GET /user/title
|
||||||
title: str
|
title: str
|
||||||
|
|
||||||
# Lösungswort
|
# Lösungswort
|
||||||
|
@ -65,6 +65,11 @@ class Config(BaseModel):
|
||||||
# Serverseitiger zusätzlicher "random" seed
|
# Serverseitiger zusätzlicher "random" seed
|
||||||
random_seed: str = ""
|
random_seed: str = ""
|
||||||
|
|
||||||
|
# Fußzeile der Seite
|
||||||
|
footer: str = (
|
||||||
|
'<strong>Advent22</strong> by <a href="//www.lenaisten.de">Lenaisten e.V.</a>'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_config() -> Config:
|
async def get_config() -> Config:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,6 +5,7 @@ from fastapi.responses import StreamingResponse
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config
|
from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config
|
||||||
|
from ..core.config import Config, get_config
|
||||||
from ..core.depends import get_all_event_dates, get_day_image
|
from ..core.depends import get_all_event_dates, get_day_image
|
||||||
from ..core.helpers import EventDates, api_return_image, load_image
|
from ..core.helpers import EventDates, api_return_image, load_image
|
||||||
from ._security import user_can_view_day, user_is_admin, user_visible_days
|
from ._security import user_can_view_day, user_is_admin, user_visible_days
|
||||||
|
@ -38,6 +39,17 @@ async def get_doors(
|
||||||
return [door for door in cal_cfg.doors if door.day in visible_days]
|
return [door for door in cal_cfg.doors if door.day in visible_days]
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/footer")
|
||||||
|
async def get_footer(
|
||||||
|
cfg: Config = Depends(get_config),
|
||||||
|
) -> str:
|
||||||
|
"""
|
||||||
|
Seiten-Fußzeile lesen
|
||||||
|
"""
|
||||||
|
|
||||||
|
return cfg.footer
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/image_{day}",
|
"/image_{day}",
|
||||||
response_class=StreamingResponse,
|
response_class=StreamingResponse,
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<nav class="level is-mobile">
|
<nav class="level is-mobile">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<p>
|
<p v-html="footer" />
|
||||||
<strong>Advent22</strong> by
|
|
||||||
<a href="https://www.lenaisten.de/">Lenaisten.de</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
|
@ -46,6 +43,14 @@ import UserView from "./components/UserView.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_admin = false;
|
public is_admin = false;
|
||||||
|
public footer = "";
|
||||||
|
|
||||||
|
public mounted(): void {
|
||||||
|
this.$advent22
|
||||||
|
.api_get<string>("user/footer")
|
||||||
|
.then((footer) => (this.footer = footer))
|
||||||
|
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
||||||
<dd v-else><CountDown :millis="next_door" /></dd>
|
<dd v-else><CountDown :millis="next_door" /></dd>
|
||||||
|
|
||||||
|
<dt>Fußzeile</dt>
|
||||||
|
<dd class="is-family-monospace">{{ footer }}</dd>
|
||||||
|
|
||||||
<dt>Erstes Türchen</dt>
|
<dt>Erstes Türchen</dt>
|
||||||
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue