Make the template a bit more proper

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-11-19 18:17:38 +05:30
parent db32d8b07e
commit bf76580950
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
3 changed files with 18 additions and 17 deletions

View file

@ -10,7 +10,7 @@ struct Template {
async fn paste_render(data: Data<Template>) -> impl Responder { async fn paste_render(data: Data<Template>) -> impl Responder {
let my_data = data.get_ref(); let my_data = data.get_ref();
let mut context = Context::new(); let mut context = Context::new();
context.insert("paste_id", "owo"); context.insert("paste_content", "owo");
let rendered = my_data.paste.render("paste.html", &context); let rendered = my_data.paste.render("paste.html", &context);
HttpResponse::Ok().body(rendered.unwrap()) HttpResponse::Ok().body(rendered.unwrap())
} }

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Actix Web</title>
</head>
<body>
{% block content %}
{% endblock content %}
</body>
</html>

View file

@ -1,5 +1,17 @@
{% extends "base.html" %} <!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<body>
<h2 class="text-3xl font-bold">
Obsolute Paste - baalajimaestro
</h2>
{% block content %} {% block content %}
<h1>This is {{paste_id}}</h1> <textarea readonly>
{{paste_content}}
</textarea>
{% endblock content %} {% endblock content %}
</body>
</html>