diff --git a/club/views.py b/club/views.py index a14b71cd..ff09a5f5 100644 --- a/club/views.py +++ b/club/views.py @@ -762,7 +762,19 @@ class PosterListView(ClubTabsMixin, PosterListBaseView): """List communication posters.""" current_tab = "posters" - extra_context = {"app": "club"} + extra_context = { + "links": { + "title": _("Posters"), + "position": "right", + }, + "action": { + "class": "edit", + "label": _("Edit"), + "get_url": lambda club, poster: reverse( + "club:poster_edit", kwargs={"club_id": club.id, "poster_id": poster.id} + ), + }, + } def get_queryset(self): return super().get_queryset().filter(club=self.club.id) @@ -770,6 +782,19 @@ class PosterListView(ClubTabsMixin, PosterListBaseView): def get_object(self): return self.club + def get_context_data(self, **kwargs): + kwargs = super().get_context_data(**kwargs) + kwargs["links"]["links"] = [ + { + "pk": "create", + "label": _("Create"), + "url": reverse_lazy( + "club:poster_create", kwargs={"club_id": self.club.id} + ), + } + ] + return kwargs + class PosterCreateView(ClubTabsMixin, PosterCreateBaseView): """Create communication poster.""" diff --git a/com/templates/com/poster_list.jinja b/com/templates/com/poster_list.jinja index d723c248..fe247af5 100644 --- a/com/templates/com/poster_list.jinja +++ b/com/templates/com/poster_list.jinja @@ -12,14 +12,11 @@
-

{% trans %}Posters{% endtrans %}

- @@ -43,11 +40,7 @@
{{ poster.date_begin | localtime | date("d/M/Y H:m") }}
{{ poster.date_end | localtime | date("d/M/Y H:m") }}
- {% if app == "com" %} - {% trans %}Edit{% endtrans %} - {% elif app == "club" %} - {% trans %}Edit{% endtrans %} - {% endif %} + {{ action["label"] }}