Experiments page.
[wolnelektury.git] / src / experiments / templates / experiments / main_switch.html
1 {% extends request.EXPERIMENTS.layout.value|yesno:"2022/base.html,base/base.html" %}
2
3 {% block breadcrumbs %}
4   <span>Eksperymenty</span>
5 {% endblock %}
6
7 {% block main %}
8 {% block body %}
9   <img src="https://upload.wikimedia.org/wikipedia/commons/c/c8/MH1Asimulator.JPG" style="width:100%">
10
11   {% for exp in request.EXPERIMENTS.values %}
12     <div class="experiment" data-slug="{{ exp.slug }}">
13       {{ exp.name }}
14       <button
15           {% if exp.value %}
16           disabled class="active"
17           {% endif %}
18           data-value="on">włączony</button>
19       <button
20           {% if not exp.value %}
21           disabled class="active"
22           {% endif %}
23           data-value="off">wyłączony</button>
24     </div>
25   {% endfor %}
26 {% endblock %}
27
28 {% block extrabody %}
29   <style>
30    .experiment {
31        margin: 1em 0;
32        font-size: 1.5em;
33    }
34    .experiment button {
35        margin: 0 1em;
36        padding: .5em;
37        font-size: 1em;
38
39    }
40   </style>
41   <script>
42    $(".experiment button").click(function() {
43        document.cookie = 'EXPERIMENT_' + $(this).parent().data('slug') + '=' + $(this).data('value') + '; path=/; max-age=31536000';
44        window.location.reload(true);
45    });
46   </script>
47 {% endblock %}
48 {% endblock %}