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])
# 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']

View File

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

View File

@ -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;
}
}