Add header partial
This commit is contained in:
parent
1698ef9c60
commit
e501c15c66
@ -4,11 +4,12 @@ use sqlx::PgPool;
|
|||||||
|
|
||||||
use crate::error::Result;
|
use crate::error::Result;
|
||||||
use crate::models::entry::get_entries;
|
use crate::models::entry::get_entries;
|
||||||
|
use crate::partials::header::header;
|
||||||
|
|
||||||
pub async fn get(State(pool): State<PgPool>) -> Result<Markup> {
|
pub async fn get(State(pool): State<PgPool>) -> Result<Markup> {
|
||||||
let entries = get_entries(&pool).await?;
|
let entries = get_entries(&pool).await?;
|
||||||
Ok(html! {
|
Ok(html! {
|
||||||
h1 { "crawlnicle" }
|
(header())
|
||||||
ul {
|
ul {
|
||||||
@for entry in entries {
|
@for entry in entries {
|
||||||
@let title = entry.title.unwrap_or_else(|| "Untitled".to_string());
|
@let title = entry.title.unwrap_or_else(|| "Untitled".to_string());
|
||||||
|
@ -2,3 +2,4 @@ pub mod error;
|
|||||||
pub mod handlers;
|
pub mod handlers;
|
||||||
pub mod jobs;
|
pub mod jobs;
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
pub mod partials;
|
||||||
|
14
src/partials/header.rs
Normal file
14
src/partials/header.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use maud::{html, Markup};
|
||||||
|
|
||||||
|
pub fn header() -> Markup {
|
||||||
|
html! {
|
||||||
|
header {
|
||||||
|
nav {
|
||||||
|
h1 { a href="/" { "crawlnicle" } }
|
||||||
|
ul {
|
||||||
|
li { a href="/feeds" { "feeds" } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
src/partials/mod.rs
Normal file
1
src/partials/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod header;
|
Loading…
Reference in New Issue
Block a user