aboutsummaryrefslogtreecommitdiffstats
path: root/webface
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-11 18:26:04 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-11 18:26:37 -0800
commitecc4f3ef8a23e3d4143954fdccc5a28a83f9039f (patch)
tree0d835d82c53e04064b694adbe26e34ef4af86315 /webface
parent640a433fa8be6c0269db148e08ccf2bfe03957ca (diff)
downloadmodelthing-ecc4f3ef8a23e3d4143954fdccc5a28a83f9039f.tar.gz
modelthing-ecc4f3ef8a23e3d4143954fdccc5a28a83f9039f.zip
basic sandbox wiki editing and creation
Diffstat (limited to 'webface')
-rw-r--r--webface/templates/base.html5
-rw-r--r--webface/templates/model_create.html23
-rw-r--r--webface/templates/model_edit.html27
-rw-r--r--webface/templates/model_list.html8
-rw-r--r--webface/templates/model_view.html8
5 files changed, 67 insertions, 4 deletions
diff --git a/webface/templates/base.html b/webface/templates/base.html
index 66a0cca..65dafa3 100644
--- a/webface/templates/base.html
+++ b/webface/templates/base.html
@@ -16,8 +16,9 @@ body { font-family: monospace; font-size: larger; line-height: 1.3; }
<br><br>
<center style="font-size: 0.9em;">
-<a href="/m/examples/">examples index</a> -
-<a href="/readme/">full readme</a> -
+<a href="/m/examples/">examples</a> -
+<a href="/m/sandbox/">sandbox</a> -
+<a href="/readme/">readme</a> -
<a href="https://git.bnewbold.net/modelthing">source code</a>
</center>
<br>
diff --git a/webface/templates/model_create.html b/webface/templates/model_create.html
new file mode 100644
index 0000000..0c7faa7
--- /dev/null
+++ b/webface/templates/model_create.html
@@ -0,0 +1,23 @@
+{{# partial content}}
+<h1>Create New Model</h1>
+
+Model will be created with a dummy template modelica model and markdown wiki
+page, which you can then edit.
+
+<br>
+
+<form action="/create/" method="POST">
+
+<table>
+<tr><td><b>Namespace: </b>
+ <td><input type="text" name="namespace" value="sandbox" readonly>
+<tr><td><b>Name ("Slug"): </b>
+ <td><input type="text" name="model_slug" value=""> <i>(alphanumeric with underscores)</i>
+</table>
+<br>
+<input type="submit" value="Create!"></input>
+
+</form>
+
+{{/partial}}
+{{~> base.html~}}
diff --git a/webface/templates/model_edit.html b/webface/templates/model_edit.html
new file mode 100644
index 0000000..38aef60
--- /dev/null
+++ b/webface/templates/model_edit.html
@@ -0,0 +1,27 @@
+{{# partial content}}
+<h1 style="margin-bottom: 0.1em;">
+ <a href="/m/{{namespace}}/" style="color: black; text-decoration: none;">
+ {{ namespace }}</a>/{{ model_name }}
+</h1>
+
+<form action="/m/{{namespace}}/{{model_slug}}/edit/" method="POST">
+
+<h3>Modelica Code</h3>
+The computable model must conform to a subset of the Modelica language.
+
+<p><b>WARNING:</b> you won't get errors or help if your code is wrong,
+just a 500 error.
+
+<br><br>
+<textarea name="modelica" style="width:50em; height:19em;">{{ modelica }}</textarea>
+
+<h3>Markdown</h3>
+<textarea name="markdown" style="width:50em; height:19em;">{{ markdown }}</textarea>
+
+<br><br>
+<input type="submit" value="Submit!"></input>
+
+</form>
+
+{{/partial}}
+{{~> base.html~}}
diff --git a/webface/templates/model_list.html b/webface/templates/model_list.html
index 4c80315..ad4f4f4 100644
--- a/webface/templates/model_list.html
+++ b/webface/templates/model_list.html
@@ -1,11 +1,17 @@
{{# partial content}}
-<h1>Models</h1>
+{{#each namespace }}
+<h1>Models: {{ this[0] }}</h1>
+{{/each}}
+{{# if model_slug_list }}
<ul>
{{#each model_slug_list }}
<li><a href="/m/{{ this[0] }}/{{ this[1] }}/">{{ this[1] }}</a>
{{/each}}
</ul>
+{{else}}
+None Yet!
+{{/if}}
{{/partial}}
{{~> base.html~}}
diff --git a/webface/templates/model_view.html b/webface/templates/model_view.html
index 5d307c7..6062f33 100644
--- a/webface/templates/model_view.html
+++ b/webface/templates/model_view.html
@@ -1,7 +1,13 @@
{{# partial content}}
-<h1 style="margin-bottom: 0.1em;">{{ model_name }}</h1>
+<h1 style="margin-bottom: 0.1em;">
+ <a href="/m/{{namespace}}/" style="color: black; text-decoration: none;">
+ {{ namespace }}</a>/{{ model_name }}
+</h1>
<span style="font-size: 0.9em;">
+{{# if editable }}
<a href="edit/">edit</a> -
+{{/if }}
+<a href="markdown/">markdown</a> -
<a href="raw/">modelica</a> -
<a href="repr/?format=scheme">scheme</a> -
<a href="repr/?format=javascript">javascript</a> -