Add useful page actions
This commit is contained in:
parent
39af06717a
commit
eb8b952ba0
|
@ -57,6 +57,10 @@ async fn show_item(
|
|||
title: Some(&title),
|
||||
page_title: Some(Box::new(item_name.clone())),
|
||||
page_actions: vec![
|
||||
(templates::helpers::PageAction {
|
||||
href: format!("/items/add?parent={}", item.id),
|
||||
name: "Add Child".to_string(),
|
||||
}),
|
||||
(templates::helpers::PageAction {
|
||||
href: format!("/item/{}/edit", item.id),
|
||||
name: "Edit".to_string(),
|
||||
|
|
|
@ -47,17 +47,29 @@ async fn show_item_class(
|
|||
let mut title = item_class.name.clone();
|
||||
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(
|
||||
TemplateConfig {
|
||||
path: &format!("/item-class/{}", item_class.id),
|
||||
title: Some(&title),
|
||||
page_title: Some(Box::new(item_class.name.clone())),
|
||||
page_actions: vec![
|
||||
(templates::helpers::PageAction {
|
||||
href: format!("/item-class/{}/edit", item_class.id),
|
||||
name: "Edit".to_string(),
|
||||
}),
|
||||
],
|
||||
page_actions,
|
||||
..Default::default()
|
||||
},
|
||||
html! {
|
||||
|
|
Loading…
Reference in a new issue