Show associated items on item class page
This commit is contained in:
parent
21cd61ea1d
commit
5d8884c11d
|
@ -8,7 +8,7 @@ use maud::html;
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::templates::helpers::{Colour, PageAction, PageActionMethod};
|
use super::templates::helpers::{Colour, ItemName, PageAction, PageActionMethod};
|
||||||
use super::templates::{self, datalist, forms, TemplateConfig};
|
use super::templates::{self, datalist, forms, TemplateConfig};
|
||||||
use crate::manage;
|
use crate::manage;
|
||||||
use crate::models::*;
|
use crate::models::*;
|
||||||
|
@ -48,6 +48,10 @@ async fn show(
|
||||||
.await
|
.await
|
||||||
.map_err(error::ErrorInternalServerError)?;
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
|
|
||||||
|
let items = manage::item_class::items(&pool, id)
|
||||||
|
.await
|
||||||
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
|
|
||||||
let mut title = item_class.name.clone();
|
let mut title = item_class.name.clone();
|
||||||
title.push_str(" – Item Details");
|
title.push_str(" – Item Details");
|
||||||
|
|
||||||
|
@ -118,6 +122,18 @@ async fn show(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if !items.is_empty() {
|
||||||
|
h3 .mt-4 { "Items" }
|
||||||
|
|
||||||
|
ul {
|
||||||
|
@for item in items {
|
||||||
|
li {
|
||||||
|
a href={ "/item/" (item.id) } { (ItemName::new(&item, &item_class).terse()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue