forked from Ruderverein-Donau-Linz/rowt
Merge branch 'ergo-styling' into 'staging'
Ergo styling See merge request PhilippHofer/rot!77
This commit is contained in:
commit
555882b4c7
@ -67,11 +67,7 @@ async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
async fn index(
|
||||
db: &State<SqlitePool>,
|
||||
user: NonGuestUser,
|
||||
flash: Option<FlashMessage<'_>>,
|
||||
) -> Template {
|
||||
async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_>>) -> Template {
|
||||
let users = User::ergo(db).await;
|
||||
|
||||
let thirty = sqlx::query_as!(
|
||||
@ -94,7 +90,7 @@ async fn index(
|
||||
if let Some(msg) = flash {
|
||||
context.insert("flash", &msg.into_inner());
|
||||
}
|
||||
context.insert("loggedin_user", &user.user);
|
||||
context.insert("loggedin_user", &user);
|
||||
context.insert("users", &users);
|
||||
context.insert("thirty", &thirty);
|
||||
context.insert("dozen", &dozen);
|
||||
@ -113,7 +109,7 @@ pub struct ErgoToAdd<'a> {
|
||||
async fn new_thirty(
|
||||
db: &State<SqlitePool>,
|
||||
mut data: Form<ErgoToAdd<'_>>,
|
||||
created_by: NonGuestUser,
|
||||
created_by: User,
|
||||
) -> Flash<Redirect> {
|
||||
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
||||
|
||||
@ -139,10 +135,7 @@ async fn new_thirty(
|
||||
|
||||
Log::create(
|
||||
db,
|
||||
format!(
|
||||
"{} created thirty-ergo entry: {data:?}",
|
||||
created_by.user.name
|
||||
),
|
||||
format!("{} created thirty-ergo entry: {data:?}", created_by.name),
|
||||
)
|
||||
.await;
|
||||
|
||||
@ -153,7 +146,7 @@ async fn new_thirty(
|
||||
async fn new_dozen(
|
||||
db: &State<SqlitePool>,
|
||||
mut data: Form<ErgoToAdd<'_>>,
|
||||
created_by: NonGuestUser,
|
||||
created_by: User,
|
||||
) -> Flash<Redirect> {
|
||||
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
||||
|
||||
@ -179,10 +172,7 @@ async fn new_dozen(
|
||||
|
||||
Log::create(
|
||||
db,
|
||||
format!(
|
||||
"{} created dozen-ergo entry: {data:?}",
|
||||
created_by.user.name
|
||||
),
|
||||
format!("{} created dozen-ergo entry: {data:?}", created_by.name),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
@ -19,6 +19,29 @@
|
||||
{% include "includes/question-icon" %}
|
||||
<span class="sr-only">FAQs</span>
|
||||
</a>
|
||||
{% if loggedin_user.is_guest and loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
|
||||
<a
|
||||
href="#"
|
||||
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
||||
data-sidebar="true"
|
||||
data-trigger="sidebar"
|
||||
data-header="Ergo Challenge"
|
||||
data-body="#mobile-menu-guest"
|
||||
>
|
||||
{% include "includes/book" %}
|
||||
<span class="sr-only">Ergo</span>
|
||||
</a>
|
||||
<div class="hidden">
|
||||
<div id="mobile-menu-guest">
|
||||
<a
|
||||
href="/ergo"
|
||||
class="block w-100 py-2 hover:text-primary-600 border-t"
|
||||
>
|
||||
Ergo
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not loggedin_user.is_guest %}
|
||||
<a
|
||||
href="#"
|
||||
@ -78,7 +101,8 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %} {% if loggedin_user.is_admin %}
|
||||
{% endif %}
|
||||
{% if loggedin_user.is_admin %}
|
||||
<a
|
||||
href="/admin/user"
|
||||
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
||||
|
Loading…
x
Reference in New Issue
Block a user