From 135616d37d1586d243017504777ce8b1bf361151 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Mon, 16 Jan 2017 16:56:47 -0800 Subject: only show compiled models conditionally --- src/bin/mt-webface.rs | 2 ++ webface/templates/model_view.html | 17 +++++++++++------ 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 @@ {{# if editable }} -edit - -{{/if }} + edit - +{{/if}} markdown - -original modelica - -scheme - -javascript - -latex +original modelica + +
display: + latex +{{# if computable }} +
compile: + scheme - + javascript +{{/if}}

{{ model_description }} -- cgit v1.2.3