Skip to content

Commit

Permalink
Banjofox/update ructe templates (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
BanjoFox authored Oct 16, 2024
1 parent fafae6a commit 646db72
Show file tree
Hide file tree
Showing 42 changed files with 695 additions and 790 deletions.
99 changes: 10 additions & 89 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions aardwolf-templates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ build = "build.rs"

[build-dependencies]
config = "0.14.0"
ructe = "^0.13.4" # Careted to require exactly 0.13 because newer versions break the build.
ructe = "0.17.2" # Careted to require exactly 0.13 because newer versions break the build.

[dependencies]
gettext = "0.4"
gettext-macros = "0.6.1"
gettext-utils = "0.1.0"
rust-i18n = "3" # Adding rust-i18n for handling localization

[dependencies.rocket_i18n]
version = "0.4.1"
Expand All @@ -32,11 +33,6 @@ path = "../aardwolf-models"
version = "0.1.0"
path = "../aardwolf-yew-frontend"

#-
# Adding rust-i18n for handling localization
[dependencies]
rust-i18n = "3"

#-
# Adding syn for template compilation
[dependencies.syn]
Expand Down
10 changes: 10 additions & 0 deletions aardwolf-templates/src/asides/shortcuts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ pub struct Shortcuts<'a> {
pub(crate) profile_link: &'a str,
pub(crate) username: &'a str,
}

impl<'a> Shortcuts<'a> {
pub fn new(catalog: &'a Catalog, profile_link: &'a str, username: &'a str) -> Self {
Self {
catalog,
profile_link,
username,
}
}
}
2 changes: 1 addition & 1 deletion aardwolf-templates/src/elements/alert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl std::fmt::Display for AlertKind {
write!(f, "{}", s)
}
}

#[derive(Debug)]
pub struct Alert {
pub(crate) kind: AlertKind,
pub(crate) message: String,
Expand Down
30 changes: 7 additions & 23 deletions aardwolf-templates/src/elements/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ impl<'a> From<&'a InputEmail<'a>> for Input<'a> {
}
}

impl<'a> From<&'a InputText<'a>> for Input<'a> {
fn from(t: &'a InputText<'a>) -> Self {
Input {
kind: "text",
name: t.name,
label: Some(t.label.clone()),
placeholder: t.placeholder.clone(),
icon: t.icon,
value: t.value,
error: t.error.clone(),
}
}
}

pub struct InputPassword<'a> {
pub(crate) name: &'a str,
pub(crate) label: String,
Expand All @@ -86,19 +72,17 @@ pub struct InputEmail<'a> {
pub(crate) error: Option<String>,
}

pub struct InputText<'a> {
pub(crate) name: &'a str,
pub(crate) label: String,
pub(crate) placeholder: Option<String>,
pub(crate) icon: Option<&'a str>,
pub(crate) value: &'a str,
pub(crate) error: Option<String>,
}

pub struct InputCheckbox<'a> {
pub(crate) name: &'a str,
pub(crate) label: String,
pub(crate) icon: Option<&'a str>,
pub(crate) checked: bool,
pub(crate) error: Option<String>,
}

pub enum InputKind {
Text,
Checkbox,
Select,

}
Loading

0 comments on commit 646db72

Please sign in to comment.