i hate israel
This commit is contained in:
parent
5cea377934
commit
63376af86f
67
2026-01-12_16:52.patch
Normal file
67
2026-01-12_16:52.patch
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
diff --git a/src/web/mod.rs b/src/web/mod.rs
|
||||
index f919e6e..4f03aa9 100644
|
||||
--- a/src/web/mod.rs
|
||||
+++ b/src/web/mod.rs
|
||||
@@ -11,6 +11,7 @@ pub async fn start() -> anyhow::Result<()> {
|
||||
let addr = "0.0.0.0:3000";
|
||||
let app = Router::new()
|
||||
.route("/", get(pages::home::get_page))
|
||||
+ .route("/login", get(pages::login::get_page))
|
||||
.nest_service(
|
||||
"/static",
|
||||
ServiceBuilder::new()
|
||||
diff --git a/src/web/pages/mod.rs b/src/web/pages/mod.rs
|
||||
index 0c1f8ad..d4fc7a0 100644
|
||||
--- a/src/web/pages/mod.rs
|
||||
+++ b/src/web/pages/mod.rs
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
+
|
||||
pub mod home;
|
||||
+pub mod login;
|
||||
pub mod error;
|
||||
|
||||
|
||||
diff --git a/templates/base.html b/templates/base.html
|
||||
index 6731e87..86574ca 100644
|
||||
--- a/templates/base.html
|
||||
+++ b/templates/base.html
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ self.title() }}</title>
|
||||
+ <link rel="stylesheet" href="/static/index.css">
|
||||
</head>
|
||||
<body>
|
||||
{% include "header.html" %}
|
||||
diff --git a/templates/header.html b/templates/header.html
|
||||
index c247db4..cf4fb71 100644
|
||||
--- a/templates/header.html
|
||||
+++ b/templates/header.html
|
||||
@@ -1,6 +1,25 @@
|
||||
<header>
|
||||
|
||||
|
||||
+ <ul class="nav">
|
||||
+ <li><a href="/">Home</a></li>
|
||||
+ <li><a href="/personnel">Personnel</a></li>
|
||||
+ <li><a href="/clients">Clients</a></li>
|
||||
+ <li><a href="/tickets">Tickets</a></li>
|
||||
+ <li><a href="/inventory">Inventory</a></li>
|
||||
+
|
||||
+ <!- not logged in>
|
||||
+ <!--
|
||||
+ <li class="right"><a href="/login">Sign in</a></li>
|
||||
+ !-->
|
||||
+
|
||||
+ <!- logged in>
|
||||
+ <li class="right">
|
||||
+ <img class="pfp" src="/static/usericon.png">
|
||||
+ <a>John Doe</a>
|
||||
+ </li>
|
||||
+
|
||||
+ </ul>
|
||||
|
||||
|
||||
</header>
|
||||
67
2026-01-12_16:55.patch
Normal file
67
2026-01-12_16:55.patch
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
diff --git a/src/web/mod.rs b/src/web/mod.rs
|
||||
index f919e6e..4f03aa9 100644
|
||||
--- a/src/web/mod.rs
|
||||
+++ b/src/web/mod.rs
|
||||
@@ -11,6 +11,7 @@ pub async fn start() -> anyhow::Result<()> {
|
||||
let addr = "0.0.0.0:3000";
|
||||
let app = Router::new()
|
||||
.route("/", get(pages::home::get_page))
|
||||
+ .route("/login", get(pages::login::get_page))
|
||||
.nest_service(
|
||||
"/static",
|
||||
ServiceBuilder::new()
|
||||
diff --git a/src/web/pages/mod.rs b/src/web/pages/mod.rs
|
||||
index 0c1f8ad..d4fc7a0 100644
|
||||
--- a/src/web/pages/mod.rs
|
||||
+++ b/src/web/pages/mod.rs
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
+
|
||||
pub mod home;
|
||||
+pub mod login;
|
||||
pub mod error;
|
||||
|
||||
|
||||
diff --git a/templates/base.html b/templates/base.html
|
||||
index 6731e87..86574ca 100644
|
||||
--- a/templates/base.html
|
||||
+++ b/templates/base.html
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ self.title() }}</title>
|
||||
+ <link rel="stylesheet" href="/static/index.css">
|
||||
</head>
|
||||
<body>
|
||||
{% include "header.html" %}
|
||||
diff --git a/templates/header.html b/templates/header.html
|
||||
index c247db4..cf4fb71 100644
|
||||
--- a/templates/header.html
|
||||
+++ b/templates/header.html
|
||||
@@ -1,6 +1,25 @@
|
||||
<header>
|
||||
|
||||
|
||||
+ <ul class="nav">
|
||||
+ <li><a href="/">Home</a></li>
|
||||
+ <li><a href="/personnel">Personnel</a></li>
|
||||
+ <li><a href="/clients">Clients</a></li>
|
||||
+ <li><a href="/tickets">Tickets</a></li>
|
||||
+ <li><a href="/inventory">Inventory</a></li>
|
||||
+
|
||||
+ <!- not logged in>
|
||||
+ <!--
|
||||
+ <li class="right"><a href="/login">Sign in</a></li>
|
||||
+ !-->
|
||||
+
|
||||
+ <!- logged in>
|
||||
+ <li class="right">
|
||||
+ <img class="pfp" src="/static/usericon.png">
|
||||
+ <a>John Doe</a>
|
||||
+ </li>
|
||||
+
|
||||
+ </ul>
|
||||
|
||||
|
||||
</header>
|
||||
|
|
@ -11,6 +11,7 @@ pub async fn start() -> anyhow::Result<()> {
|
|||
let addr = "0.0.0.0:3000";
|
||||
let app = Router::new()
|
||||
.route("/", get(pages::home::get_page))
|
||||
.route("/login", get(pages::login::get_page))
|
||||
.nest_service(
|
||||
"/static",
|
||||
ServiceBuilder::new()
|
||||
|
|
|
|||
48
src/web/pages/login.rs
Normal file
48
src/web/pages/login.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
use askama::Template;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
|
||||
use axum::{
|
||||
routing::{get, post},
|
||||
http::StatusCode,
|
||||
Json, Router,
|
||||
};
|
||||
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "login.html")]
|
||||
pub struct HomeTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
|
||||
}
|
||||
|
||||
impl BaseTemplate for HomeTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page() -> Response {
|
||||
fn inner() -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = HomeTemplate {
|
||||
ctx: Default::default()
|
||||
};
|
||||
|
||||
template.set_title("Login");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner() {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
|
||||
|
||||
pub mod home;
|
||||
pub mod login;
|
||||
pub mod error;
|
||||
|
||||
|
||||
|
|
|
|||
70
static/index.css
Normal file
70
static/index.css
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
body,html {
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
gap: 10px;
|
||||
background: gray;
|
||||
padding: 8px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.pfp {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
object-fit: cover;
|
||||
vertical-align: middle;
|
||||
margin-right: 5px;
|
||||
|
||||
}
|
||||
|
||||
.nav a {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background: gray;
|
||||
vertical-align: middle;
|
||||
|
||||
}
|
||||
|
||||
.nav a:hover {
|
||||
color: #FFFF88
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
padding-left: 10px;
|
||||
background: gray;
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
.login-form {
|
||||
|
||||
background: gray;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.login-form input[type="email"],input[type="password"] {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.login-form input[type="submit"] {
|
||||
width: 98%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
BIN
static/usericon.png
Normal file
BIN
static/usericon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ self.title() }}</title>
|
||||
<link rel="stylesheet" href="/static/index.css">
|
||||
</head>
|
||||
<body>
|
||||
{% include "header.html" %}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,25 @@
|
|||
<header>
|
||||
|
||||
|
||||
<ul class="nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/personnel">Personnel</a></li>
|
||||
<li><a href="/clients">Clients</a></li>
|
||||
<li><a href="/tickets">Tickets</a></li>
|
||||
<li><a href="/inventory">Inventory</a></li>
|
||||
|
||||
<!- not logged in>
|
||||
<!--
|
||||
<li class="right"><a href="/login">Sign in</a></li>
|
||||
!-->
|
||||
|
||||
<!- logged in>
|
||||
<li class="right">
|
||||
<img class="pfp" src="/static/usericon.png">
|
||||
<a>John Doe</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</header>
|
||||
|
|
|
|||
14
templates/login.html
Normal file
14
templates/login.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form class="login-form" action_url="/login" method="POST">
|
||||
<label for="email">Email: </label>
|
||||
<input name="email" type="email"></input>
|
||||
<br>
|
||||
<label for="password">Password: </label>
|
||||
<input name="password" type="password"></input>
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user