aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-16 16:56:47 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-16 16:56:47 -0800
commit135616d37d1586d243017504777ce8b1bf361151 (patch)
tree60a39b7079d775c1d603355ed2d114dbe2fd4876
parent6c9ec4f093ecfa48fe3a4a3fa99de16c5676d7dc (diff)
downloadmodelthing-135616d37d1586d243017504777ce8b1bf361151.tar.gz
modelthing-135616d37d1586d243017504777ce8b1bf361151.zip
only show compiled models conditionally
-rw-r--r--src/bin/mt-webface.rs2
-rw-r--r--webface/templates/model_view.html17
2 files changed, 13 insertions, 6 deletions
diff --git a/src/bin/mt-webface.rs b/src/bin/mt-webface.rs
index b9e3cad..b26e4fe 100644
--- a/src/bin/mt-webface.rs
+++ b/src/bin/mt-webface.rs
@@ -88,6 +88,8 @@ fn model_view(r: &mut Request) -> PencilResult {
context.insert("latex".to_string(), me.ast.repr_latex().unwrap());
context.insert("editable".to_string(),
if namespace == "sandbox" { "true".to_string() } else { "".to_string() });
+ context.insert("computable".to_string(),
+ if me.ast.transpile_scheme().is_ok() { "true".to_string() } else { "".to_string() });
r.app.render_template("model_view.html", &context)
},
Err(_) => Err(PencilError::PenHTTPError(pencil::HTTPError::NotFound)),
diff --git a/webface/templates/model_view.html b/webface/templates/model_view.html
index 30856ce..14ed5ef 100644
--- a/webface/templates/model_view.html
+++ b/webface/templates/model_view.html
@@ -23,13 +23,18 @@
</h1>
<span style="font-size: 0.9em;">
{{# if editable }}
-<a href="edit/">edit</a> -
-{{/if }}
+ <a href="edit/">edit</a> -
+{{/if}}
<a href="markdown/">markdown</a> -
-<a href="raw/">original modelica</a> -
-<a href="repr/?format=scheme">scheme</a> -
-<a href="repr/?format=javascript">javascript</a> -
-<a href="repr/?format=latex">latex</a>
+<a href="raw/">original modelica</a>
+
+<br><b>display:</b>
+ <a href="repr/?format=latex">latex</a>
+{{# if computable }}
+<br><b>compile:</b>
+ <a href="repr/?format=scheme">scheme</a> -
+ <a href="repr/?format=javascript">javascript</a>
+{{/if}}
</span>
<p><i style="color: #222222;">{{ model_description }}</i>