]> git.0d.be Git - chloro.git/commitdiff
include direct links to latest posts on homepage
authorFrédéric Péters <fpeters@0d.be>
Sat, 22 Feb 2020 18:51:28 +0000 (19:51 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sat, 22 Feb 2020 19:00:34 +0000 (20:00 +0100)
chloro/phyll/static/css/style.scss
chloro/phyll/templates/phyll/home.html
chloro/phyll/views.py

index 63526efcd17a9ea12b162b68f9f199ddfe6844c4..bce2e84cdf736e2cf87b70c4282e069e28654aa0 100644 (file)
@@ -154,5 +154,20 @@ main {
                        font-size: 60%;
                }
        }
+}
 
+.older.post-list {
+       margin: 5em 0 2em 0;
+       padding: 1em 0;
+       border-top: 0.1em dotted $link-color;
+       border-bottom: 0.1em dotted $link-color;
+       line-height: 200%;
+       li {
+               display: inline;
+               a {
+                       padding-top: 0;
+                       display: inline;
+                       font-size: 120%;
+               }
+       }
 }
index 42eb41048176ea05f102c7b24bc62ff0a5bb2263..4688d5fd8eaf86490b3a655d990dd7827cf4f708 100644 (file)
@@ -4,6 +4,7 @@
 
 {% block body %}
 
+{% with posts.0 as latest %}
 <div class="latest">
 <h2><a href="{{ latest.get_absolute_url }}">{{ latest.title }}</a></h2>
 <div class="meta">{{ latest.creation_timestamp|date:"j E Y, H:i"|lower }}</div>
 {{ latest.text|safe }}
 </div>
 </div>
+{% endwith %}
+
+<div class="older post-list">
+<ul>
+{% for post in posts|slice:"1:" %}
+<li><a href="{{ post.get_absolute_url }}">{{ post.title }}&nbsp;<span>{{ post.creation_timestamp|date:"Y/m/d" }}</span></a></li>
+{% endfor %}
+<li><a href="/archives/">...</a></li>
+</ul>
+</div>
 
 <nav>
 <a href="tag/radio/">Radio <span>(Panik &amp; ailleurs)</span></a>
index 6c8fdabf26d5febc7f7e49fde7221bdbb621355e..84b40e7fd0071ba633ceb553ffd05dfc20cafc3f 100644 (file)
@@ -67,7 +67,7 @@ class HomeView(TemplateView):
 
     def get_context_data(self, **kwargs):
         context = super(HomeView, self).get_context_data(**kwargs)
-        context['latest'] = Note.objects.filter(published=True).latest('creation_timestamp')
+        context['posts'] = Note.objects.filter(published=True).order_by('-creation_timestamp')[:5]
         return context