forked from Ruderverein-Donau-Linz/rowt
show notification badge in menu
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use crate::model::{
|
||||
boat::{Boat, BoatToAdd, BoatToUpdate},
|
||||
location::Location,
|
||||
user::{AdminUser, User, UserWithRoles},
|
||||
user::{AdminUser, User, UserWithRolesAndNotificationCount},
|
||||
};
|
||||
use rocket::{
|
||||
form::Form,
|
||||
@ -32,7 +32,7 @@ async fn index(
|
||||
context.insert("users", &users);
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(admin.user, db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(admin.user, db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/boat/index", context.into_json())
|
||||
|
@ -10,7 +10,7 @@ use crate::model::log::Log;
|
||||
use crate::model::mail::Mail;
|
||||
use crate::model::role::Role;
|
||||
use crate::model::user::AdminUser;
|
||||
use crate::model::user::UserWithRoles;
|
||||
use crate::model::user::UserWithRolesAndNotificationCount;
|
||||
use crate::tera::Config;
|
||||
|
||||
#[get("/mail")]
|
||||
@ -27,7 +27,7 @@ async fn index(
|
||||
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(admin.user, db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(admin.user, db).await,
|
||||
);
|
||||
context.insert("roles", &roles);
|
||||
|
||||
|
@ -2,7 +2,7 @@ use crate::model::{
|
||||
log::Log,
|
||||
notification::Notification,
|
||||
role::Role,
|
||||
user::{AdminUser, User, UserWithRoles},
|
||||
user::{AdminUser, User, UserWithRolesAndNotificationCount},
|
||||
};
|
||||
use rocket::{
|
||||
form::Form,
|
||||
@ -26,7 +26,7 @@ async fn index(
|
||||
}
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(user.user, db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(user.user, db).await,
|
||||
);
|
||||
context.insert("roles", &Role::all(db).await);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::model::{
|
||||
role::Role,
|
||||
user::{SchnupperBetreuerUser, User, UserWithRoles},
|
||||
user::{SchnupperBetreuerUser, User, UserWithRolesAndNotificationCount},
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use rocket::{
|
||||
@ -38,9 +38,9 @@ async fn index(
|
||||
let user_futures: Vec<_> = User::all_with_role(db, &schnupperant)
|
||||
.await
|
||||
.into_iter()
|
||||
.map(|u| async move { UserWithRoles::from_user(u, db).await })
|
||||
.map(|u| async move { UserWithRolesAndNotificationCount::from_user(u, db).await })
|
||||
.collect();
|
||||
let users: Vec<UserWithRoles> = join_all(user_futures).await;
|
||||
let users: Vec<UserWithRolesAndNotificationCount> = join_all(user_futures).await;
|
||||
|
||||
let mut context = Context::new();
|
||||
if let Some(msg) = flash {
|
||||
@ -49,7 +49,7 @@ async fn index(
|
||||
context.insert("schnupperanten", &users);
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(user.into(), db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(user.into(), db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/schnupper/index", context.into_json())
|
||||
|
@ -6,8 +6,8 @@ use crate::model::{
|
||||
logbook::Logbook,
|
||||
role::Role,
|
||||
user::{
|
||||
AdminUser, User, UserWithMembershipPdf, UserWithRoles, UserWithRolesAndMembershipPdf,
|
||||
VorstandUser,
|
||||
AdminUser, User, UserWithMembershipPdf, UserWithRolesAndMembershipPdf,
|
||||
UserWithRolesAndNotificationCount, VorstandUser,
|
||||
},
|
||||
};
|
||||
use futures::future::join_all;
|
||||
@ -67,7 +67,10 @@ async fn index(
|
||||
context.insert("users", &users);
|
||||
context.insert("roles", &roles);
|
||||
context.insert("families", &families);
|
||||
context.insert("loggedin_user", &UserWithRoles::from_user(user, db).await);
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRolesAndNotificationCount::from_user(user, db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/user/index", context.into_json())
|
||||
}
|
||||
@ -99,7 +102,10 @@ async fn index_admin(
|
||||
context.insert("users", &users);
|
||||
context.insert("roles", &roles);
|
||||
context.insert("families", &families);
|
||||
context.insert("loggedin_user", &UserWithRoles::from_user(user, db).await);
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRolesAndNotificationCount::from_user(user, db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/user/index", context.into_json())
|
||||
}
|
||||
@ -127,7 +133,7 @@ async fn fees(
|
||||
}
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(admin.into(), db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(admin.into(), db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/user/fees", context.into_json())
|
||||
@ -147,7 +153,7 @@ async fn scheckbuch(
|
||||
for s in scheckbooks {
|
||||
scheckbooks_with_roles.push((
|
||||
Logbook::completed_with_user(db, &s).await,
|
||||
UserWithRoles::from_user(s, db).await,
|
||||
UserWithRolesAndNotificationCount::from_user(s, db).await,
|
||||
))
|
||||
}
|
||||
|
||||
@ -158,7 +164,7 @@ async fn scheckbuch(
|
||||
}
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(user.into(), db).await,
|
||||
&UserWithRolesAndNotificationCount::from_user(user.into(), db).await,
|
||||
);
|
||||
|
||||
Template::render("admin/user/scheckbuch", context.into_json())
|
||||
|
Reference in New Issue
Block a user