From 57e8e0a72f8cbfd6af5e87f905002a9f8f1f16d8 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Mon, 4 Sep 2017 15:30:33 +0200 Subject: [PATCH] Adjusted frontpage styles --- publichealth/home/models/models.py | 7 +++++- publichealth/home/templates/news.html | 13 +++++------ publichealth/static/css/modules/_news.scss | 25 ++++++++++++++++++---- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/publichealth/home/models/models.py b/publichealth/home/models/models.py index f1b569d..8bd5189 100644 --- a/publichealth/home/models/models.py +++ b/publichealth/home/models/models.py @@ -227,15 +227,20 @@ class HomePage(Page): posts = EntryPage.objects.live().descendant_of(parent[0]) # Order by most recent date first posts = posts.order_by('-date') + return posts[:3] + + @property + def newsentries(self): # Get news entries entries = Entry.objects.all().order_by('-published') - return list(chain(entries[:3], posts[:3])) + return entries[:6] def get_context(self, request): # Update template context context = super(HomePage, self).get_context(request) context['featured'] = self.featured context['blogentries'] = self.blogentries + context['newsentries'] = self.newsentries return context parent_page_types = ['wagtailcore.Page'] diff --git a/publichealth/home/templates/news.html b/publichealth/home/templates/news.html index edf9738..e31f305 100644 --- a/publichealth/home/templates/news.html +++ b/publichealth/home/templates/news.html @@ -5,7 +5,6 @@
{% for entry in blogentries %} - {% if entry.body %}
@@ -21,12 +20,16 @@ {{ entry.body|striptags|truncatewords_html:40 }} {% endif %}

- Mehr erfahren + ...
- {% else %} + {% empty %} + + {% endfor %} +

Partner news

+ {% for entry in newsentries %}
{% if entry.visual %} @@ -38,14 +41,12 @@

{{ entry.title|striptags|truncatewords_html:10 }}

- {{ entry.author }}

- {{ entry.content|striptags|truncatewords_html:25 }} + {{ entry.author }}

- {% endif %} {% empty %} {% endfor %} diff --git a/publichealth/static/css/modules/_news.scss b/publichealth/static/css/modules/_news.scss index 14750fe..418cec4 100644 --- a/publichealth/static/css/modules/_news.scss +++ b/publichealth/static/css/modules/_news.scss @@ -76,10 +76,27 @@ } } - .news-entry .panel-body { - background-color: #f0f0f0; - border: 2px solid rgba(38, 67, 169, 0.8); - *,a { color: black !important; } + .news-entry { + height: 8em; + .panel { + background: none; + box-shadow: none; + border: none; + } + .panel-body { + height: 50%; + background-color: #f0f0f0; + border-radius: 4px; + border-top: 3px solid $brand-primary; + // border: 2px solid rgba(38, 67, 169, 0.8); + *,a { color: black !important; } + } + } + + .partner-news { + text-align: center; + margin-top: 2em; + margin-bottom: 1em; } }