aboutsummaryrefslogtreecommitdiffstats
path: root/src/controllers/users_controller.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-08-01 13:38:35 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-08-01 13:38:35 +0200
commit3ef15d64c60d943b64d998449ed0eaa1dee0ac3e (patch)
treea5446f8020e10fc1b0b9662dec04303dd2cdf74d /src/controllers/users_controller.rs
parentd285d0525f86160a61067942346fb40f2bc5c797 (diff)
downloadrocket-blog-3ef15d64c60d943b64d998449ed0eaa1dee0ac3e.tar.gz
rocket-blog-3ef15d64c60d943b64d998449ed0eaa1dee0ac3e.tar.bz2
rocket-blog-3ef15d64c60d943b64d998449ed0eaa1dee0ac3e.zip
Fix display of flash messages.
Pass full flash to template, and style according to flash name/type.
Diffstat (limited to 'src/controllers/users_controller.rs')
-rw-r--r--src/controllers/users_controller.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/controllers/users_controller.rs b/src/controllers/users_controller.rs
index a3281de..91cfc5c 100644
--- a/src/controllers/users_controller.rs
+++ b/src/controllers/users_controller.rs
@@ -15,7 +15,7 @@ implement_responder_for!(UsersTemplate);
fn index(flash: Option<rocket::request::FlashMessage>, conn: utils::DbConn) -> utils::Page<UsersTemplate> {
utils::Page {
title: String::from("Users"),
- flash: flash.map_or(None, |f| Some(f.msg().to_string())),
+ flash: flash,
content: UsersTemplate {
users: ::models::User::all(conn).unwrap()
}
@@ -67,7 +67,7 @@ implement_responder_for!(NewUserTemplate);
fn new(flash: Option<rocket::request::FlashMessage>) -> utils::Page<NewUserTemplate> {
utils::Page {
title: String::from("New user"),
- flash: flash.map_or(None, |f| Some(f.msg().to_string())),
+ flash: flash,
content: NewUserTemplate {
user: Default::default()
}