Make item group value owned string
This commit is contained in:
parent
c215b21869
commit
6d1fa56759
|
@ -254,14 +254,14 @@ async fn edit_item(
|
||||||
title: "UUID",
|
title: "UUID",
|
||||||
required: true,
|
required: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
value: Some(item.id.to_string().as_str()),
|
value: Some(item.id.to_string()),
|
||||||
})
|
})
|
||||||
(forms::InputGroup {
|
(forms::InputGroup {
|
||||||
r#type: forms::InputType::Text,
|
r#type: forms::InputType::Text,
|
||||||
name: "name",
|
name: "name",
|
||||||
title: "Name",
|
title: "Name",
|
||||||
value: item.name.as_deref(),
|
|
||||||
disabled: item.name.is_none(),
|
disabled: item.name.is_none(),
|
||||||
|
value: item.name,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
(forms::InputGroup {
|
(forms::InputGroup {
|
||||||
|
@ -269,14 +269,14 @@ async fn edit_item(
|
||||||
name: "class",
|
name: "class",
|
||||||
title: "Class",
|
title: "Class",
|
||||||
required: true,
|
required: true,
|
||||||
value: Some(item.class.to_string().as_str()),
|
value: Some(item.class.to_string()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
(forms::InputGroup {
|
(forms::InputGroup {
|
||||||
r#type: forms::InputType::Text,
|
r#type: forms::InputType::Text,
|
||||||
name: "parent",
|
name: "parent",
|
||||||
title: "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(),
|
disabled: item.parent.is_none(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
|
|
@ -218,14 +218,14 @@ async fn edit_item_class(
|
||||||
title: "UUID",
|
title: "UUID",
|
||||||
disabled: true,
|
disabled: true,
|
||||||
required: true,
|
required: true,
|
||||||
value: Some(item_class.id.to_string().as_str()),
|
value: Some(item_class.id.to_string()),
|
||||||
})
|
})
|
||||||
(forms::InputGroup {
|
(forms::InputGroup {
|
||||||
r#type: forms::InputType::Text,
|
r#type: forms::InputType::Text,
|
||||||
name: "name",
|
name: "name",
|
||||||
title: "Name",
|
title: "Name",
|
||||||
required: true,
|
required: true,
|
||||||
value: Some(&item_class.name),
|
value: Some(item_class.name),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
(forms::InputGroup {
|
(forms::InputGroup {
|
||||||
|
@ -233,7 +233,7 @@ async fn edit_item_class(
|
||||||
name: "parent",
|
name: "parent",
|
||||||
title: "Parent",
|
title: "Parent",
|
||||||
disabled: item_class.parent.is_none(),
|
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()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub struct InputGroup<'a> {
|
||||||
pub title: &'a str,
|
pub title: &'a str,
|
||||||
pub required: bool,
|
pub required: bool,
|
||||||
pub disabled: bool,
|
pub disabled: bool,
|
||||||
pub value: Option<&'a str>,
|
pub value: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InputGroup<'_> {
|
impl Default for InputGroup<'_> {
|
||||||
|
@ -44,7 +44,7 @@ impl Default for InputGroup<'_> {
|
||||||
impl InputGroup<'_> {
|
impl InputGroup<'_> {
|
||||||
fn main_input(&self) -> Markup {
|
fn main_input(&self) -> Markup {
|
||||||
html! {
|
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