forked from Ruderverein-Donau-Linz/rowt
		
	add logbook history
This commit is contained in:
		@@ -9,7 +9,7 @@ use rocket::{
 | 
			
		||||
    time::{Duration, OffsetDateTime},
 | 
			
		||||
    Request, Route, State,
 | 
			
		||||
};
 | 
			
		||||
use rocket_dyn_templates::Template;
 | 
			
		||||
use rocket_dyn_templates::{context, Template};
 | 
			
		||||
use sqlx::SqlitePool;
 | 
			
		||||
use tera::Context;
 | 
			
		||||
 | 
			
		||||
@@ -64,6 +64,20 @@ async fn index(
 | 
			
		||||
    Template::render("log", context.into_json())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[get("/show", rank = 2)]
 | 
			
		||||
async fn show(db: &State<SqlitePool>, user: User) -> Template {
 | 
			
		||||
    let logs = Logbook::completed(db).await;
 | 
			
		||||
 | 
			
		||||
    Template::render("log.completed", context!(logs, loggedin_user: &user))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[get("/show")]
 | 
			
		||||
async fn show_kiosk(db: &State<SqlitePool>, _kios: KioskCookie) -> Template {
 | 
			
		||||
    let logs = Logbook::completed(db).await;
 | 
			
		||||
 | 
			
		||||
    Template::render("log.completed", context!(logs))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[get("/kiosk/ekrv2019")]
 | 
			
		||||
fn new_kiosk(cookies: &CookieJar<'_>) -> Redirect {
 | 
			
		||||
    let mut cookie = Cookie::new("kiosk", "yes".to_string());
 | 
			
		||||
@@ -198,7 +212,9 @@ pub fn routes() -> Vec<Route> {
 | 
			
		||||
        home,
 | 
			
		||||
        kiosk,
 | 
			
		||||
        home_kiosk,
 | 
			
		||||
        new_kiosk
 | 
			
		||||
        new_kiosk,
 | 
			
		||||
        show,
 | 
			
		||||
        show_kiosk
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,10 @@
 | 
			
		||||
	  	STATS 
 | 
			
		||||
              <span class="sr-only">Logbuch</span>
 | 
			
		||||
            </a>
 | 
			
		||||
            <a href="/log/show" 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">
 | 
			
		||||
	  	LGBUCH HISTORY
 | 
			
		||||
              <span class="sr-only">Logbuch History</span>
 | 
			
		||||
            </a>
 | 
			
		||||
            <a href="/log" 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">
 | 
			
		||||
	   LOGBUCH 
 | 
			
		||||
              <span class="sr-only">Logbuch</span>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								templates/log.completed.html.tera
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								templates/log.completed.html.tera
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
{% import "includes/macros" as macros %}
 | 
			
		||||
{% import "includes/forms/log" as log %}
 | 
			
		||||
 | 
			
		||||
{% extends "base" %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
 | 
			
		||||
<div class="max-w-screen-lg w-full">
 | 
			
		||||
  <h1 class="h1">Logbuch</h1>
 | 
			
		||||
  {% for log in logs %}
 | 
			
		||||
    {{ log::show(log=log, state="completed", only_ones=false) }}
 | 
			
		||||
    <hr />
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
{% endblock content%}
 | 
			
		||||
@@ -22,12 +22,6 @@
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    <hr />
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
 | 
			
		||||
  <h2 style="font-size: 100px">Einträge</h2>
 | 
			
		||||
  {% for log in completed %}
 | 
			
		||||
    {{ log::show(log=log, state="completed", only_ones=false) }}
 | 
			
		||||
    <hr />
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
{% endblock content%}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user