Add actual templates for everything

This commit is contained in:
Bat
2018-05-09 20:09:52 +01:00
parent ae60d5961c
commit 292f4d6b27
12 changed files with 77 additions and 12 deletions
+7 -3
View File
@@ -8,13 +8,17 @@ use db_conn::DbConn;
use models::instance::*;
#[get("/")]
fn index(conn: DbConn) -> String {
fn index(conn: DbConn) -> Template {
match Instance::get_local(&*conn) {
Some(inst) => {
format!("Welcome on {}", inst.name)
Template::render("instance/index", json!({
"instance": inst
}))
}
None => {
String::from("Not initialized")
Template::render("errors/500", json!({
"error_message": "You need to configure your instance before using it."
}))
}
}
}