Adjusted frontpage styles

This commit is contained in:
Oleg Lavrovsky 2017-09-04 15:30:33 +02:00
parent 71de2a8fc9
commit 57e8e0a72f
3 changed files with 34 additions and 11 deletions

View file

@ -227,15 +227,20 @@ class HomePage(Page):
posts = EntryPage.objects.live().descendant_of(parent[0]) posts = EntryPage.objects.live().descendant_of(parent[0])
# Order by most recent date first # Order by most recent date first
posts = posts.order_by('-date') posts = posts.order_by('-date')
return posts[:3]
@property
def newsentries(self):
# Get news entries # Get news entries
entries = Entry.objects.all().order_by('-published') entries = Entry.objects.all().order_by('-published')
return list(chain(entries[:3], posts[:3])) return entries[:6]
def get_context(self, request): def get_context(self, request):
# Update template context # Update template context
context = super(HomePage, self).get_context(request) context = super(HomePage, self).get_context(request)
context['featured'] = self.featured context['featured'] = self.featured
context['blogentries'] = self.blogentries context['blogentries'] = self.blogentries
context['newsentries'] = self.newsentries
return context return context
parent_page_types = ['wagtailcore.Page'] parent_page_types = ['wagtailcore.Page']

View file

@ -5,7 +5,6 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
{% for entry in blogentries %} {% for entry in blogentries %}
{% if entry.body %}
<!-- Blog post {{ entry.id }} --> <!-- Blog post {{ entry.id }} -->
<div class="col-md-4 col-sm-6 col-xs-12 blog-entry"> <div class="col-md-4 col-sm-6 col-xs-12 blog-entry">
<div class="panel panel-default"> <div class="panel panel-default">
@ -21,12 +20,16 @@
{{ entry.body|striptags|truncatewords_html:40 }} {{ entry.body|striptags|truncatewords_html:40 }}
{% endif %} {% endif %}
</p> </p>
<a href="{% pageurl entry %}" class="btn btn-default btn-xs">Mehr erfahren</a> <a href="{% pageurl entry %}" class="btn btn-default btn-xs"> ... </a>
</div> </div>
<a href="{% pageurl entry %}" class="fill"></a> <a href="{% pageurl entry %}" class="fill"></a>
</div> </div>
</div> </div>
{% else %} {% empty %}
<!-- No blogs today -->
{% endfor %}
<h4 class="partner-news"><a href="/aktuelles/">Partner news</a></h4>
{% for entry in newsentries %}
<!-- News entry {{ entry.id }} --> <!-- News entry {{ entry.id }} -->
<div class="col-md-4 col-sm-6 col-xs-12 news-entry"> <div class="col-md-4 col-sm-6 col-xs-12 news-entry">
{% if entry.visual %} {% if entry.visual %}
@ -38,14 +41,12 @@
<div class="panel-body"> <div class="panel-body">
<h3><span>{{ entry.title|striptags|truncatewords_html:10 }}</span></h3> <h3><span>{{ entry.title|striptags|truncatewords_html:10 }}</span></h3>
<p> <p>
<em><small><span>{{ entry.author }}</span></small></em><br><br> <em><small><span>{{ entry.author }}</span></small></em>
{{ entry.content|striptags|truncatewords_html:25 }}
</p> </p>
</div> </div>
<a href="{{ entry.link }}" target="_blank" class="fill"></a> <a href="{{ entry.link }}" target="_blank" class="fill"></a>
</div> </div>
</div> </div>
{% endif %}
{% empty %} {% empty %}
<!-- No news today --> <!-- No news today -->
{% endfor %} {% endfor %}

View file

@ -76,10 +76,27 @@
} }
} }
.news-entry .panel-body { .news-entry {
background-color: #f0f0f0; height: 8em;
border: 2px solid rgba(38, 67, 169, 0.8); .panel {
*,a { color: black !important; } 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;
} }
} }