Files
NP_CSM_Tool/app/templates/templates.html

109 lines
2.3 KiB
HTML

<!DOCTYPE html>
{% include 'head.html' %}
{% include 'header.html' %}
{% include 'logo.html' %}
<p>&nbsp;</p>
{% if error %}
<h3>{{ error }}</h4>
{% endif %}
{% if templates %}
<h2> Here are the liquid templates for </h2>
<h2 style="color:#F05323"><strong> {{ session.school }} </strong></h2>
{% endif %}
<div class="templates_display" >
{% for templates in templates %}
<p>&nbsp;</p>
<div class="window-body">
<form
id="templates"
action="{{ url_for('templates')}}"
method="post">
<h2>
{{ templates[0] }}
</h2>
<code-input
lang="HTML"
value="{{ templates[1] }}"
id="editor"
name="body"
template="code-input">
{{ templates[1] }}
</code-input>
<textarea
name="loaded-content"
id="loaded-content"
style="width:100%;"></textarea>
<label for="template_name">
Create New Template Name (optional):
</label>
<input
type="text"
name="template_name"
value="{{ templates[0] }}">
</input>
<p>&nbsp;</p>
<div
name="load-template"
value="Load Changes"
onclick="copyToTextArea()"
style="cursor:pointer"
>Click here to load changes</div>
<input
type="submit"
name="submit-template"
value="Submit Template">
</input>
</form>
</div>
</div>
<p>&nbsp;</p>
{% endfor %}
<!--
<h3> Advanced users only: create new template </h3>
<p>&nbsp;</p>
<div class="html_code">
<form
id="templates"
action="{{ url_for('templates')}}"
method="post">
<h2>
Enter the code below
</h2>
<textarea
id="body"
name="body"
rows="35"
cols="100">
</textarea>
<p>&nbsp;</p>
<label for="template_name">
Template Name:
</label>
<input
type="text"
name="template_name">
</input>
<p>&nbsp;</p>
<input type="submit" name="submit_template" value="Submit Template"</input>
</form>
</div> -->
<script>
codeInput.registerTemplate("code-input", codeInput.templates.hljs(hljs,
[
]));
</script>
<script>
codeInput.registerTemplate("code-input", codeInput.templates.prism(Prism, []));
</script>
<script>
function copyToTextArea() {
var code = document.getElementById("editor").value;
let textarea = document.getElementById("loaded-content");
textarea.textContent = code;
console.log(code);
}
</script>