From 23952baf86dc90c561839d6cde14eba2ada52a21 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 22 Oct 2020 09:39:19 +0500 Subject: [PATCH] Add route "GET /reports" --- src/routes.rs | 2 ++ src/routes/reports.rs | 28 ++++++++++++++++++++++++++++ templates/navbar.html.hbs | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 src/routes/reports.rs diff --git a/src/routes.rs b/src/routes.rs index fd4b55e..42342e3 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -1,5 +1,6 @@ mod donate; mod home; +mod reports; mod sessions; mod team; mod users; @@ -8,6 +9,7 @@ pub fn routes() -> Vec { routes![ donate::index, home::index, + reports::index, sessions::new, sessions::create, sessions::delete, diff --git a/src/routes/reports.rs b/src/routes/reports.rs new file mode 100644 index 0000000..0f1c517 --- /dev/null +++ b/src/routes/reports.rs @@ -0,0 +1,28 @@ +use crate::database; +// use crate::models; +use crate::states; +use crate::views; + +use crate::i18n::I18n; +use crate::responses::CommonResponse; + +use rocket::State; +use rocket_contrib::templates::Template; +use rocket_csrf::CsrfToken; + +#[get("/reports")] +pub fn index( + _i18n: State, + _db_conn: database::DbConn, + csrf_token: CsrfToken, + current_user: states::MaybeCurrentUser, +) -> Result { + let context = views::Site { + page: "reports/index".to_string(), + page_context: (), + authenticity_token: csrf_token.authenticity_token().to_string(), + current_user: current_user.0, + }; + + Ok(Template::render("site", &context)) +} diff --git a/templates/navbar.html.hbs b/templates/navbar.html.hbs index 2cc4f77..d6691df 100644 --- a/templates/navbar.html.hbs +++ b/templates/navbar.html.hbs @@ -37,6 +37,10 @@ Donate + + + Reports +