use render trait
This commit is contained in:
parent
f5a2901b16
commit
ffbcf04da7
@ -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" }
|
||||
|
@ -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)) {
|
||||
|
@ -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>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user