Mark system library content

This commit is contained in:
2023-08-31 11:32:51 +02:00
parent 0b0188bd30
commit a8851c5e4f
6 changed files with 77 additions and 20 deletions

View File

@@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
use crate::model::onkostar_editor::OnkostarEditor;
use crate::model::requirements::{Requirement, Requires};
use crate::model::{
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FormEntry,
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FolderContent, FormEntry,
FormEntryContainer, Listable, MenuCategory, PlausibilityRules, Script, Sortable,
};
use crate::model::{Haeufigkeiten, Ordner};
@@ -197,14 +197,22 @@ impl Listable for Unterformular {
fn to_listed_string(&self) -> String {
if self.hat_unterformulare {
return format!(
"Unterformular '{}' in Revision '{}' {}",
"Unterformular ({}) '{}' in Revision '{}' {}",
match self.is_system_library_content() {
true => style("S").yellow(),
_ => style("u"),
},
style(&self.name).yellow(),
style(&self.revision).yellow(),
style("Unterformular mit Markierung 'hat Unterformulare'!").red()
);
}
format!(
"Unterformular '{}' in Revision '{}'",
"Unterformular ({}) '{}' in Revision '{}'",
match self.is_system_library_content() {
true => style("S").yellow(),
_ => style("u"),
},
style(&self.name).yellow(),
style(&self.revision).yellow()
)
@@ -265,9 +273,8 @@ impl Requires for Unterformular {
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
format!(
"Unterformular '{}' in Revision '{}'\n{}",
style(&self.name).yellow(),
style(&self.revision).yellow(),
"{}\n{}",
self.to_listed_string(),
self.get_required_entries(all)
.iter()
.map(|entry| match entry {
@@ -300,6 +307,12 @@ impl Requires for Unterformular {
}
}
impl FolderContent for Unterformular {
fn get_library_folder(&self) -> String {
self.ordner.bibliothek.name.to_string()
}
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct DataCatalogues {