Article index page

This commit is contained in:
Oleg Lavrovsky 2017-03-08 23:04:08 +01:00
parent bbbe571d87
commit da23dab6cc
4 changed files with 16 additions and 12 deletions

View file

@ -34,11 +34,13 @@ class ArticleIndexPage(Page):
FieldPanel('title_fr'),
FieldPanel('intro_fr'),
]
def get_context(self, request):
context = super(ArticleIndexPage, self).get_context(request)
# Add extra variables and return the updated context
context['article_entries'] = ArticlePage.objects.child_of(self).live()
articles = ArticlePage.objects.child_of(self).live()
context['articles'] = articles
return context
class Meta:
verbose_name = "Rubrik"

View file

@ -6,10 +6,12 @@
<div class="item">
{% image entry.feed_image original as entry_photo %}
<image style="background-image:url({{ entry_photo.url }})">
<div class="carousel-caption">
<h3>{{ entry.trans_title }}</h3>
<p>{{ entry.trans_intro|richtext }}</p>
</div>
<a href="{% pageurl entry %}">
<div class="carousel-caption">
<h3>{{ entry.trans_title }}</h3>
<p>{{ entry.trans_intro|richtext }}</p>
</div>
</a>
</div>
{% empty %}
No articles found

View file

@ -4,7 +4,7 @@
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
{% block content %}
<section id="news-details">
<section id="article-index">
<div class="container">
<h2>{{ page.trans_title }}</h2>
@ -12,18 +12,17 @@
<p class="lead">{{ page.trans_intro|richtext }}</p>
<div class="article-body" role="main">
{% for entry in banner_articles %}
{% for entry in articles %}
<div class="item">
<image style="background-image:url({{ entry.feed_image.src }})" />
<div class="carousel-caption">
<h3>{{ entry.trans_title }}</h3>
<div class="article-caption">
<h3><a href="{% pageurl entry %}">{{ entry.trans_title }}</a></h3>
<p>{{ entry.trans_intro|richtext }}</p>
</div>
</div>
{% empty %}
No articles found
{% endfor %}
</div>
</div>
</section>

View file

@ -1,6 +1,7 @@
{% load navigation wagtailcore_tags %}
<ul class="dropdown-menu">
<li><a href="{% pageurl parent %}">{{ parent.title }}</a></li>
{% for child in menuitems_children %}
<li><a href="{% pageurl child %}">{{ child.title }}</a></li>
{% endfor %}