Compare commits
No commits in common. "c3965c9528716c0f7cda6ca7bd7ae55416937f24" and "18cdb209239064078c5e9efac5de6320890b311a" have entirely different histories.
c3965c9528
...
18cdb20923
@ -19,7 +19,6 @@ use tera::Context;
|
|||||||
|
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
role::Role,
|
|
||||||
user::{User, UserWithRoles},
|
user::{User, UserWithRoles},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,27 +53,6 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
|
|||||||
Template::render("index", context.into_json())
|
Template::render("index", context.into_json())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/steering")]
|
|
||||||
async fn steering(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_>>) -> Template {
|
|
||||||
let mut context = Context::new();
|
|
||||||
if let Some(msg) = flash {
|
|
||||||
context.insert("flash", &msg.into_inner());
|
|
||||||
}
|
|
||||||
|
|
||||||
let bootskundige =
|
|
||||||
User::all_with_role(db, &Role::find_by_name(db, "Bootsführer").await.unwrap()).await;
|
|
||||||
|
|
||||||
let mut coxes = User::all_with_role(db, &Role::find_by_name(db, "cox").await.unwrap()).await;
|
|
||||||
|
|
||||||
coxes.retain(|user| !bootskundige.contains(&user)); // Remove bootskundige from coxes list
|
|
||||||
|
|
||||||
context.insert("coxes", &coxes);
|
|
||||||
context.insert("bootskundige", &bootskundige);
|
|
||||||
|
|
||||||
context.insert("loggedin_user", &UserWithRoles::from_user(user, db).await);
|
|
||||||
Template::render("steering", context.into_json())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/", data = "<login>")]
|
#[post("/", data = "<login>")]
|
||||||
async fn wikiauth(db: &State<SqlitePool>, login: Form<LoginForm<'_>>) -> String {
|
async fn wikiauth(db: &State<SqlitePool>, login: Form<LoginForm<'_>>) -> String {
|
||||||
match User::login(db, login.name, login.password).await {
|
match User::login(db, login.name, login.password).await {
|
||||||
@ -108,7 +86,7 @@ pub struct Config {
|
|||||||
|
|
||||||
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
|
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
|
||||||
rocket
|
rocket
|
||||||
.mount("/", routes![index, steering])
|
.mount("/", routes![index])
|
||||||
.mount("/auth", auth::routes())
|
.mount("/auth", auth::routes())
|
||||||
.mount("/wikiauth", routes![wikiauth])
|
.mount("/wikiauth", routes![wikiauth])
|
||||||
.mount("/log", log::routes())
|
.mount("/log", log::routes())
|
||||||
|
@ -81,9 +81,6 @@
|
|||||||
<a href="/boatreservation"
|
<a href="/boatreservation"
|
||||||
class="block w-100 py-2 hover:text-primary-600">Bootsreservierung</a>
|
class="block w-100 py-2 hover:text-primary-600">Bootsreservierung</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="py-1">
|
|
||||||
<a href="/steering" class="block w-100 py-2 hover:text-primary-600">Steuerleute & Co</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
{% import "includes/macros" as macros %}
|
|
||||||
{% extends "base" %}
|
|
||||||
{% block content %}
|
|
||||||
<div class="max-w-screen-lg w-full">
|
|
||||||
<h1 class="h1">Steuerleute + Personen mit Steuerberechtigung</h1>
|
|
||||||
<div class="border-r border-l border-gray-200 dark:border-primary-600">
|
|
||||||
<div class="border-t border-gray-200 dark:border-primary-600 bg-white dark:bg-primary-900 text-black dark:text-white flex justify-between items-center px-3 py-1">
|
|
||||||
<ul>
|
|
||||||
{% for cox in coxes | sort(attribute='name') %}<li>{{ cox.name }}</li>{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h1 class="h1">Bootskundige</h1>
|
|
||||||
<div class="border-r border-l border-gray-200 dark:border-primary-600">
|
|
||||||
<div class="border-t border-gray-200 dark:border-primary-600 bg-white dark:bg-primary-900 text-black dark:text-white flex justify-between items-center px-3 py-1">
|
|
||||||
<ul>
|
|
||||||
{% for cox in bootskundige | sort(attribute='name') %}<li>{{ cox.name }}</li>{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
|
Loading…
Reference in New Issue
Block a user