home fragmentization
This commit is contained in:
parent
3de7389500
commit
76fb971a24
3 changed files with 25 additions and 19 deletions
|
@ -53,7 +53,7 @@ async fn open_shift(State(state): State<AppState>) -> impl IntoResponse {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
render!(crate::templates::home_html, shift)
|
render!(crate::templates::components::home_fragment_html, shift)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn close_shift(State(state): State<AppState>, Path(id): Path<u32>) -> impl IntoResponse {
|
async fn close_shift(State(state): State<AppState>, Path(id): Path<u32>) -> impl IntoResponse {
|
||||||
|
|
22
templates/components/home_fragment.rs.html
Normal file
22
templates/components/home_fragment.rs.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
@use super::shift_button_html;
|
||||||
|
@use cm_lib::models::Shift;
|
||||||
|
|
||||||
|
@(open_shift: Option<Shift>)
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div>
|
||||||
|
@:shift_button_html(open_shift.as_ref())
|
||||||
|
</div>
|
||||||
|
@if open_shift.is_some() {
|
||||||
|
<div hx-boost="true">
|
||||||
|
<a href="/shifts/@open_shift.unwrap().id/drinks">
|
||||||
|
<button>Drinks</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div hx-boost="true">
|
||||||
|
<a href="/shift_reports">
|
||||||
|
<button>Shift Reports</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</main>
|
|
@ -1,27 +1,11 @@
|
||||||
@use super::base_html;
|
@use super::base_html;
|
||||||
@use super::components::shift_button_html;
|
@use super::components::home_fragment_html;
|
||||||
@use cm_lib::models::Shift;
|
@use cm_lib::models::Shift;
|
||||||
|
|
||||||
@(open_shift: Option<Shift>)
|
@(open_shift: Option<Shift>)
|
||||||
|
|
||||||
@:base_html({
|
@:base_html({
|
||||||
|
|
||||||
<main>
|
@:home_fragment_html(open_shift)
|
||||||
<div>
|
|
||||||
@:shift_button_html(open_shift.as_ref())
|
|
||||||
</div>
|
|
||||||
@if open_shift.is_some() {
|
|
||||||
<div hx-boost="true">
|
|
||||||
<a href="/shifts/@open_shift.unwrap().id/drinks">
|
|
||||||
<button>Drinks</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<div hx-boost="true">
|
|
||||||
<a href="/shift_reports">
|
|
||||||
<button>Shift Reports</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue