Commit 48281229 authored by fred's avatar fred

add links to nonstop home, and handle permissions

parent 8001623b
......@@ -5,6 +5,11 @@
<h2>Nonstop - Artist: {{ object.name }}</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<h3>{% trans "Most recently played" %}</h3>
......
......@@ -5,6 +5,11 @@
<h2>Nonstop - Artists</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<ul class="artists-list">
......
......@@ -5,6 +5,11 @@
<h2>Nonstop{% if zone %} — {{zone.title}} — {{count}} tracks{% endif %}</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<form id="track-search">
{{ form.as_p }}
......
......@@ -5,14 +5,21 @@
<h2>Nonstop</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<ul>
<li><a href="{% url 'nonstop-today' %}">Aujourd'hui</a> (avec des liens pour naviguer vers les autres jours)</li>
<li><a href="{% url 'artist-list' %}">Artistes</a> présents (un jour ou l'autre) dans le nonstop</li>
<li><a href="{% url 'nonstop-search' %}">Recherche</a> dans les pistes et artistes</li>
{% if perms.nonstop.add_track %}
<li><a href="{% url 'nonstop-upload-tracks' %}">Ajout de nouveaux morceaux</a></li>
<li><a href="{% url 'nonstop-recent-tracks' %}">Édition rapide de métadonnées de nouveaux morceaux</a> (langue, Instru, SABAM, CFWB)</li>
<li><a href="{% url 'nonstop-cleanup' %}">Nettoyage de vieux morceaux</a></li>
{% endif %}
</ul>
{% endblock %}
......@@ -5,6 +5,11 @@
<h2>Nonstop - {% trans "Recent Tracks" %}</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
......
......@@ -5,6 +5,11 @@
<h2>Nonstop</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<form id="track-search">
{{ form.as_p }}
......
......@@ -8,7 +8,8 @@
{% endblock %}
{% block more-user-links %}
<a href="{% url 'nonstop-today' %}">Aujourd'hui</a>
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
......
......@@ -7,6 +7,11 @@
<a href="?from=-30d">during last month</a>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<div class="nonstop-stats">
......
......@@ -5,6 +5,11 @@
<h2>Nonstop - Track: {{ object.artist.name }} / {{ object.title }}</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
{% if not object.file_exists %}
......@@ -31,6 +36,7 @@
<p>In nonstop since {{ object.added_to_nonstop_timestamp|date:"SHORT_DATE_FORMAT" }}.</p>
{% if perms.nonstop.add_track %}
<form method="POST">
{% csrf_token %}
{{ metadata_form.as_p }}
......@@ -41,6 +47,8 @@
</div>
{% endif %}
{% endif %}
<style>
ul.soma-list {
float: left;
......
......@@ -5,6 +5,11 @@
<h2>Nonstop - {% trans "Upload" %}</h2>
{% endblock %}
{% block more-user-links %}
{{ block.super }}
<a href="{% url 'nonstop-quick-links' %}">Gestion nonstop</a>
{% endblock %}
{% block content %}
<form method="post" enctype="multipart/form-data">
......@@ -14,7 +19,7 @@
{{ form.as_p }}
<div class="buttons">
<button class="submit-button">{% trans "Upload" %}</button>
<a class="cancel" href="...">{% trans "Cancel" %}</a>
<a class="cancel" href="{% url 'nonstop-quick-links' %}">{% trans "Cancel" %}</a>
</div>
</form>
......
......@@ -69,6 +69,7 @@ class TrackDetailView(DetailView):
return ctx
def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks')
instance = self.get_object()
old_nonstop_zones = copy.copy(instance.nonstop_zones.all())
form = TrackMetaForm(request.POST, instance=instance)
......@@ -171,6 +172,7 @@ class UploadTracksView(FormView):
success_url = '.'
def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks')
form_class = self.get_form_class()
form = self.get_form(form_class)
tracks = request.FILES.getlist('tracks')
......@@ -228,6 +230,7 @@ class RecentTracksView(ListView):
return Track.objects.exclude(creation_timestamp__isnull=True).order_by('-creation_timestamp')[:50]
def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks')
for track_id in request.POST.getlist('track'):
track = Track.objects.get(id=track_id)
track.language = request.POST.get('lang-%s' % track_id, '')
......@@ -302,6 +305,7 @@ class CleanupView(TemplateView):
return ctx
def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks')
count = 0
for track_id in request.POST.getlist('track'):
if request.POST.get('remove-%s' % track_id):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment