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" }
|
td { "Team" }
|
||||||
@for station in route.stations(&db).await {
|
@for station in route.stations(&db).await {
|
||||||
td {
|
td {
|
||||||
a href=(format!("/admin/station/{}", station.id)){
|
(station)
|
||||||
(station.name)
|
|
||||||
@if station.crewless() {
|
|
||||||
em data-tooltip="Station ohne Stationsbetreuer" data-placement="bottom" {
|
|
||||||
small { "🤖" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td { "Gesamtpunkte" }
|
td { "Gesamtpunkte" }
|
||||||
|
@ -161,12 +161,7 @@ async fn view(
|
|||||||
ol {
|
ol {
|
||||||
@for (idx, station) in cur_stations.into_iter().enumerate() {
|
@for (idx, station) in cur_stations.into_iter().enumerate() {
|
||||||
li {
|
li {
|
||||||
(station.name)
|
(station)
|
||||||
@if station.crewless() {
|
|
||||||
em data-tooltip="Station ohne Stationsbetreuer" {
|
|
||||||
small { "🤖" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@if idx > 0 {
|
@if idx > 0 {
|
||||||
a href=(format!("/admin/route/{}/move-station-higher/{}", route.id, station.id)){
|
a href=(format!("/admin/route/{}/move-station-higher/{}", route.id, station.id)){
|
||||||
em data-tooltip=(format!("{} nach vor reihen", station.name)) {
|
em data-tooltip=(format!("{} nach vor reihen", station.name)) {
|
||||||
|
@ -6,6 +6,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use axum::Router;
|
use axum::Router;
|
||||||
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
||||||
|
use maud::{html, Markup, Render};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, SqlitePool};
|
use sqlx::{FromRow, SqlitePool};
|
||||||
|
|
||||||
@ -24,6 +25,21 @@ pub(crate) struct Station {
|
|||||||
pub(crate) lng: Option<f64>,
|
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 {
|
impl Station {
|
||||||
pub(crate) async fn all(db: &SqlitePool) -> Vec<Self> {
|
pub(crate) async fn all(db: &SqlitePool) -> Vec<Self> {
|
||||||
sqlx::query_as::<_, Self>(
|
sqlx::query_as::<_, Self>(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user