From d0d42c5ae00560e4464479a98df90ed063a1c773 Mon Sep 17 00:00:00 2001 From: jelemux Date: Wed, 17 Feb 2021 19:43:30 +0100 Subject: change dates to other_identification and add some stuff --- src/model/mod.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 10 deletions(-) (limited to 'src/model/mod.rs') diff --git a/src/model/mod.rs b/src/model/mod.rs index 45c91f1..b8dcfff 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -7,23 +7,23 @@ use yew::prelude::*; use yew::services::ConsoleService; pub mod address; -pub mod dates; pub mod name; pub mod organizational; +pub mod other_identification; pub mod telephone; pub mod utility; pub mod vcard; /// Trait for types that represent the data of a vcard property used inside of a `VCardPropertyInputComponent`. -pub trait VCardPropertyInputObject: Clone + PartialEq +pub trait VCardPropertyInputGroupObject: Clone + PartialEq where Self: Sized, { - /// Function for creating a new (and empty) `VCardPropertyInputObject`. + /// Function for creating a new (and empty) `VCardPropertyInputGroupObject`. fn new() -> Self; /// Getter function for the title of the component fn get_title(&self) -> String; - /// Converts each field of the `VCardPropertyInputObject` to a VCardPropertyInputField and returns them as a vector. + /// Converts each field of the `VCardPropertyInputGroupObject` to a VCardPropertyInputField and returns them as a vector. fn get_input_fields( &self, link: &ComponentLink>, @@ -33,7 +33,7 @@ where props: InputProps, msg: as yew::Component>::Message, ) -> bool; - /// Returns a `Html` representation of the `VCardPropertyInputObject`. + /// Returns a `Html` representation of the `VCardPropertyInputGroupObject`. fn render(&self, link: &ComponentLink>) -> Html { html! {
@@ -45,7 +45,7 @@ where
} } - /// Convenience function for checking if the `VCardPropertyInputObject` is empty. + /// Convenience function for checking if the `VCardPropertyInputGroupObject` is empty. fn is_empty(&self) -> bool; } @@ -73,6 +73,13 @@ pub enum VCardPropertyInputField { callback: Callback>, value: Option, }, + Select { + label: String, + id: Option, + options: Vec<(String, String)>, + onchange: Callback, + value: String, + }, CheckBox { label: String, id: Option, @@ -99,6 +106,13 @@ impl VCardPropertyInputField { callback, value, } => Self::file_field_input(label, name, callback, value), + Self::Select { + label, + id, + options, + onchange, + value, + } => Self::select_field_input(label, id, options, onchange, value), Self::CheckBox { label, id, @@ -180,10 +194,10 @@ impl VCardPropertyInputField { }); html! {
+ is-one-third-widescreen + is-two-quarters-desktop + is-two-thirds-tablet + is-full-mobile" >
} } + fn select_field_input( + label: &str, + id: &Option, + options: &Vec<(String, String)>, + onchange: &Callback, + value: &str, + ) -> Html { + html! { +
+ +
+ +
+ +
+ } + } /// Returns an `Html` representation of a checkbox input field with the given parameters. fn checkbox_field_input( label: &str, -- cgit v1.2.3