Extract method to apply form field profile part

This commit is contained in:
2023-09-01 12:31:48 +02:00
parent 1e7a95bb09
commit 3ec51099c7
3 changed files with 24 additions and 15 deletions

View File

@@ -28,7 +28,7 @@ use std::hash::{Hash, Hasher};
use serde::{Deserialize, Serialize};
use crate::profile::{FormReference, Profile};
use crate::profile::{FormField, FormReference, Profile};
pub mod data_catalogue;
pub mod data_form;
@@ -232,6 +232,15 @@ where
}
}
fn apply_profile_to_form_field<E>(entry: &mut E, form_field: &FormField)
where
E: FormEntry,
{
if entry.get_name() == form_field.name && form_field.hide {
entry.hide()
}
}
pub trait FormEntryContainer {
fn apply_profile(&mut self, profile: &Profile);
}