Add useful page actions
This commit is contained in:
parent
49c77bfef9
commit
a6461723c5
|
@ -57,6 +57,10 @@ async fn show_item(
|
||||||
title: Some(&title),
|
title: Some(&title),
|
||||||
page_title: Some(Box::new(item_name.clone())),
|
page_title: Some(Box::new(item_name.clone())),
|
||||||
page_actions: vec![
|
page_actions: vec![
|
||||||
|
(templates::helpers::PageAction {
|
||||||
|
href: format!("/items/add?parent={}", item.id),
|
||||||
|
name: "Add Child".to_string(),
|
||||||
|
}),
|
||||||
(templates::helpers::PageAction {
|
(templates::helpers::PageAction {
|
||||||
href: format!("/item/{}/edit", item.id),
|
href: format!("/item/{}/edit", item.id),
|
||||||
name: "Edit".to_string(),
|
name: "Edit".to_string(),
|
||||||
|
|
|
@ -47,17 +47,29 @@ async fn show_item_class(
|
||||||
let mut title = item_class.name.clone();
|
let mut title = item_class.name.clone();
|
||||||
title.push_str(" – Item Details");
|
title.push_str(" – Item Details");
|
||||||
|
|
||||||
|
let mut page_actions = vec![
|
||||||
|
(templates::helpers::PageAction {
|
||||||
|
href: format!("/items/add?class={}", item_class.id),
|
||||||
|
name: "Add Item".to_string(),
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
if item_class.parent.is_none() {
|
||||||
|
page_actions.push(templates::helpers::PageAction {
|
||||||
|
href: format!("/item-classes/add?parent={}", item_class.id),
|
||||||
|
name: "Add Child".to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
page_actions.push(templates::helpers::PageAction {
|
||||||
|
href: format!("/item-class/{}/edit", item_class.id),
|
||||||
|
name: "Edit".to_string(),
|
||||||
|
});
|
||||||
|
|
||||||
Ok(templates::base(
|
Ok(templates::base(
|
||||||
TemplateConfig {
|
TemplateConfig {
|
||||||
path: &format!("/item-class/{}", item_class.id),
|
path: &format!("/item-class/{}", item_class.id),
|
||||||
title: Some(&title),
|
title: Some(&title),
|
||||||
page_title: Some(Box::new(item_class.name.clone())),
|
page_title: Some(Box::new(item_class.name.clone())),
|
||||||
page_actions: vec![
|
page_actions,
|
||||||
(templates::helpers::PageAction {
|
|
||||||
href: format!("/item-class/{}/edit", item_class.id),
|
|
||||||
name: "Edit".to_string(),
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
html! {
|
html! {
|
||||||
|
|
Loading…
Reference in a new issue