summaryrefslogtreecommitdiff
path: root/src/viewmodel/organizational.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/organizational.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/organizational.rs')
-rw-r--r--src/viewmodel/organizational.rs88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/viewmodel/organizational.rs b/src/viewmodel/organizational.rs
deleted file mode 100644
index 72b19d2..0000000
--- a/src/viewmodel/organizational.rs
+++ /dev/null
@@ -1,88 +0,0 @@
-use super::*;
-use crate::view::organizational::*;
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Organizational {
- pub org: String,
- pub logo: Option<File>,
- pub title: String,
- pub role: String,
- pub member: String,
- pub related: String,
-}
-
-impl VCardPropertyInputObject<OrganizationalView> for Organizational {
- fn new() -> Self {
- Self {
- org: String::new(),
- logo: None,
- title: String::new(),
- role: String::new(),
- member: String::new(),
- related: String::new(),
- }
- }
- fn get_input_fields(
- &self,
- link: &yew::html::Scope<OrganizationalView>,
- ) -> std::vec::Vec<VCardPropertyInputField> {
- let typ = String::from("text");
- vec![
- VCardPropertyInputField::Text {
- label: "Organisation".to_string(),
- id: Some("org".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateOrg(e.value)),
- value: self.org.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::File {
- // TODO: Add Upload for logo
- label: "Logo".to_string(),
- name: "logo".to_string(),
- callback: link.callback(|file: Option<File>| Msg::UpdateLogo(file)),
- value: self.logo.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Title".to_string(),
- id: Some("title".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateTitle(e.value)),
- value: self.title.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Role".to_string(),
- id: Some("role".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateRole(e.value)),
- value: self.role.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Member".to_string(),
- id: Some("member".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateMember(e.value)),
- value: self.member.clone(),
- typ: typ.clone(),
- },
- VCardPropertyInputField::Text {
- label: "Related".to_string(),
- id: Some("related".to_string()),
- placeholder: None,
- oninput: link.callback(|e: InputData| Msg::UpdateRelated(e.value)),
- value: self.related.clone(),
- typ: typ,
- },
- ]
- }
- fn is_empty(&self) -> bool {
- self.org.is_empty()
- && self.logo.is_none()
- && self.title.is_empty()
- && self.role.is_empty()
- && self.member.is_empty()
- && self.related.is_empty()
- }
-}