]> git.0d.be Git - django-panik-nonstop.git/blob - nonstop/templates/nonstop/zone_settings.html
switch-jack: fix logging
[django-panik-nonstop.git] / nonstop / templates / nonstop / zone_settings.html
1 {% extends "base.html" %}
2 {% load gadjo i18n %}
3
4 {% block page-title %}{{ zone.title }} | Nonstop | {{ block.super }}{% endblock %}
5
6 {% block appbar %}
7   <h2>Nonstop — {{ zone.title }}
8     {% for emission in zone.get_playlist_emissions %}
9       {% if forloop.first %}· {% endif %}
10       <a href="{% url 'emission-view' slug=emission.slug %}">{{ emission }}</a>{% if not forloop.last %}, {% endif %}
11     {% endfor %}
12   </h2>
13   {% if perms.emissions.change_nonstop %}
14     <span class="actions">
15       <a class="delete-button" rel="popup" href="{% url 'nonstop-zone-delete' slug=zone.slug %}">{% trans "Delete" %}</a>
16       <a href="{% url 'zone-editorial-settings' slug=zone.slug %}">{% trans "Editorial Settings" %}</a>
17     </span>
18   {% endif %}
19 {% endblock %}
20
21 {% block more-user-links %}
22   {{ block.super }}
23   <a class="button icon-music" href="{% url 'nonstop-quick-links' %}">{% trans "Nonstop management" %}</a>
24 {% endblock %}
25
26 {% block content %}
27   <form method="POST">
28     {% csrf_token %}
29     {{form|with_template}}
30
31     <div class="buttons">
32       <button class="submit-button">{% trans "Save" %}</button>
33       <a class="cancel" href="{% url 'nonstop-zones' %}">{% trans "Cancel" %}</a>
34     </div>
35
36   </form>
37
38   <script>
39     $(function() {
40       var xhr = null;
41       var $french_quota = $('<span id="computed-french-quota"></span>');
42       $french_quota.insertAfter($('#computed-percent-weight_lang_fr'));
43       $('[type=range]').on('change', function() {
44         var params = $('[type=range]').serialize();
45         if (xhr !== null ) xhr.abort();
46         xhr = $.ajax({
47           url: "{% url 'nonstop-ajax-zone-percents' slug=zone.slug %}?" + params,
48           dataType: 'json',
49           success: function(data, status, xhr) {
50             for (var key of Object.keys(data)) {
51               $('#computed-percent-weight_' + key).text((parseInt(data[key] * 100)) + '%');
52               $french_quota.text(' (' + parseInt(data['french_quota'] * 100) + '% hors instru)');
53             }
54           }
55         });
56       });
57       $('[type=range]').first().trigger('change');
58     });
59   </script>
60 {% endblock %}