Infoblocks refactored
This commit is contained in:
parent
4e88b3f71f
commit
bbbe571d87
7 changed files with 52 additions and 37 deletions
|
@ -71,6 +71,7 @@ class ArticlePage(Page):
|
|||
'body_fr',
|
||||
)
|
||||
|
||||
date = models.DateField("Date", null=True, blank=True)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
|
@ -101,6 +102,7 @@ class ArticlePage(Page):
|
|||
]
|
||||
promote_panels = [
|
||||
ImageChooserPanel('feed_image'),
|
||||
FieldPanel('date'),
|
||||
InlinePanel('related_links', label="Links"),
|
||||
MultiFieldPanel(Page.promote_panels, "Common page configuration"),
|
||||
]
|
||||
|
@ -167,7 +169,7 @@ class HomePage(Page):
|
|||
@property
|
||||
def featured(self):
|
||||
# Get list of live pages that are descendants of this page
|
||||
articles = ArticlePage.objects.live().descendant_of(self)
|
||||
articles = ArticlePage.objects.live()[:4] #.descendant_of(self)
|
||||
# Order by most recent date first
|
||||
#articles = articles.order_by('-date')
|
||||
return articles
|
||||
|
|
|
@ -4,7 +4,15 @@
|
|||
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% for entry in banner_articles %}
|
||||
<section id="news-details">
|
||||
<div class="container">
|
||||
|
||||
<h2>{{ page.trans_title }}</h2>
|
||||
|
||||
<p class="lead">{{ page.trans_intro|richtext }}</p>
|
||||
|
||||
<div class="article-body" role="main">
|
||||
{% for entry in banner_articles %}
|
||||
<div class="item">
|
||||
<image style="background-image:url({{ entry.feed_image.src }})" />
|
||||
<div class="carousel-caption">
|
||||
|
@ -12,7 +20,11 @@
|
|||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
{% empty %}
|
||||
No articles found
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
|
||||
<p class="lead">{{ page.trans_intro|richtext }}</p>
|
||||
|
||||
{% if page.date %}
|
||||
<p class="date">{{ page.date }}</p>
|
||||
{% endif %}
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="article-body" role="main">
|
||||
|
@ -33,5 +35,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
|||
{% include 'news.html' %}
|
||||
|
||||
<!-- Page body -->
|
||||
{% if page.trans_body %}
|
||||
<section>
|
||||
<div class="container">
|
||||
<div class="homepage-body">
|
||||
|
@ -20,28 +19,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- Infoblocks -->
|
||||
<section id="three" class="wrapper align-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for block in page.trans_infos %}
|
||||
<article class="col-md-4">
|
||||
<div class="image">
|
||||
{% image block.value.photo fill-300x300 %}
|
||||
</div>
|
||||
<header>
|
||||
<h3>{{ block.value.title }}</h3>
|
||||
</header>
|
||||
{{ block.value.summary|richtext }}
|
||||
<footer>
|
||||
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
|
||||
</footer>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% include 'infos.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
22
publichealth/home/templates/infos.html
Normal file
22
publichealth/home/templates/infos.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
<section id="three" class="wrapper align-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for block in page.trans_infos %}
|
||||
<article class="col-md-4">
|
||||
<div class="image">
|
||||
{% image block.value.photo fill-300x300 %}
|
||||
</div>
|
||||
<header>
|
||||
<h3>{{ block.value.title }}</h3>
|
||||
</header>
|
||||
{{ block.value.summary|richtext }}
|
||||
<footer>
|
||||
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
|
||||
</footer>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
|
@ -1,7 +1,6 @@
|
|||
{% 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 %}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{% pageurl site_root %}"><img src="/static/images/public-health-logo-sign.png" alt="[logo]">
|
||||
<a class="navbar-brand" href="{% pageurl site_root %}home"><img src="/static/images/public-health-logo-sign.png" alt="[logo]">
|
||||
<span class="hidden-xs"><strong>Public Health</strong> Schweiz</span></a>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue