Finish i18ning the account settings page

This commit is contained in:
asonix 2021-01-28 20:39:42 -06:00
parent e0858b7b3d
commit 2524770186
3 changed files with 21 additions and 13 deletions

View file

@ -1,19 +1,23 @@
@use crate::ActixLoader;
@use crate::templates::accounts::inputs::password_input;
@use hyaenidae_accounts::UpdatePasswordState;
@use hyaenidae_toolkit::{templates::{button_group, card, card_body, card_title}, Button, Card};
@use i18n_embed_fl::fl;
@(card_config: &Card, state: &UpdatePasswordState)
@(card_config: &Card, loader: &ActixLoader, state: &UpdatePasswordState)
@:card(card_config, {
<form method="POST" action="@state.update_password_path()">
@:card_title({ Update Password })
@:card_title({ @fl!(loader, "update-password-heading") })
@:card_body({
@:password_input("new_password", "New Password", state.new_password(), None, state.dark)
@:password_input("new_password_confirmation", "New Password Confirmation", state.new_password_confirmation(), state.new_password_confirmation_error(), state.dark)
@:password_input("password", "Password", state.password(), state.password_error(), state.dark)
@:password_input("new_password", &fl!(loader, "update-password-input"), state.new_password(), None, state.dark)
@:password_input("new_password_confirmation", &fl!(loader, "confirm-password-input"), state.new_password_confirmation(), state.new_password_confirmation_error(), state.dark)
@:password_input("password", &fl!(loader, "password-input"), state.password(), state.password_error(), state.dark)
})
@:card_body({
@:button_group(&[Button::primary("Update Password")])
@:button_group(&[
Button::primary(&fl!(loader, "update-password-button"))
])
})
</form>
})

View file

@ -1,18 +1,22 @@
@use crate::ActixLoader;
@use crate::templates::accounts::inputs::{text_input, password_input};
@use hyaenidae_accounts::UpdateUsernameState;
@use hyaenidae_toolkit::{templates::{button_group, card, card_body, card_title}, Button, Card};
@use i18n_embed_fl::fl;
@(card_config: &Card, state: &UpdateUsernameState)
@(card_config: &Card, loader: &ActixLoader, state: &UpdateUsernameState)
@:card(card_config, {
<form method="POST" action="@state.update_username_path()">
@:card_title({ Update Username })
@:card_title({ @fl!(loader, "update-username-heading") })
@:card_body({
@:text_input("new_username", "New Username", state.username(), state.username_error(), state.dark)
@:password_input("password", "Password", state.password(), state.password_error(), state.dark)
@:text_input("new_username", &fl!(loader, "update-username-input"), state.username(), state.username_error(), state.dark)
@:password_input("password", &fl!(loader, "password-input"), state.password(), state.password_error(), state.dark)
})
@:card_body({
@:button_group(&[Button::primary("Update Username")])
@:button_group(&[
Button::primary(&fl!(loader, "update-username-button")),
])
})
</form>
})

View file

@ -14,8 +14,8 @@
@:card(&Card::full_width().dark(nav_state.dark()), {
@:card_title({ @fl!(loader, "username-heading", currentUsername = user.username()) })
})
@:update_username(&Card::full_width().dark(nav_state.dark()), uname_state)
@:update_password(&Card::full_width().dark(nav_state.dark()), pass_state)
@:update_username(&Card::full_width().dark(nav_state.dark()), loader, uname_state)
@:update_password(&Card::full_width().dark(nav_state.dark()), loader, pass_state)
@:card(&Card::full_width().dark(nav_state.dark()), {
@:card_title({ @fl!(loader, "danger-heading") })
@:card_body({