]> git.0d.be Git - django-panik-nonstop.git/blob - nonstop/templates/nonstop/zone_settings.html
add weight settings for track parameters
[django-panik-nonstop.git] / nonstop / templates / nonstop / zone_settings.html
1 {% extends "base.html" %}
2 {% load gadjo i18n %}
3
4 {% block appbar %}
5 <h2>Nonstop — {{ zone.title }}</h2>
6 {% endblock %}
7
8 {% block more-user-links %}
9 {{ block.super }}
10 <a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
11 {% endblock %}
12
13 {% block content %}
14 <form method="POST">
15 {% csrf_token %}
16 {{form|with_template}}
17
18   <div class="buttons">
19     <button class="submit-button">{% trans "Save" %}</button>
20     <a class="cancel" href="{% url 'nonstop-zones' %}">{% trans "Cancel" %}</a>
21   </div>
22
23 </form>
24
25 <script>
26 $(function() {
27   var xhr = null;
28   $('[type=range]').on('change', function() {
29     var params = $('[type=range]').serialize();
30     if (xhr !== null ) xhr.abort();
31     xhr = $.ajax({
32       url: "{% url 'nonstop-ajax-zone-percents' slug=zone.slug %}?" + params,
33       dataType: 'json',
34       success: function(data, status, xhr) {
35         for (var key of Object.keys(data)) {
36            $('#computed-percent-weight_' + key).text((parseInt(data[key] * 100)) + '%');
37         }
38       }
39     });
40   });
41   $('[type=range]').first().trigger('change');
42 });
43 </script>
44 {% endblock %}