Add route "GET /reports"
This commit is contained in:
parent
a74da2fb1b
commit
23952baf86
3 changed files with 34 additions and 0 deletions
|
@ -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
28
src/routes/reports.rs
Normal 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))
|
||||
}
|
|
@ -37,6 +37,10 @@
|
|||
<a href="/donate" class="dropdown-item">
|
||||
Donate
|
||||
</a>
|
||||
|
||||
<a href="/reports" class="dropdown-item">
|
||||
Reports
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Reference in a new issue