From bc57c6bf1b9756565a6cad86035fed278f1f37c4 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Mon, 25 Mar 2024 23:30:17 -0500 Subject: [PATCH] begin building tuts list logic --- src/routes.rs | 6 ++++-- src/templates.rs | 4 +++- templates/tuts.html | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/routes.rs b/src/routes.rs index 5783408..00f01e4 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -21,7 +21,9 @@ pub async fn notes() -> impl IntoResponse { } pub async fn tuts() -> impl IntoResponse { - templates::Tuts + templates::Tuts { + tuts_list: "some tuts", + } } pub async fn tuts_builder(path: String) -> Result { @@ -29,7 +31,7 @@ pub async fn tuts_builder(path: String) -> Result { let file_contents_to_html = markdown_to_html(file_contents.as_str(), &comrak::Options::default()); let file_template = Tut { - title: "test title", + title: "Note", content: file_contents_to_html.as_str(), }; let response = Response::builder() diff --git a/src/templates.rs b/src/templates.rs index 44c4ad3..71c6975 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -10,7 +10,9 @@ pub struct Notes; #[derive(Template)] #[template(path = "tuts.html")] -pub struct Tuts; +pub struct Tuts<'a> { + pub tuts_list: &'a str, +} #[derive(Template)] #[template(path = "tut.html", ext = "html", escape = "none")] diff --git a/templates/tuts.html b/templates/tuts.html index 608b21b..7013191 100644 --- a/templates/tuts.html +++ b/templates/tuts.html @@ -7,5 +7,6 @@ content %}

Notes

-

Here all my Micro Tuts go

+

Here all my Micro Tuts

+{{tuts_list}} {% endblock content%}