Make item group value owned string
This commit is contained in:
parent
a698f96bbc
commit
44123b52c9
|
@ -254,14 +254,14 @@ async fn edit_item(
|
|||
title: "UUID",
|
||||
required: true,
|
||||
disabled: true,
|
||||
value: Some(item.id.to_string().as_str()),
|
||||
value: Some(item.id.to_string()),
|
||||
})
|
||||
(forms::InputGroup {
|
||||
r#type: forms::InputType::Text,
|
||||
name: "name",
|
||||
title: "Name",
|
||||
value: item.name.as_deref(),
|
||||
disabled: item.name.is_none(),
|
||||
value: item.name,
|
||||
..Default::default()
|
||||
})
|
||||
(forms::InputGroup {
|
||||
|
@ -269,14 +269,14 @@ async fn edit_item(
|
|||
name: "class",
|
||||
title: "Class",
|
||||
required: true,
|
||||
value: Some(item.class.to_string().as_str()),
|
||||
value: Some(item.class.to_string()),
|
||||
..Default::default()
|
||||
})
|
||||
(forms::InputGroup {
|
||||
r#type: forms::InputType::Text,
|
||||
name: "parent",
|
||||
title: "Parent",
|
||||
value: item.parent.map(|id| id.to_string()).as_deref(),
|
||||
value: item.parent.map(|id| id.to_string()),
|
||||
disabled: item.parent.is_none(),
|
||||
..Default::default()
|
||||
})
|
||||
|
|
|
@ -218,14 +218,14 @@ async fn edit_item_class(
|
|||
title: "UUID",
|
||||
disabled: true,
|
||||
required: true,
|
||||
value: Some(item_class.id.to_string().as_str()),
|
||||
value: Some(item_class.id.to_string()),
|
||||
})
|
||||
(forms::InputGroup {
|
||||
r#type: forms::InputType::Text,
|
||||
name: "name",
|
||||
title: "Name",
|
||||
required: true,
|
||||
value: Some(&item_class.name),
|
||||
value: Some(item_class.name),
|
||||
..Default::default()
|
||||
})
|
||||
(forms::InputGroup {
|
||||
|
@ -233,7 +233,7 @@ async fn edit_item_class(
|
|||
name: "parent",
|
||||
title: "Parent",
|
||||
disabled: item_class.parent.is_none(),
|
||||
value: item_class.parent.map(|id| id.to_string()).as_deref(),
|
||||
value: item_class.parent.map(|id| id.to_string()),
|
||||
..Default::default()
|
||||
})
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ pub struct InputGroup<'a> {
|
|||
pub title: &'a str,
|
||||
pub required: bool,
|
||||
pub disabled: bool,
|
||||
pub value: Option<&'a str>,
|
||||
pub value: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for InputGroup<'_> {
|
||||
|
@ -44,7 +44,7 @@ impl Default for InputGroup<'_> {
|
|||
impl InputGroup<'_> {
|
||||
fn main_input(&self) -> Markup {
|
||||
html! {
|
||||
input .form-control #(self.name) name={ (self.name) } type={ (self.r#type) } required[self.required] disabled[self.disabled] value=[self.value];
|
||||
input .form-control #(self.name) name={ (self.name) } type={ (self.r#type) } required[self.required] disabled[self.disabled] value=[self.value.clone()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue