]> git.ipfire.org Git - ipfire.org.git/commitdiff
lists: Add link to archive and controls to subscribe/unsubscribe
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Jan 2024 18:02:23 +0000 (18:02 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Jan 2024 18:02:23 +0000 (18:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/lists.py
src/templates/lists/index.html

index 525a6b00a75bd376e54b45ca8045af4c20218426..d2adff404eef7d6ba5236cc1be16f83f9bcb6df7 100644 (file)
@@ -126,6 +126,10 @@ class List(misc.Object):
        def description(self):
                return self.data.get("description")
 
+       @property
+       def archive_url(self):
+               return "https://lists.ipfire.org/hyperkitty/list/%s/" % self.list_id
+
        async def subscribe(self, account):
                pass # XXX TODO
 
index 3d8adee2bf468a390ef435d04050812cba4c61cd..61c6d397c27d288c68f640fed527b3145f2bb723 100644 (file)
                        {% for list in sorted(lists) %}
                                <div class="block">
                                        <div class="box">
-                                               <h5 class="title is-5">
+                                               <h4 class="title is-4">
                                                        {{ list }}
+                                               </h4>
 
-                                                       {# Show if subscribed #}
-                                                       {% if list in subscribed_lists %}
-                                                               <span class="tag is-success is-pulled-right">
-                                                                       {{ _("Subscribed") }}
-                                                               </span>
-                                                       {% else %}
-                                                               <span class="tag is-pulled-right">
-                                                                       {{ _("Not Subscribed") }}
+                                               <h6 class="subtitle is-6">
+                                                       {{ list.description }}
+                                               </h6>
+
+                                               <div class="buttons">
+                                                       <a class="button is-light" href="{{ list.archive_url }}">
+                                                               <span class="icon-text">
+                                                                       <span class="icon">
+                                                                               <i class="fa-solid fa-inbox"></i>
+                                                                       </span>
+                                                                       <span>{{ _("Archive") }}</span>
                                                                </span>
-                                                       {% end %}
-                                               </h5>
+                                                       </a>
 
-                                               {% if list.description %}
-                                                       <h6 class="subtitle is-6">{{ list.description }}</h6>
-                                               {% end %}
+                                                       {% if current_user %}
+                                                               {% if list in subscribed_lists %}
+                                                                       <a class="button is-success is-outlined" href="/lists/{{ list.list_id }}/unsubscribe">
+                                                                               {{ _("Subscribed") }}
+                                                                       </a>
+                                                               {% else %}
+                                                                       <a class="button is-success" href="/lists/{{ list.list_id }}/subscribe">
+                                                                               {{ _("Subscribe") }}
+                                                                       </a>
+                                                               {% end %}
+                                                       {% end %}
+                                               </div>
                                        </div>
                                </div>
                        {% end %}