summaryrefslogtreecommitdiff
path: root/src/viewmodel/address.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
commitcb310a66e94db4e0c4f7d0373a670156b012412a (patch)
tree501fd4ed17d892d693d4123fffaca8d942144e3b /src/viewmodel/address.rs
parentbe3367dd2921eb30ae7970d233b83ac3af861952 (diff)
parent0660151a8b641fa0a23dde2598132029970f7ae4 (diff)
downloadwasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.gz
wasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.bz2
Merge branch 'main' of codeberg.org:jelemux/wasm-card
Diffstat (limited to 'src/viewmodel/address.rs')
-rw-r--r--src/viewmodel/address.rs113
1 files changed, 0 insertions, 113 deletions
diff --git a/src/viewmodel/address.rs b/src/viewmodel/address.rs
deleted file mode 100644
index 9542675..0000000
--- a/src/viewmodel/address.rs
+++ /dev/null
@@ -1,113 +0,0 @@
-use super::*;
-use crate::view::address::*;
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Address {
- pub post_office_box: String,
- pub extension: String,
- pub street: String,
- pub locality: String,
- pub region: String,
- pub code: String,
- pub country: String,
- pub work: bool,
- pub home: bool,
-}
-
-impl VCardPropertyInputObject<AddressView> for Address {
- fn new() -> Self {
- Self {
- post_office_box: String::new(),
- extension: String::new(),
- street: String::new(),
- locality: String::new(),
- region: String::new(),
- code: String::new(),
- country: String::new(),
- work: false,
- home: false,
- }
- }
- fn get_input_fields(&self, link: &ComponentLink<AddressView>) -> Vec<VCardPropertyInputField> {
- let typ = String::from("text");
- vec![
- VCardPropertyInputField::Text {
- label: "Post Office Box".to_string(),
- id: Some("post_office_box".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdatePostOfficeBox(e.value)),
- value: self.post_office_box.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Extension".to_string(),
- id: Some("extension".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateExtension(e.value)),
- value: self.extension.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Street".to_string(),
- id: Some("street".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateStreet(e.value)),
- value: self.street.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Locality".to_string(),
- id: Some("locality".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateLocality(e.value)),
- value: self.locality.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Region".to_string(),
- id: Some("region".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateRegion(e.value)),
- value: self.region.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Code".to_string(),
- id: Some("code".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateCode(e.value)),
- value: self.code.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Country".to_string(),
- id: Some("country".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateCountry(e.value)),
- value: self.country.clone(),
- typ,
- },
- VCardPropertyInputField::CheckBox {
- label: "Work".to_string(),
- id: Some("work".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleWork),
- value: self.work,
- },
- VCardPropertyInputField::CheckBox {
- label: "Home".to_string(),
- id: Some("home".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleHome),
- value: self.home,
- },
- ]
- }
- fn is_empty(&self) -> bool {
- self.post_office_box.is_empty()
- && self.extension.is_empty()
- && self.street.is_empty()
- && self.locality.is_empty()
- && self.region.is_empty()
- && self.code.is_empty()
- && self.country.is_empty()
- }
-}