From 48a376f3bdd85c39e47a8a15741cfd85490ff546 Mon Sep 17 00:00:00 2001 From: Dietrich Date: Wed, 16 Jun 2021 14:29:24 +0200 Subject: [PATCH] documetation updates --- app/src/i18n.rs | 6 +++--- app/src/lib.rs | 1 + app/src/navigation.rs | 1 + app/src/pages/list_users.rs | 7 +++++++ app/src/pages/mod.rs | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/i18n.rs b/app/src/i18n.rs index a5821f5..402343a 100644 --- a/app/src/i18n.rs +++ b/app/src/i18n.rs @@ -1,3 +1,4 @@ +//! This modules contains the parts for making the app translatable. use std::sync::Arc; use fluent::{FluentArgs, FluentBundle, FluentResource}; @@ -5,7 +6,7 @@ use seed::log; use shared::datatypes::Lang; use unic_langid::LanguageIdentifier; -// A struct containing the functions and the current language to query the localized strings. +/// A struct containing the data, functions and the current language to query the localized strings. #[derive(Clone)] pub struct I18n { lang: Lang, @@ -13,6 +14,7 @@ pub struct I18n { } impl std::fmt::Debug for I18n { + /// On debug print skip the bundle fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.lang) } @@ -52,9 +54,7 @@ impl I18n { .format_pattern(pattern, args, &mut vec![]) .to_string() } -} -impl I18n { /// Prettyprint the language name #[must_use] pub const fn label(&self) -> &'static str { diff --git a/app/src/lib.rs b/app/src/lib.rs index 013e681..731c6e8 100644 --- a/app/src/lib.rs +++ b/app/src/lib.rs @@ -1,3 +1,4 @@ +//! The admin interface of pslink. It communicates with the server mostly via https and json. pub mod i18n; pub mod navigation; pub mod pages; diff --git a/app/src/navigation.rs b/app/src/navigation.rs index d7df64c..b4cc347 100644 --- a/app/src/navigation.rs +++ b/app/src/navigation.rs @@ -1,3 +1,4 @@ +//! Create the top menu of the app use fluent::fluent_args; use seed::{a, attrs, div, li, nav, nodes, ol, prelude::*, Url, C}; use shared::{ diff --git a/app/src/pages/list_users.rs b/app/src/pages/list_users.rs index 72804db..55d9408 100644 --- a/app/src/pages/list_users.rs +++ b/app/src/pages/list_users.rs @@ -1,3 +1,5 @@ +//! List all users in case an admin views it, list the "self" user otherwise. + use enum_map::EnumMap; use seed::{a, attrs, div, h1, input, log, p, prelude::*, section, table, td, th, tr, Url, C, IF}; use shared::{ @@ -39,23 +41,27 @@ pub struct Model { } impl Model { + /// set the language of this page (part) pub fn set_lang(&mut self, l: Lang) { self.i18n.set_lang(l); } } impl Model { + /// removing all open dialogs (often to open another afterwards). fn clean_dialogs(&mut self) { self.last_message = None; self.user_edit = None; } } +/// A type containing one input field for later use. #[derive(Default, Debug, Clone)] struct FilterInput { filter_input: ElRef, } +/// The message splits the contained message into messages related to querrying and messages related to editing. #[derive(Clone)] pub enum Msg { Query(UserQueryMsg), @@ -101,6 +107,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { } } +/// Update all pub fn process_query_messages(msg: UserQueryMsg, model: &mut Model, orders: &mut impl Orders) { match msg { UserQueryMsg::Fetch => { diff --git a/app/src/pages/mod.rs b/app/src/pages/mod.rs index 4c7c11e..2db85a5 100644 --- a/app/src/pages/mod.rs +++ b/app/src/pages/mod.rs @@ -1,3 +1,4 @@ +//! Containing the individual pages for the admin app so far one to list the links and one to list the users. pub mod home; pub mod list_links; pub mod list_users;