forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize-adventure.html
93 lines (92 loc) · 6.66 KB
/
customize-adventure.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{% extends "auth.html" %}
{% block main %}
<div class="flex flex-col gap-2">
<h2>{{_('customize_adventure')}}: {{adventure.name}}</h2>
<div class="border-gray-400 border rounded-lg p-4">
<form onsubmit="event.preventDefault (); hedyApp.update_adventure('{{ adventure.id }}', {% if adventure.content|length > 0 %}false{% else %}true{% endif %}, '{{_('update_adventure_prompt')}}')">
<div class="flex flex-col lg:flex-row gap-4">
<div class="flex flex-col w-full lg:w-1/2">
<h3 class="text-center mt-0 mb-4">{{_('general_settings')}}</h3>
<div class="flex flex-row items-center mb-4">
<label for="name" class="inline-block w-40 text-xl">{{_('name')}}</label>
<input id="custom_adventure_name" required value="{{ adventure.name }}" class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 ltr:pr-8 rtl:pl-8 rounded">
</div>
<div class="flex flex-row items-center mb-4">
<label for="level" class="inline-block w-40 text-xl">{{_('level')}}</label>
<select id="custom_adventure_level" required class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 ltr:pr-8 rtl:pl-8 rounded">
<option disabled selected value="">{{_('level')}}</option>
{% for i in range(1, (max_level + 1)) %}
<option value="{{ i }}" {% if i|string == adventure.level or i == adventure.level %}selected{% endif %}>{{ i }}</option>
{% endfor %}
</select>
</div>
<div class="border border-black rounded-lg p-4 text-sm">
{{_('adventure_exp_1')}}
<div class="flex flex-row my-2 items-center">
<pre class="inline-block w-64"><code>{{{parse_keyword('print')}}}</code></pre>
<b class="mx-4">→</b>
<code class="text-base">{{parse_keyword('print')}}</code>
</div>
{{_('adventure_exp_2')}}
<div class="flex flex-row items-center">
<pre class="inline-block w-64"><pre><br>{{{parse_keyword('print')}}} {{_('hello_world')}}<br></pre></pre>
<b class="mx-4">→</b>
<div class="turn-pre-into-ace w-64" style="white-space: pre-wrap;">
<pre level="1" class="no-copy-button">{{parse_keyword('print')}} {{_('hello_world')}}</pre>
</div>
</div>
{{_('adventure_exp_3')}}
</div>
</div>
<div class="flex flex-col w-full lg:w-1/2">
<h3 class="text-center mt-0 mb-4">{{ _('adventure') }}</h3>
<textarea id="custom_adventure_content" class="block appearance-none w-full h-96 bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 rounded">{% if adventure.content|length > 0 %}{{ adventure.content }}{% else %}{{_('template_code')}}{% endif %}</textarea>
<div class="mt-2 mb-0 flex flex-row items-center text-center border-gray-500 border p-4 rounded-lg">
<input type="checkbox" name="agree_public" id="agree_public" class="mr-4" {% if adventure.public %}checked{% endif %}>
<label for="agree_public" class="text-sm italic w-full">{{_('adventure_terms')}}</label>
</div>
{% if class_data %}
<div class="flex flex-col items-center">
<h3 class="text-center">{{_('directly_add_adventure_to_classes')}}</h3>
<div class="border-gray-500 border px-4 py-2 rounded-lg">
<div class="flex flex-col items-center gap-2">
{% for class in class_data %}
<div class="flex w-full flex-row items-center gap-4 justify-between">
<label>{{ class.name }}</label>
<input class="customize_adventure_class_checkbox" type="checkbox" value="{{class.id}}" {% if class.checked %}checked{% endif %}>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
</div>
<div class="flex flex-row justify-end gap-2 my-4">
<button class="blue-btn" id="preview_adventure_button" onclick="hedyApp.preview_adventure();event.preventDefault();">{{_('preview')}}</button>
<button type="submit" class="green-btn" id="save_adventure_button">{{_('save')}}</button>
<button type="reset" class="red-btn" id="remove_adventure_button" onclick="hedyApp.delete_adventure('{{ adventure.id }}', '{{_('delete_adventure_prompt')}}')">{{_('remove')}}</button>
</div>
</form>
</div>
<div>
<button class="blue-btn" id="go_back_button" onclick="window.open('/for-teachers', '_self');">{{_('back_to_teachers_page')}}</button>
</div>
</div>
{% endblock %}
<!-- Todo TB: At one point we should clean this up instead of copying all scripts each time -->
{% block scripts %}
<script src="{{static('/vendor/ace.js')}}" type="text/javascript" charset="utf-8" crossorigin="anonymous"></script>
<script src="{{static('/vendor/ext-whitespace.js')}}" type="text/javascript" charset="utf-8" crossorigin="anonymous"></script>
<script src="{{static('/vendor/ext-rtl.js')}}" type="text/javascript" charset="utf-8" crossorigin="anonymous"></script>
<script src="/client_messages.js" type="text/javascript" crossorigin="anonymous"></script>
<script>
window.State = {};
window.State.lang = "{{ g.lang }}";
window.State.keyword_language = "{{ g.keyword_lang }}";
</script>
<script src="{{static('/js/appbundle.js')}}" type="text/javascript" crossorigin="anonymous"></script>
<script src="{{static('/vendor/skulpt.min.js')}}" type="text/javascript" crossorigin="anonymous"></script>
<script src="{{static('/vendor/skulpt-stdlib.js')}}" type="text/javascript" crossorigin="anonymous"></script>
<script src="{{static('/vendor/jquery.min.js')}}" type="text/javascript" crossorigin="anonymous"></script>
{% endblock %}