0ff0d88c4a68f8b0742a6ce46dbc4dc30a2f4995
[wolnelektury.git] / src / experiments / templates / experiments / main_switch.html
1 {% extends "base/base.html" %}
2
3
4 {% block body %}
5   <img src="https://upload.wikimedia.org/wikipedia/commons/c/c8/MH1Asimulator.JPG" style="width:100">
6
7   {% for exp in experiments %}
8     <div class="experiment" data-slug="{{ exp.config.slug }}">
9       {{ exp.config.name }}
10       {% for cohort in exp.config.cohorts %}
11         <button
12             {% if exp.value == cohort.value %}
13             disabled class="active"
14             {% endif %}
15             data-value="{{ cohort.value }}">{{ cohort.name }}</button>
16       {% endfor %}
17     </div>
18
19     <script>
20     </script>
21
22   {% endfor %}
23 {% endblock %}
24
25 {% block extrabody %}
26   <style>
27    .experiment {
28        margin: 1em 0;
29        font-size: 1.5em;
30    }
31    .experiment button {
32        margin: 0 1em;
33        padding: .5em;
34        font-size: 1em;
35
36    }
37   </style>
38   <script>
39    $(".experiment button").click(function() {
40        document.cookie = 'EXPERIMENT_' + $(this).parent().data('slug') + '=' + $(this).data('value') + '; path=/';
41        window.location.reload(true);
42    });
43   </script>
44 {% endblock %}