Fibinger Ádám
2019-11-10 cb9ca2b735b9fedc479799e88ddb731251b35b08
commit | author | age
a4186a 1 {% extends "admin/html-skeleton.twig" %}
2 {% block body %}
cb9ca2 3     <form action="/generator/match-history.php" method="post" onsubmit="return false;">
4         <input type="submit" value="Mentés">
5         <label for="currentMap">
6             Map:
7         </label>
a4186a 8         <select name="currentMap" id="currentMap" onchange="updateSites()">
9             {% for map in history.getMapNames %}
10                 <option value="{{ map }}" {{ history.getCurrentMap == map ? "selected" }}>{{ map }}</option>
11             {% endfor %}
12         </select>
13         <div class="form-group">
14             <pre>
15             {% for round in history %}
16                 {% include "admin/history-round.twig" %}
17             {% endfor %}
18             </pre>
19         </div>
20     </form>
21 {% endblock %}
22
23 {% block lazyload %}
24     {{ parent() }}
25     <script type="text/javascript">
26         var maps = {{ history.getMaps|json_encode|raw }}
cb9ca2 27         function updateSites() {
28             var currentMap = document.getElementById('currentMap').value;
29             console.log(maps[currentMap]);
30         }
31
32
33         function siteSelected(button)
34         {
35             var but = $(button);
36             var button_data = but.data();
37             resetSiteOutlines(button_data.form);
38             $('#' + button_data.input).val(button_data.site);
39             but.removeClass().addClass("site " + but.data('selected'));
40             return false;
41         }
42
43         function resetSiteOutlines(form_id) {
44             $('#'+form_id + ' button.site').each(function (idx, button) {
45                 const but = $(button);
46                 but.removeClass().addClass("site " + but.data('outline'));
47                 console.error(but);
48             });
49         }
50
51         function winSelected(button) {
52             var but = $(button);
53             var button_data = but.data();
54             resetWinOutlines(button_data.form);
55             $('#' + button_data.input).val(button_data.site);
56             but.removeClass().addClass("win " + but.data('selected'));
57             return false;
58         }
59
60         function resetWinOutlines(form_id) {
61             $('#'+form_id + ' button.win').each(function (idx, button) {
62                 const but = $(button);
63                 but.removeClass().addClass("win " + but.data('outline'));
64             });
65         }
66
a4186a 67     </script>
68 {% endblock %}