aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-25 22:33:48 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-25 22:33:48 -0700
commit1b927231947233f36e71038684c7d5a6da5cceef (patch)
treeb88b2643fae9d0112bdc06f6b6852c7c31f9e673
parentec630361e25e765285a03931dfae49a478917538 (diff)
downloadmodelthing-1b927231947233f36e71038684c7d5a6da5cceef.tar.gz
modelthing-1b927231947233f36e71038684c7d5a6da5cceef.zip
have webface templates inherit
-rw-r--r--src/bin/modelthing-webface.rs1
-rw-r--r--webface/templates/base.html12
-rw-r--r--webface/templates/home.html12
-rw-r--r--webface/templates/model_view.html12
4 files changed, 19 insertions, 18 deletions
diff --git a/src/bin/modelthing-webface.rs b/src/bin/modelthing-webface.rs
index 0815117..5dc98f8 100644
--- a/src/bin/modelthing-webface.rs
+++ b/src/bin/modelthing-webface.rs
@@ -55,6 +55,7 @@ fn main() {
app.enable_static_file_handling();
debug!("root_path: {}", app.root_path);
+ app.register_template("base.html");
app.register_template("home.html");
app.get("/", "home", home);
app.get("/about/", "about", about);
diff --git a/webface/templates/base.html b/webface/templates/base.html
new file mode 100644
index 0000000..59060ed
--- /dev/null
+++ b/webface/templates/base.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>{{#block title}}modelthing{{/block}}</title>
+</head>
+
+<body>
+{{~#block content}}{{/block~}}
+</body>
+
+</html>
diff --git a/webface/templates/home.html b/webface/templates/home.html
index 4d351df..6068c99 100644
--- a/webface/templates/home.html
+++ b/webface/templates/home.html
@@ -1,12 +1,6 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>modelthing</title>
-</head>
+{{# partial content}}
-<body>
<a href="/about/">about</a>
-</body>
-</html>
+{{/partial}}
+{{> base.html}}
diff --git a/webface/templates/model_view.html b/webface/templates/model_view.html
index f3744a7..6e2b251 100644
--- a/webface/templates/model_view.html
+++ b/webface/templates/model_view.html
@@ -1,12 +1,6 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>modelthing</title>
-</head>
+{{# partial content}}
-<body>
{{model_id}}
-</body>
-</html>
+{{/partial}}
+{{~> base.html~}}