1
0
Fork 0

Add route "GET /reports"

This commit is contained in:
Alex Kotov 2020-10-22 09:39:19 +05:00
parent a74da2fb1b
commit 23952baf86
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 34 additions and 0 deletions

View file

@ -1,5 +1,6 @@
mod donate;
mod home;
mod reports;
mod sessions;
mod team;
mod users;
@ -8,6 +9,7 @@ pub fn routes() -> Vec<rocket::Route> {
routes![
donate::index,
home::index,
reports::index,
sessions::new,
sessions::create,
sessions::delete,

28
src/routes/reports.rs Normal file
View file

@ -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<I18n>,
_db_conn: database::DbConn,
csrf_token: CsrfToken,
current_user: states::MaybeCurrentUser,
) -> Result<Template, CommonResponse> {
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))
}

View file

@ -37,6 +37,10 @@
<a href="/donate" class="dropdown-item">
Donate
</a>
<a href="/reports" class="dropdown-item">
Reports
</a>
</div>
</li>
</ul>