diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-10-28 00:07:12 -0700 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-10-28 00:07:12 -0700 |
commit | 360a3f82c02fdbe2c2d317e01f01fc69adbf4ab5 (patch) | |
tree | 6d87639cef6b31ec069d259d9a119e14e7f241a7 /src/bin | |
parent | adf41d8d3dcbc21806475bc652d560c7483fbcfb (diff) | |
download | modelthing-360a3f82c02fdbe2c2d317e01f01fc69adbf4ab5.tar.gz modelthing-360a3f82c02fdbe2c2d317e01f01fc69adbf4ab5.zip |
webface front page
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/modelthing-webface.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bin/modelthing-webface.rs b/src/bin/modelthing-webface.rs index 5dc98f8..0940ea0 100644 --- a/src/bin/modelthing-webface.rs +++ b/src/bin/modelthing-webface.rs @@ -13,10 +13,11 @@ fn home(r: &mut Request) -> PencilResult { return r.app.render_template("home.html", &context); } -fn about(_: &mut Request) -> PencilResult { - let mut response = Response::from(include_str!("../../README.txt")); - response.set_content_type("text/plain"); - Ok(response) +fn readme(r: &mut Request) -> PencilResult { + let mut context = BTreeMap::new(); + let raw_text = include_str!("../../README.txt"); + context.insert("raw_text".to_string(), raw_text.to_string()); + return r.app.render_template("raw.html", &context); } fn model_list(_: &mut Request) -> PencilResult { @@ -57,8 +58,9 @@ fn main() { app.register_template("base.html"); app.register_template("home.html"); + app.register_template("raw.html"); app.get("/", "home", home); - app.get("/about/", "about", about); + app.get("/readme/", "readme", readme); app.get("/model_list/", "model_list", model_list); app.register_template("model_view.html"); app.get("/model/<model_id:string>", "model", model_view); |