aboutsummaryrefslogtreecommitdiffstats
path: root/webface/templates/model_edit.html
blob: 4ca5d365c29d3f3357adca5ac545c5daed6fb51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{{# partial head}}
<script src="/static/ace-1.2.6/ace.js" type="text/javascript" charset="utf-8"></script>

<script>
  document.addEventListener("DOMContentLoaded", function() {
    var modelica_editor = ace.edit('modelica_editor');
    var modelica_textarea = document.getElementById("modelica_textarea");
    modelica_editor.setTheme("ace/theme/twilight");
    modelica_editor.setShowPrintMargin(false);
    modelica_editor.session.setValue(modelica_textarea.value);
    modelica_editor.session.on("change", function () {
        modelica_textarea.value = modelica_editor.getValue();
    });

    var markdown_editor = ace.edit('markdown_editor');
    var markdown_textarea = document.getElementById("markdown_textarea");
    markdown_editor.setTheme("ace/theme/twilight");
    markdown_editor.setShowPrintMargin(false);
    markdown_editor.session.setMode("ace/mode/markdown");
    markdown_editor.setValue(markdown_textarea.value);
    markdown_editor.session.on("change", function () {
        markdown_textarea.value = markdown_editor.getValue();
    });
  });
</script>
{{/partial}}

{{# 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>
<div id="modelica_editor" style="width:100%; height:24em;"></div>
<textarea name="modelica" id="modelica_textarea" style="display: none;">{{ modelica }}</textarea>

<h3>Markdown</h3>
<div id="markdown_editor" style="width:100%; height:24em;"></div>
<textarea name="markdown" id="markdown_textarea" style="display: none;">{{ markdown }}</textarea>

<br><br>
<input type="submit" value="Submit!"></input>

</form>

{{/partial}}
{{~> base.html~}}