User management completed. Leptos upgraded to 0.5.0.

This commit is contained in:
2023-10-09 17:33:20 +02:00
parent a7188e8153
commit e7af2d402d
18 changed files with 697 additions and 334 deletions
+34 -1
View File
@@ -39,7 +39,9 @@ pub fn data_form<T: 'static + server_fn::ServerFn<()> + Clone + ForValidation>(
</ModalBody>
<ModalFooter>
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"
on:click=move |_| {validator.reset(); opener.hide()}>
on:click=move |_| {
validator.reset();
opener.hide();}>
{trl("Close")}
</button>
<button type="submit" class="btn btn-primary">
@@ -50,3 +52,34 @@ pub fn data_form<T: 'static + server_fn::ServerFn<()> + Clone + ForValidation>(
</ActionForm>
}
}
#[component]
pub fn question_dialog<T: 'static + server_fn::ServerFn<()> + Clone>(
opener: DialogOpener,
action: Action<T, Result<ApiResponse<()>, ServerFnError>>,
title: &'static str,
children: Children
) -> impl IntoView {
let upd_val = action.value();
view! {
<ActionForm action=action>
<ModalDialog opener=opener title=title>
<ModalBody>
<ServerErr result={upd_val} opener=opener/>
{children()}
</ModalBody>
<ModalFooter>
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"
on:click=move |_| {
opener.hide();}>
{trl("No")}
</button>
<button type="submit" class="btn btn-primary">
{trl("Yes")}
</button>
</ModalFooter>
</ModalDialog>
</ActionForm>
}
}