views: add an "archives" view
authorFrédéric Péters <fpeters@0d.be>
Sun, 29 Dec 2019 20:51:12 +0000 (21:51 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 30 Dec 2019 08:35:50 +0000 (09:35 +0100)
chloro/phyll/static/css/style.scss
chloro/phyll/templates/phyll/home.html
chloro/phyll/urls.py
chloro/phyll/views.py

index b46a441..c784925 100644 (file)
@@ -66,16 +66,25 @@ main {
 .home {
        a {
                text-transform: uppercase;
-               display: block;
+               display: inline-block;
                text-decoration: none;
                font-size: 500%;
                font-weight: bold;
                padding-top: 0.5em;
                line-height: 50%;
+               width: 100%;
                span {
                        font-size: 30%;
                }
                margin-bottom: 2rem;
+               &.divers {
+                       width: 49%;
+               }
+               &.vrac {
+                       width: 49%;
+                       text-align: right;
+                       float: right;
+               }
        }
 }
 
index ad9596e..987a446 100644 (file)
@@ -6,6 +6,7 @@
 <div>
 <a href="tag/radio/">Radio <span>(Panik &amp; ailleurs)</span></a>
 <a href="tag/code/">Logiciel libre <span>(Debian, GNOME &amp; ce qui passe)</span></a>
-<a href="tag/divers/"><span>(Totalement)</span> divers</a>
+<a class="divers" href="tag/divers/"><span>(Totalement)</span> divers</a>
+<a class="vrac" href="archives/"><span>(tout)</span> En vrac</a>
 </div>
 {% endblock %}
index b3171df..37c2c64 100644 (file)
@@ -42,6 +42,7 @@ urlpatterns = [
     url(r'^feeds/(?P<sub>[\w:-]+)/atom$', views.AtomFeed()),
     url(r'^feed/atom$', views.AtomFeed()),
     url(r'^tag/(?P<tag>[\w:-]+)/$', views.ListOnTagView.as_view()),
+    url(r'^archives/$', views.ArchivesView.as_view()),
     url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[\w:-]+)/$', views.NoteView.as_view()),
     url(r'^(?P<slug>[\w:-]+)/$', views.NoteView.as_view()),
     url(r'^$', views.HomeView.as_view()),
index 5264298..78d2fec 100644 (file)
@@ -66,6 +66,16 @@ class HomeView(TemplateView):
     template_name = 'phyll/home.html'
 
 
+class ArchivesView(ListView):
+    model = Note
+
+    def get_queryset(self):
+        qs = super(ArchivesView, self).get_queryset()
+        if not self.request.user.is_staff:
+            qs = qs.filter(published=True)
+        return qs
+
+
 class ListOnTagView(ListView):
     model = Note