ConfigView rendering

This commit is contained in:
Jörn-Michael Miehe 2023-09-11 22:50:11 +00:00
parent 74b9322ae2
commit 26556ad309
2 changed files with 23 additions and 13 deletions

View file

@ -34,9 +34,13 @@ class ConfigModel(BaseModel):
doors: list[int] doors: list[int]
class __Image(BaseModel): class __Image(BaseModel):
class __Font(BaseModel):
file: str
size: int
size: int size: int
border: int border: int
fonts: list[tuple[str, int]] fonts: list[__Font]
class __WebDAV(BaseModel): class __WebDAV(BaseModel):
url: str url: str
@ -61,9 +65,9 @@ async def get_config_model(
"puzzle": { "puzzle": {
"solution": cfg.puzzle.solution, "solution": cfg.puzzle.solution,
"shuffled": shuffled_solution, "shuffled": shuffled_solution,
"begin": date.today(), "begin": date.today(), # TODO
"end": date.today(), "end": date.today(), # TODO
"closing": date.today(), "closing": date.today(), # TODO
"seed": cfg.puzzle.random_seed, "seed": cfg.puzzle.random_seed,
}, },
"calendar": { "calendar": {
@ -72,9 +76,9 @@ async def get_config_model(
"doors": [door.day for door in cal_cfg.doors], "doors": [door.day for door in cal_cfg.doors],
}, },
"image": { "image": {
"size": 500, "size": 500, # TODO
"border": 30, "border": 30, # TODO
"fonts": [(cfg.server.font, 50)], "fonts": [{"file": cfg.server.font, "size": 50}],
}, },
"webdav": { "webdav": {
"url": SETTINGS.webdav.url, "url": SETTINGS.webdav.url,

View file

@ -31,7 +31,9 @@
<dd>{{ admin_config_model.puzzle.closing }}</dd> <dd>{{ admin_config_model.puzzle.closing }}</dd>
<dt>Zufalls-Seed</dt> <dt>Zufalls-Seed</dt>
<dd>{{ admin_config_model.puzzle.seed }}</dd> <dd class="is-family-monospace">
"{{ admin_config_model.puzzle.seed }}"
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@ -47,7 +49,7 @@
<dt>Türchen</dt> <dt>Türchen</dt>
<dd> <dd>
{{ admin_config_model.calendar.doors }} <span>{{ admin_config_model.calendar.doors.join(", ") }}</span>
<span class="tag is-danger ml-2"> <span class="tag is-danger ml-2">
<span class="icon"> <span class="icon">
<font-awesome-icon icon="fa-solid fa-bolt" /> <font-awesome-icon icon="fa-solid fa-bolt" />
@ -65,8 +67,12 @@
<dd>{{ admin_config_model.image.border }} px</dd> <dd>{{ admin_config_model.image.border }} px</dd>
<dt>Schriftarten</dt> <dt>Schriftarten</dt>
<dd>{{ admin_config_model.image.fonts }}</dd> <dd
<dd>files/foobar.ttf (Größe 33)</dd> v-for="(font, idx) in admin_config_model.image.fonts"
:key="`font-${idx}`"
>
{{ font.file }} (Größe {{ font.size }})
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@ -132,7 +138,7 @@ interface ConfigModel {
image: { image: {
size: number; size: number;
border: number; border: number;
fonts: (string | number)[]; fonts: { file: string; size: number }[];
}; };
webdav: { webdav: {
url: string; url: string;
@ -164,7 +170,7 @@ export default class extends Vue {
image: { image: {
size: 500, size: 500,
border: 30, border: 30,
fonts: ["files/Lena.ttf", 50], fonts: [{ file: "files/Lena.ttf", size: 50 }],
}, },
webdav: { webdav: {
url: "https://example.com/remote.php/webdav/advent22", url: "https://example.com/remote.php/webdav/advent22",