add BK LuxusLAN news and update NewsPost component to improve image support
This commit is contained in:
parent
93e87b3d67
commit
051c290074
BIN
ezgg_website/assets/bk_luxus_lan_15.jpeg
Normal file
BIN
ezgg_website/assets/bk_luxus_lan_15.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
3
ezgg_website/assets/news_25_11_24.md
Normal file
3
ezgg_website/assets/news_25_11_24.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Vom 22. bis 24. November war die EZ GG zu Gast bei den BK-LAN'ern auf ihrer [LuxusLAN 15](https://bk-lan.de/party/?do=event&id=37) in Bad Kreuznach - Hargesheim.
|
||||||
|
|
||||||
|
Wir hatten alle viel Spaß und danken für die Einladung. Gerne wieder 😄. [Hier gibt es alle Bilder vom Wochenende.](https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photos.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3)
|
||||||
@ -1,14 +1,20 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import rio
|
import rio
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class NewsPostImage:
|
||||||
|
path: Path
|
||||||
|
link: Optional[str]
|
||||||
|
|
||||||
class NewsPost(rio.Component):
|
class NewsPost(rio.Component):
|
||||||
header: str
|
header: str
|
||||||
date: str
|
date: str
|
||||||
article_text_path_or_text: str | Path
|
article_text_path_or_text: str | Path
|
||||||
images: list[Path]
|
images: list[NewsPostImage]
|
||||||
article_text = ""
|
article_text = ""
|
||||||
|
|
||||||
@rio.event.on_populate
|
@rio.event.on_populate
|
||||||
@ -25,8 +31,20 @@ class NewsPost(rio.Component):
|
|||||||
|
|
||||||
def build(self) -> rio.Component:
|
def build(self) -> rio.Component:
|
||||||
image_column = rio.Column(margin=0.5)
|
image_column = rio.Column(margin=0.5)
|
||||||
for image_path in self.images:
|
for news_post_image in self.images:
|
||||||
image_column.add(rio.Image(image_path, fill_mode="fit", width=18, height=18, align_x=0.01))
|
image_obj = rio.Image(
|
||||||
|
news_post_image.path,
|
||||||
|
fill_mode="fit",
|
||||||
|
width=20,
|
||||||
|
height=20,
|
||||||
|
align_x=0.01
|
||||||
|
)
|
||||||
|
image_column.add(
|
||||||
|
rio.Link(image_obj,
|
||||||
|
target_url=news_post_image.link,
|
||||||
|
open_in_new_tab=True
|
||||||
|
) if bool(news_post_image.link) else image_obj
|
||||||
|
)
|
||||||
return rio.Rectangle(
|
return rio.Rectangle(
|
||||||
content=rio.Column(
|
content=rio.Column(
|
||||||
rio.Row(
|
rio.Row(
|
||||||
@ -47,7 +65,7 @@ class NewsPost(rio.Component):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_news_post(header: str, article_text_path_or_text: str | Path, date: str, images: Optional[list[Path]] = None) -> NewsPost:
|
def build_news_post(header: str, article_text_path_or_text: str | Path, date: str, images: Optional[list[NewsPostImage]] = None) -> NewsPost:
|
||||||
if images is None:
|
if images is None:
|
||||||
images = []
|
images = []
|
||||||
return NewsPost(
|
return NewsPost(
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from from_root import from_root
|
|||||||
|
|
||||||
from .page_builder import build_page
|
from .page_builder import build_page
|
||||||
from .. import components as comps
|
from .. import components as comps
|
||||||
|
from ..components.news_post import NewsPostImage
|
||||||
|
|
||||||
|
|
||||||
class Home(rio.Component):
|
class Home(rio.Component):
|
||||||
@ -31,6 +32,17 @@ class Home(rio.Component):
|
|||||||
margin_bottom=1,
|
margin_bottom=1,
|
||||||
margin_right=1
|
margin_right=1
|
||||||
),
|
),
|
||||||
|
comps.build_news_post(
|
||||||
|
header="Das war die BK-LuxusLAN 15",
|
||||||
|
article_text_path_or_text=from_root("ezgg_website/assets/news_25_11_24.md"),
|
||||||
|
date="25.11.2024",
|
||||||
|
images=[
|
||||||
|
NewsPostImage(
|
||||||
|
from_root("ezgg_website/assets/bk_luxus_lan_15.jpeg"),
|
||||||
|
"https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=3"
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
comps.build_news_post(
|
comps.build_news_post(
|
||||||
header="Eine Laura und 21 Bilder",
|
header="Eine Laura und 21 Bilder",
|
||||||
article_text_path_or_text=from_root("ezgg_website/assets/news_25_10_24.md"),
|
article_text_path_or_text=from_root("ezgg_website/assets/news_25_10_24.md"),
|
||||||
@ -59,7 +71,7 @@ class Home(rio.Component):
|
|||||||
comps.build_news_post(
|
comps.build_news_post(
|
||||||
header="Eintragung abgeschlossen!",
|
header="Eintragung abgeschlossen!",
|
||||||
article_text_path_or_text=from_root("ezgg_website/assets/news_06_06_24.md"),
|
article_text_path_or_text=from_root("ezgg_website/assets/news_06_06_24.md"),
|
||||||
images=[from_root("ezgg_website/assets/a38.png")],
|
images=[NewsPostImage(from_root("ezgg_website/assets/a38.png"), None)],
|
||||||
date="06.06.2024"
|
date="06.06.2024"
|
||||||
),
|
),
|
||||||
comps.build_news_post(
|
comps.build_news_post(
|
||||||
|
|||||||
@ -118,6 +118,18 @@ class DatabaseService:
|
|||||||
|
|
||||||
def get_picture_paths(self) -> list[rio.URL]:
|
def get_picture_paths(self) -> list[rio.URL]:
|
||||||
return [
|
return [
|
||||||
|
# BK-LAN LuxusLAN 15
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=10"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=2"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=3"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=4"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=5"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=6"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=7"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=8"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=9"),
|
||||||
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=bc0c54ce-a87e-426a-893d-2bbcc2c28ce3&photo_nr=10"),
|
||||||
|
|
||||||
# BL 47
|
# BL 47
|
||||||
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=eacbaa73-db29-48e2-b0af-2f43a0e053ed&photo_nr=1"),
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=eacbaa73-db29-48e2-b0af-2f43a0e053ed&photo_nr=1"),
|
||||||
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=eacbaa73-db29-48e2-b0af-2f43a0e053ed&photo_nr=2"),
|
rio.URL("https://verwaltung.ezgg-ev.de/adm_program/modules/photos/photo_show.php?photo_uuid=eacbaa73-db29-48e2-b0af-2f43a0e053ed&photo_nr=2"),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user