Show when a post or page is a draft
This commit is contained in:
parent
37d6c3cd4d
commit
a93b5b7cf0
4 changed files with 17 additions and 2 deletions
|
@ -7,6 +7,7 @@ use crate::{block_types::BlockTypes, AppState};
|
|||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
pub(crate) struct PageTemplate {
|
||||
draft: bool,
|
||||
title: String,
|
||||
description: Option<String>,
|
||||
show_title: bool,
|
||||
|
@ -17,6 +18,7 @@ pub(crate) struct PageTemplate {
|
|||
#[derive(Template)]
|
||||
#[template(path = "post.html")]
|
||||
pub(crate) struct PostTemplate {
|
||||
draft: bool,
|
||||
title: String,
|
||||
summary: Option<String>,
|
||||
publish_date: String,
|
||||
|
@ -42,6 +44,7 @@ use sea_orm::*;
|
|||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
pub(crate) struct HomeSpecialTemplate {
|
||||
draft: bool,
|
||||
title: String,
|
||||
description: Option<String>,
|
||||
show_title: bool,
|
||||
|
@ -91,6 +94,7 @@ pub(crate) async fn root(
|
|||
description: page_meta.clone().description,
|
||||
show_title: page_meta.clone().show_title,
|
||||
content_blocks,
|
||||
year: "2023".to_string()
|
||||
year: "2023".to_string(),
|
||||
draft: false,
|
||||
}
|
||||
}
|
|
@ -58,6 +58,7 @@ pub(crate) async fn resolver(
|
|||
).collect();
|
||||
|
||||
(StatusCode::FOUND, PageTemplate {
|
||||
draft: page_meta.clone().draft,
|
||||
title: page_meta.clone().title,
|
||||
description: page_meta.clone().description,
|
||||
show_title: page_meta.clone().show_title,
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if draft == true -%}
|
||||
<blockquote>
|
||||
⚠️ This page is marked as a <b>draft</b>! It may not yet be complete!
|
||||
</blockquote>
|
||||
{% endif -%}
|
||||
|
||||
{% if show_title == true -%}
|
||||
<h1>{{ title }}</h1>
|
||||
|
@ -31,5 +36,4 @@
|
|||
<b>UNSUPPORTED block type here!</b>
|
||||
{% endmatch %}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if draft == true -%}
|
||||
<blockquote>
|
||||
⚠️ This post is marked as a <b>draft</b>! It may not yet be complete!
|
||||
</blockquote>
|
||||
{% endif -%}
|
||||
|
||||
<h1>{{ title }}</h1>
|
||||
{% match summary %}
|
||||
{% when Some with (summary_content) %}
|
||||
|
|
Reference in a new issue