Navigation
This commit is contained in:
parent
d04691c1ec
commit
668c578c32
8 changed files with 103 additions and 64 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-23 08:22
|
||||
# Generated by Django 1.10.5 on 2017-02-23 08:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
@ -26,7 +26,7 @@ class Migration(migrations.Migration):
|
|||
('title_fr', models.CharField(default='', max_length=255)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'verbose_name': 'Rubrik',
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
|
@ -38,12 +38,12 @@ class Migration(migrations.Migration):
|
|||
('date', models.DateField(verbose_name='Date')),
|
||||
('intro_de', wagtail.wagtailcore.fields.RichTextField(default='')),
|
||||
('intro_fr', wagtail.wagtailcore.fields.RichTextField(default='')),
|
||||
('body_de', wagtail.wagtailcore.fields.StreamField([('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())], blank=True, null=True)),
|
||||
('body_fr', wagtail.wagtailcore.fields.StreamField([('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())], blank=True, null=True)),
|
||||
('body_de', wagtail.wagtailcore.fields.StreamField([('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title'))], blank=True, null=True)),
|
||||
('body_fr', wagtail.wagtailcore.fields.StreamField([('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title'))], blank=True, null=True)),
|
||||
('feed_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'verbose_name': 'Artikel',
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
|
@ -74,12 +74,12 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='homepage',
|
||||
name='infos_de',
|
||||
field=wagtail.wagtailcore.fields.StreamField([('info', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'summary', wagtail.wagtailcore.blocks.RichTextBlock()), (b'action', wagtail.wagtailcore.blocks.CharBlock(required=True))]))], blank=True, null=True),
|
||||
field=wagtail.wagtailcore.fields.StreamField([('info', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), (b'action', wagtail.wagtailcore.blocks.CharBlock()), (b'url', wagtail.wagtailcore.blocks.URLBlock())]))], blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepage',
|
||||
name='infos_fr',
|
||||
field=wagtail.wagtailcore.fields.StreamField([('info', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'summary', wagtail.wagtailcore.blocks.RichTextBlock()), (b'action', wagtail.wagtailcore.blocks.CharBlock(required=True))]))], blank=True, null=True),
|
||||
field=wagtail.wagtailcore.fields.StreamField([('info', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), (b'action', wagtail.wagtailcore.blocks.CharBlock()), (b'url', wagtail.wagtailcore.blocks.URLBlock())]))], blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepage',
|
|
@ -15,7 +15,7 @@ from .util import TranslatedField
|
|||
|
||||
class ArticleIndexPage(Page):
|
||||
title_fr = models.CharField(max_length=255, default="")
|
||||
translated_title = TranslatedField(
|
||||
trans_title = TranslatedField(
|
||||
'title',
|
||||
'title_fr',
|
||||
)
|
||||
|
@ -27,10 +27,12 @@ class ArticleIndexPage(Page):
|
|||
# Add extra variables and return the updated context
|
||||
context['article_entries'] = ArticlePage.objects.child_of(self).live()
|
||||
return context
|
||||
class Meta:
|
||||
verbose_name = "Rubrik"
|
||||
|
||||
class ArticlePage(Page):
|
||||
title_fr = models.CharField(max_length=255, default="")
|
||||
translated_title = TranslatedField(
|
||||
trans_title = TranslatedField(
|
||||
'title',
|
||||
'title_fr',
|
||||
)
|
||||
|
@ -39,22 +41,22 @@ class ArticlePage(Page):
|
|||
|
||||
intro_de = RichTextField(default='')
|
||||
intro_fr = RichTextField(default='')
|
||||
intro = TranslatedField(
|
||||
trans_intro = TranslatedField(
|
||||
'intro_de',
|
||||
'intro_fr',
|
||||
)
|
||||
|
||||
body_de = StreamField([
|
||||
('heading', blocks.CharBlock(classname="full title")),
|
||||
('paragraph', blocks.RichTextBlock()),
|
||||
('image', ImageChooserBlock()),
|
||||
('section', blocks.CharBlock(classname="full title")),
|
||||
], null=True, blank=True)
|
||||
body_fr = StreamField([
|
||||
('heading', blocks.CharBlock(classname="full title")),
|
||||
('paragraph', blocks.RichTextBlock()),
|
||||
('image', ImageChooserBlock()),
|
||||
('section', blocks.CharBlock(classname="full title")),
|
||||
], null=True, blank=True)
|
||||
body = TranslatedField(
|
||||
trans_body = TranslatedField(
|
||||
'body_de',
|
||||
'body_fr',
|
||||
)
|
||||
|
@ -72,11 +74,15 @@ class ArticlePage(Page):
|
|||
index.SearchField('body_fr'),
|
||||
index.SearchField('title'),
|
||||
index.SearchField('title_fr'),
|
||||
index.SearchField('intro_de'),
|
||||
index.SearchField('intro_fr'),
|
||||
index.FilterField('date'),
|
||||
]
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel('title_fr'),
|
||||
FieldPanel('date'),
|
||||
FieldPanel('intro_de'),
|
||||
FieldPanel('intro_fr'),
|
||||
StreamFieldPanel('body_de'),
|
||||
StreamFieldPanel('body_fr'),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
|
@ -87,6 +93,8 @@ class ArticlePage(Page):
|
|||
]
|
||||
parent_page_types = ['home.ArticleIndexPage']
|
||||
subpage_types = []
|
||||
class Meta:
|
||||
verbose_name = "Artikel"
|
||||
|
||||
class ArticleRelatedLink(Orderable):
|
||||
page = ParentalKey(ArticlePage, related_name='related_links')
|
||||
|
@ -100,21 +108,21 @@ class ArticleRelatedLink(Orderable):
|
|||
class InfoBlock(blocks.StructBlock):
|
||||
title = blocks.CharBlock(required=True)
|
||||
photo = ImageChooserBlock()
|
||||
summary = blocks.RichTextBlock()
|
||||
action = blocks.CharBlock(required=True)
|
||||
url = models.URLField()
|
||||
summary = blocks.RichTextBlock(required=True)
|
||||
action = blocks.CharBlock()
|
||||
url = blocks.URLBlock()
|
||||
|
||||
class HomePage(Page):
|
||||
intro_de = RichTextField(default='')
|
||||
intro_fr = RichTextField(default='')
|
||||
intro = TranslatedField(
|
||||
trans_intro = TranslatedField(
|
||||
'intro_de',
|
||||
'intro_fr',
|
||||
)
|
||||
|
||||
body_de = RichTextField(default='')
|
||||
body_fr = RichTextField(default='')
|
||||
body = TranslatedField(
|
||||
trans_body = TranslatedField(
|
||||
'body_de',
|
||||
'body_fr',
|
||||
)
|
||||
|
@ -125,7 +133,7 @@ class HomePage(Page):
|
|||
infos_fr = StreamField([
|
||||
('info', InfoBlock())
|
||||
], null=True, blank=True)
|
||||
infos = TranslatedField(
|
||||
trans_infos = TranslatedField(
|
||||
'infos_de',
|
||||
'infos_fr',
|
||||
)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<div class="container">
|
||||
<footer class="container">
|
||||
<p class="lead">
|
||||
{{ page.intro|richtext }}
|
||||
{{ page.trans_intro|richtext }}
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
|
|
@ -4,25 +4,34 @@
|
|||
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section id="news-details">
|
||||
<div class="container">
|
||||
|
||||
<h1>{{ page.translated_title }}</h1>
|
||||
<small>{{ page.date }}</small>
|
||||
<div class="image">
|
||||
{% include_block feed_image %}
|
||||
</div>
|
||||
|
||||
<h2>{{ page.trans_title }}</h2>
|
||||
|
||||
<p class="lead">{{ page.trans_intro }}</p>
|
||||
|
||||
{% include_block feed_image %}
|
||||
<p class="date">{{ page.date }}</p>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="container" role="main">
|
||||
<!-- Main content -->
|
||||
<div class="article-body" role="main">
|
||||
|
||||
{% for block in page.body %}
|
||||
{% for block in page.trans_body %}
|
||||
{% if block.block_type == 'heading' %}
|
||||
<h2>{{ block.value }}</h2>
|
||||
<h3>{{ block.value }}</h3>
|
||||
{% else %}
|
||||
<section class="block-{{ block.block_type }}">
|
||||
<p class="block-{{ block.block_type }}">
|
||||
{% include_block block %}
|
||||
</section>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -10,34 +10,34 @@
|
|||
|
||||
{% include 'news.html' %}
|
||||
|
||||
<section>
|
||||
<div class="container">
|
||||
<div class="homepage-body">
|
||||
{{ page.body|richtext }}
|
||||
</div>
|
||||
<section>
|
||||
<div class="container">
|
||||
<div class="homepage-body">
|
||||
{{ page.trans_body|richtext }}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Three -->
|
||||
<section id="three" class="wrapper align-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for block in page.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>
|
||||
<!-- Three -->
|
||||
<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>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
|
18
publichealth/home/templates/news_dynamic.html
Normal file
18
publichealth/home/templates/news_dynamic.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<section id="news">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for entry in articles %}
|
||||
<div class="col-md-4 col-sm-6 col-xs-12">
|
||||
<div class="panel panel-default">
|
||||
{% image entry.feed_image fill-345x260 %}
|
||||
<div class="panel-body">
|
||||
<h3><span>{{ entry.trans_title }}</span></h3>
|
||||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
<a href="#" class="btn btn-default btn-xs">Mehr erfahren</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
|
@ -11,11 +11,10 @@
|
|||
<li><a href="#">Projekte und Aktivitäten</a></li>
|
||||
<li><a href="#">Information zu Public Health</a></li>
|
||||
<li><a href="#">Agenda</a></li>
|
||||
<li><a href="#">...</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4" id="contact">
|
||||
<address>
|
||||
<p>Public Health Schweiz<br>
|
||||
Effingerstrasse 54<br>
|
||||
|
@ -48,5 +47,5 @@
|
|||
</footer>
|
||||
|
||||
<div class="copyright">
|
||||
© 2016 Public Health Schweiz
|
||||
© 2017 Public Health Schweiz
|
||||
</div>
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
<div class="container">
|
||||
<div class="nav">
|
||||
<span class="contact-nav">
|
||||
<a class="link" href="#">Kontakt</a>
|
||||
<a href="#"><span class="glyphicon glyphicon-earphone" aria-hidden="true"></span> <span class="hidden-xs">+41 31 389 92 86</span></a>
|
||||
<a href="#"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> <span class="hidden-xs">info@public-health.ch</span></a>
|
||||
<a class="link" href="#contact">Kontakt</a>
|
||||
<a href="tel:+41313899286">
|
||||
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span>
|
||||
<span class="hidden-xs">+41 31 389 92 86</span></a>
|
||||
<a href="mailto:info@public-health.ch">
|
||||
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span>
|
||||
<span class="hidden-xs">info@public-health.ch</span></a>
|
||||
</span>
|
||||
<span class="language-nav">
|
||||
<a class="active "href="#">De</a>
|
||||
<a href="#">Fr</a>
|
||||
<a class="active" href="/de/home">De</a>
|
||||
<a href="/fr/home">Fr</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,7 +27,8 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#"><img src="/static/images/public-health-logo-sign.png" alt=""> <span class="hidden-xs"><strong>Public Health</strong> Schweiz</span></a>
|
||||
<a class="navbar-brand" href="/de/home"><img src="/static/images/public-health-logo-sign.png" alt="[logo]">
|
||||
<span class="hidden-xs"><strong>Public Health</strong> Schweiz</span></a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
|
|
Loading…
Add table
Reference in a new issue