Skip to content

Commit 5a438e5

Browse files
authored
Add body components (#1015)
1 parent f91a98d commit 5a438e5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pgml-dashboard/src/templates/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use pgml_components::Component;
12
use std::collections::HashMap;
23

34
pub use crate::components::{self, NavLink, StaticNav, StaticNavLink};
@@ -104,6 +105,7 @@ pub struct WebAppBase<'a> {
104105
pub account_management_nav: StaticNav,
105106
pub upper_left_nav: StaticNav,
106107
pub lower_left_nav: StaticNav,
108+
pub body_components: Vec<Component>,
107109
}
108110

109111
impl<'a> WebAppBase<'a> {
@@ -153,6 +155,11 @@ impl<'a> WebAppBase<'a> {
153155
self
154156
}
155157

158+
pub fn body_components(&mut self, components: Vec<Component>) -> &mut Self {
159+
self.body_components = components;
160+
self
161+
}
162+
156163
pub fn render<T>(&mut self, template: T) -> String
157164
where
158165
T: sailfish::TemplateOnce,

pgml-dashboard/templates/layout/web_app_base.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<html lang="en-US" data-bs-theme="dark">
1919
<%- head %>
2020
<body>
21+
<% for component in body_components { %>
22+
<%+ component %>
23+
<% } %>
2124
<main>
2225
<div class="container-fluid p-0 min-vh-lg-100">
2326
<div class="row gx-0 min-vh-lg-100 gy-0">

0 commit comments

Comments
 (0)