1
0
Fork 0

Add route "GET /donate"

This commit is contained in:
Alex Kotov 2020-10-21 11:44:40 +05:00
parent 134f7a69b7
commit 22b73ff226
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 34 additions and 0 deletions

View File

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

28
src/routes/donate.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("/donate")]
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: "donate/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

@ -33,6 +33,10 @@
<a href="/team" class="dropdown-item">
Out team
</a>
<a href="/donate" class="dropdown-item">
Donate
</a>
</div>
</li>
</ul>