documetation updates
This commit is contained in:
parent
f3b1a0d7e8
commit
48a376f3bd
@ -1,3 +1,4 @@
|
|||||||
|
//! This modules contains the parts for making the app translatable.
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use fluent::{FluentArgs, FluentBundle, FluentResource};
|
use fluent::{FluentArgs, FluentBundle, FluentResource};
|
||||||
@ -5,7 +6,7 @@ use seed::log;
|
|||||||
use shared::datatypes::Lang;
|
use shared::datatypes::Lang;
|
||||||
use unic_langid::LanguageIdentifier;
|
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)]
|
#[derive(Clone)]
|
||||||
pub struct I18n {
|
pub struct I18n {
|
||||||
lang: Lang,
|
lang: Lang,
|
||||||
@ -13,6 +14,7 @@ pub struct I18n {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for I18n {
|
impl std::fmt::Debug for I18n {
|
||||||
|
/// On debug print skip the bundle
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", self.lang)
|
write!(f, "{:?}", self.lang)
|
||||||
}
|
}
|
||||||
@ -52,9 +54,7 @@ impl I18n {
|
|||||||
.format_pattern(pattern, args, &mut vec![])
|
.format_pattern(pattern, args, &mut vec![])
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl I18n {
|
|
||||||
/// Prettyprint the language name
|
/// Prettyprint the language name
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn label(&self) -> &'static str {
|
pub const fn label(&self) -> &'static str {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//! The admin interface of pslink. It communicates with the server mostly via https and json.
|
||||||
pub mod i18n;
|
pub mod i18n;
|
||||||
pub mod navigation;
|
pub mod navigation;
|
||||||
pub mod pages;
|
pub mod pages;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//! Create the top menu of the app
|
||||||
use fluent::fluent_args;
|
use fluent::fluent_args;
|
||||||
use seed::{a, attrs, div, li, nav, nodes, ol, prelude::*, Url, C};
|
use seed::{a, attrs, div, li, nav, nodes, ol, prelude::*, Url, C};
|
||||||
use shared::{
|
use shared::{
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! List all users in case an admin views it, list the "self" user otherwise.
|
||||||
|
|
||||||
use enum_map::EnumMap;
|
use enum_map::EnumMap;
|
||||||
use seed::{a, attrs, div, h1, input, log, p, prelude::*, section, table, td, th, tr, Url, C, IF};
|
use seed::{a, attrs, div, h1, input, log, p, prelude::*, section, table, td, th, tr, Url, C, IF};
|
||||||
use shared::{
|
use shared::{
|
||||||
@ -39,23 +41,27 @@ pub struct Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
impl Model {
|
||||||
|
/// set the language of this page (part)
|
||||||
pub fn set_lang(&mut self, l: Lang) {
|
pub fn set_lang(&mut self, l: Lang) {
|
||||||
self.i18n.set_lang(l);
|
self.i18n.set_lang(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
impl Model {
|
||||||
|
/// removing all open dialogs (often to open another afterwards).
|
||||||
fn clean_dialogs(&mut self) {
|
fn clean_dialogs(&mut self) {
|
||||||
self.last_message = None;
|
self.last_message = None;
|
||||||
self.user_edit = None;
|
self.user_edit = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A type containing one input field for later use.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
struct FilterInput {
|
struct FilterInput {
|
||||||
filter_input: ElRef<web_sys::HtmlInputElement>,
|
filter_input: ElRef<web_sys::HtmlInputElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The message splits the contained message into messages related to querrying and messages related to editing.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
Query(UserQueryMsg),
|
Query(UserQueryMsg),
|
||||||
@ -101,6 +107,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Update all
|
||||||
pub fn process_query_messages(msg: UserQueryMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
pub fn process_query_messages(msg: UserQueryMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||||
match msg {
|
match msg {
|
||||||
UserQueryMsg::Fetch => {
|
UserQueryMsg::Fetch => {
|
||||||
|
@ -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 home;
|
||||||
pub mod list_links;
|
pub mod list_links;
|
||||||
pub mod list_users;
|
pub mod list_users;
|
||||||
|
Loading…
Reference in New Issue
Block a user