Add layout and feeds page, add hotwire

This commit is contained in:
2023-06-01 22:48:09 -04:00
parent 74f353b894
commit a67ffbbbed
6 changed files with 85 additions and 12 deletions

View File

@@ -1,20 +1,20 @@
use axum::extract::State;
use maud::{html, Markup};
use axum::response::Response;
use maud::html;
use sqlx::PgPool;
use crate::error::Result;
use crate::models::entry::get_entries;
use crate::partials::header::header;
use crate::partials::layout::Layout;
pub async fn get(State(pool): State<PgPool>) -> Result<Markup> {
pub async fn get(State(pool): State<PgPool>, layout: Layout) -> Result<Response> {
let entries = get_entries(&pool).await?;
Ok(html! {
(header())
Ok(layout.render(html! {
ul {
@for entry in entries {
@let title = entry.title.unwrap_or_else(|| "Untitled".to_string());
li { (title) }
}
}
})
}))
}