begin building tuts list logic

This commit is contained in:
Triston Armstrong 2024-03-25 23:30:17 -05:00
parent f927091148
commit bc57c6bf1b
3 changed files with 9 additions and 4 deletions

View File

@ -21,7 +21,9 @@ pub async fn notes() -> impl IntoResponse {
} }
pub async fn tuts() -> impl IntoResponse { pub async fn tuts() -> impl IntoResponse {
templates::Tuts templates::Tuts {
tuts_list: "some tuts",
}
} }
pub async fn tuts_builder(path: String) -> Result<impl IntoResponse, ApiError> { pub async fn tuts_builder(path: String) -> Result<impl IntoResponse, ApiError> {
@ -29,7 +31,7 @@ pub async fn tuts_builder(path: String) -> Result<impl IntoResponse, ApiError> {
let file_contents_to_html = let file_contents_to_html =
markdown_to_html(file_contents.as_str(), &comrak::Options::default()); markdown_to_html(file_contents.as_str(), &comrak::Options::default());
let file_template = Tut { let file_template = Tut {
title: "test title", title: "Note",
content: file_contents_to_html.as_str(), content: file_contents_to_html.as_str(),
}; };
let response = Response::builder() let response = Response::builder()

View File

@ -10,7 +10,9 @@ pub struct Notes;
#[derive(Template)] #[derive(Template)]
#[template(path = "tuts.html")] #[template(path = "tuts.html")]
pub struct Tuts; pub struct Tuts<'a> {
pub tuts_list: &'a str,
}
#[derive(Template)] #[derive(Template)]
#[template(path = "tut.html", ext = "html", escape = "none")] #[template(path = "tut.html", ext = "html", escape = "none")]

View File

@ -7,5 +7,6 @@ content %}
</nav> </nav>
<h1>Notes</h1> <h1>Notes</h1>
<p>Here all my Micro Tuts go</p> <p>Here all my Micro Tuts</p>
{{tuts_list}}
{% endblock content%} {% endblock content%}