use render trait
All checks were successful
CI/CD Pipeline / test (push) Successful in 5m42s
CI/CD Pipeline / deploy (push) Successful in 3m50s

This commit is contained in:
Philipp Hofer 2025-04-20 23:03:35 +02:00
parent f5a2901b16
commit ffbcf04da7
3 changed files with 18 additions and 14 deletions

View File

@ -43,14 +43,7 @@ async fn highscore(State(db): State<Arc<SqlitePool>>, session: Session) -> Marku
td { "Team" }
@for station in route.stations(&db).await {
td {
a href=(format!("/admin/station/{}", station.id)){
(station.name)
@if station.crewless() {
em data-tooltip="Station ohne Stationsbetreuer" data-placement="bottom" {
small { "🤖" }
}
}
}
(station)
}
}
td { "Gesamtpunkte" }

View File

@ -161,12 +161,7 @@ async fn view(
ol {
@for (idx, station) in cur_stations.into_iter().enumerate() {
li {
(station.name)
@if station.crewless() {
em data-tooltip="Station ohne Stationsbetreuer" {
small { "🤖" }
}
}
(station)
@if idx > 0 {
a href=(format!("/admin/route/{}/move-station-higher/{}", route.id, station.id)){
em data-tooltip=(format!("{} nach vor reihen", station.name)) {

View File

@ -6,6 +6,7 @@ use crate::{
};
use axum::Router;
use chrono::{DateTime, Local, NaiveDateTime, Utc};
use maud::{html, Markup, Render};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};
@ -24,6 +25,21 @@ pub(crate) struct Station {
pub(crate) lng: Option<f64>,
}
impl Render for Station {
fn render(&self) -> Markup {
html! {
a href=(format!("/admin/station/{}", self.id)){
(self.name)
}
@if self.crewless() {
em data-tooltip="Station ohne Stationsbetreuer" data-placement="bottom" {
small { "🤖" }
}
}
}
}
}
impl Station {
pub(crate) async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as::<_, Self>(