NOT WORKING
This commit is contained in:
parent
b7cf19f229
commit
8a23681a12
|
@ -6,12 +6,31 @@ use askama::Template;
|
|||
|
||||
use crate::{database::Database, web::templates::IndexTemplate};
|
||||
|
||||
use super::templates::IndexTemplatePost;
|
||||
|
||||
|
||||
// NOTE: Not usefull to have database here but just so u know how
|
||||
pub async fn index(_: Data<Mutex<Database>>) -> Result<impl Responder> {
|
||||
let html = IndexTemplate {
|
||||
placeholder: "hewwo world"
|
||||
posts: vec![
|
||||
IndexTemplatePost {
|
||||
image: String::from("/static/assets/uwu.jpg"),
|
||||
title: String::from("Cutie"),
|
||||
description: String::from("Yes you are ;3"),
|
||||
url: String::from("https://djc.github.io/askama/template_expansion.html")
|
||||
}
|
||||
],
|
||||
title: String::from("Very cool mcoranges website :3"),
|
||||
}.render().expect("Failed to render index.html");
|
||||
|
||||
Ok(Html(html))
|
||||
}
|
||||
/*
|
||||
<div class="post">
|
||||
<img src="/static/assets/uwu.jpg" alt="post img">
|
||||
<span>
|
||||
<h2>Title text</h3>
|
||||
<p>Description text</p>
|
||||
</span>
|
||||
</div>
|
||||
*/
|
|
@ -1,7 +1,16 @@
|
|||
use askama::Template;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Template)]
|
||||
#[derive(Debug, Clone, Template)]
|
||||
#[template(path = "index.html")]
|
||||
pub struct IndexTemplate<'a> {
|
||||
pub placeholder: &'a str,
|
||||
pub struct IndexTemplate{
|
||||
pub title: String,
|
||||
pub posts: Vec<IndexTemplatePost>
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct IndexTemplatePost {
|
||||
pub image: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub url: String
|
||||
}
|
|
@ -1,78 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>placeholder</title>
|
||||
<title>{{title}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/static/css/global.css">
|
||||
<link rel="stylesheet" href="/static/css/index.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<input type="checkbox" id="toggle">
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div class="box titlebar">
|
||||
|
||||
<h1>Placeholder</h1>
|
||||
|
||||
<h1>{{title}}</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="main-pane">
|
||||
|
||||
|
||||
<div class="box" id="sidenav">
|
||||
|
||||
<a href="#">Home</a>
|
||||
<a href="#">Home</a>
|
||||
<a href="#">Home</a>
|
||||
<a href="#">Home</a>
|
||||
<label id="login-btn" for="toggle">Login</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box" id="content-pane">
|
||||
|
||||
|
||||
<p>{{placeholder}}</p>
|
||||
|
||||
<div class="post">
|
||||
<img class="post-img" src="/static/assets/uwu.jpg" alt="post img">
|
||||
<span>
|
||||
<h2 class="post-title">Title text</h3>
|
||||
<p class="post-desc">Description text</p>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<img class="post-img" src="/static/assets/uwu.jpg" alt="post img">
|
||||
<span>
|
||||
<h2 class="post-title">Title text</h3>
|
||||
<p class="post-desc">Description text</p>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% for post in posts %}
|
||||
<div class="post">
|
||||
<a href="{{post.url}}"><img src="{{post.image}}" alt="post img"></a>
|
||||
<span>
|
||||
<a href="{{post.url}}"><h2>{{post.title}}</h3></a>
|
||||
<p>{{post.description}}</p>
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="login-modal-container">
|
||||
|
||||
<div id="login-modal">
|
||||
|
||||
<h1>login <labeL for="toggle">(x)</labeL></h1>
|
||||
<p>secrets beyond human comprehension lie beneath this unassuming login screen</p>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="uname"><b>Email:</b></label>
|
||||
<input type="text" name="uname" required>
|
||||
|
|
Loading…
Reference in New Issue
Block a user