This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
136 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use askama_axum::Template; | ||
use axum_messages::Messages; | ||
|
||
pub(in crate::routes::admin) async fn newsletter_form( | ||
messages: Messages, | ||
) -> NewsletterForm<'static> { | ||
let flashes = messages.map(|m| m.message).collect(); | ||
|
||
NewsletterForm { | ||
title: "Send Newsletter", | ||
newsletter_title_label: "Newsletter title", | ||
newsletter_title_placeholder: "Enter newsletter title", | ||
newsletter_html_label: "Newsletter HTML content", | ||
newsletter_html_placeholder: "Enter newsletter HTML content", | ||
newsletter_text_label: "Newsletter text", | ||
newsletter_text_placeholder: "Enter newsletter text", | ||
send_newsletter_button: "Send newsletter", | ||
back_link: "Back", | ||
flashes, | ||
} | ||
} | ||
|
||
#[derive(Template)] | ||
#[template(path = "web/newsletter_form.html")] | ||
pub(in crate::routes::admin) struct NewsletterForm<'a> { | ||
title: &'a str, | ||
newsletter_title_label: &'a str, | ||
newsletter_title_placeholder: &'a str, | ||
newsletter_html_label: &'a str, | ||
newsletter_html_placeholder: &'a str, | ||
newsletter_text_label: &'a str, | ||
newsletter_text_placeholder: &'a str, | ||
send_newsletter_button: &'a str, | ||
back_link: &'a str, | ||
flashes: Vec<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod get; | ||
mod post; | ||
|
||
pub(super) use get::newsletter_form; | ||
pub(super) use post::publish_newsletter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
{%- for flash in flashes %} | ||
<p><i>{{ flash }}</i></p> | ||
{%- endfor %} | ||
|
||
<form action="/admin/newsletters" method="post"> | ||
<label> | ||
{{ newsletter_title_label }}<br> | ||
<input type="text" placeholder="{{ newsletter_title_placeholder }}" name="newsletter_title" required> | ||
</label> | ||
<br> | ||
<br> | ||
<label> | ||
{{ newsletter_html_label }}<br> | ||
<textarea placeholder="{{ newsletter_html_placeholder }}" rows="20" cols="100" name="newsletter_html" | ||
required></textarea> | ||
</label> | ||
<br> | ||
<br> | ||
<label> | ||
{{ newsletter_text_label }}<br> | ||
<textarea type="text" placeholder="{{ newsletter_text_placeholder }}" rows="20" cols="100" | ||
name="newsletter_text" required></textarea> | ||
</label> | ||
<br> | ||
<br> | ||
<button type="submit">{{ send_newsletter_button }}</button> | ||
</form> | ||
<p><a href="/admin/dashboard"><- {{ back_link }}</a></p> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters