summaryrefslogtreecommitdiff
path: root/src/viewmodel/telephone.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/telephone.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/telephone.rs')
-rw-r--r--src/viewmodel/telephone.rs106
1 files changed, 0 insertions, 106 deletions
diff --git a/src/viewmodel/telephone.rs b/src/viewmodel/telephone.rs
deleted file mode 100644
index 44b938f..0000000
--- a/src/viewmodel/telephone.rs
+++ /dev/null
@@ -1,106 +0,0 @@
-use super::*;
-use crate::view::telephone::*;
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Telephone {
- pub number: String,
- pub work: bool,
- pub home: bool,
- pub text: bool,
- pub voice: bool,
- pub fax: bool,
- pub cell: bool,
- pub video: bool,
- pub pager: bool,
- pub text_phone: bool,
-}
-
-impl VCardPropertyInputObject<TelephoneView> for Telephone {
- fn new() -> Self {
- Self {
- number: String::new(),
- work: false,
- home: false,
- text: false,
- voice: false,
- fax: false,
- cell: false,
- video: false,
- pager: false,
- text_phone: false,
- }
- }
- fn get_input_fields(
- &self,
- link: &ComponentLink<TelephoneView>,
- ) -> Vec<VCardPropertyInputField> {
- let typ = String::from("tel");
- vec![
- VCardPropertyInputField::Text {
- label: "Number".to_string(),
- id: Some("number".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateNumber(e.value)),
- value: self.number.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,
- },
- VCardPropertyInputField::CheckBox {
- label: "Text".to_string(),
- id: Some("text".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleText),
- value: self.text,
- },
- VCardPropertyInputField::CheckBox {
- label: "Voice".to_string(),
- id: Some("voice".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleVoice),
- value: self.voice,
- },
- VCardPropertyInputField::CheckBox {
- label: "Fax".to_string(),
- id: Some("fax".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleFax),
- value: self.fax,
- },
- VCardPropertyInputField::CheckBox {
- label: "Cell".to_string(),
- id: Some("cell".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleCell),
- value: self.cell,
- },
- VCardPropertyInputField::CheckBox {
- label: "Video".to_string(),
- id: Some("video".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleVideo),
- value: self.video,
- },
- VCardPropertyInputField::CheckBox {
- label: "Pager".to_string(),
- id: Some("pager".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::TogglePager),
- value: self.pager,
- },
- VCardPropertyInputField::CheckBox {
- label: "Text Phone".to_string(),
- id: Some("text_phone".to_string()),
- onclick: link.callback(|_: MouseEvent| Msg::ToggleTextPhone),
- value: self.text_phone,
- },
- ]
- }
- fn is_empty(&self) -> bool {
- self.number.is_empty()
- }
-}