Merged theme-initial into master

This commit is contained in:
Oleg Lavrovsky 2017-02-21 20:39:36 +01:00
commit ae45e472f7
7 changed files with 288 additions and 55 deletions

View file

@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-21 16:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0016_deprecate_rendition_filter_relation'),
('wagtailcore', '0032_add_bulk_delete_page_permission'),
('home', '0003_auto_20161209_0655'),
]
operations = [
migrations.CreateModel(
name='ArticleIndexPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(default='', max_length=255)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='ArticlePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(default='', max_length=255)),
('date', models.DateField(verbose_name='Date')),
('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)),
('feed_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='ArticleRelatedLink',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('name', models.CharField(max_length=255)),
('url', models.URLField()),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_links', to='home.ArticlePage')),
],
options={
'abstract': False,
'ordering': ['sort_order'],
},
),
migrations.RemoveField(
model_name='homepage',
name='body_de',
),
migrations.RemoveField(
model_name='homepage',
name='body_fr',
),
migrations.RemoveField(
model_name='homepage',
name='title_fr',
),
migrations.AddField(
model_name='homepage',
name='intro_de',
field=wagtail.wagtailcore.fields.RichTextField(default=''),
),
migrations.AddField(
model_name='homepage',
name='intro_fr',
field=wagtail.wagtailcore.fields.RichTextField(default=''),
),
]

View file

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-21 16:48
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('home', '0004_auto_20170221_1728'),
]
operations = [
migrations.AddField(
model_name='homepage',
name='body_de',
field=wagtail.wagtailcore.fields.RichTextField(default=''),
),
migrations.AddField(
model_name='homepage',
name='body_fr',
field=wagtail.wagtailcore.fields.RichTextField(default=''),
),
migrations.AddField(
model_name='homepage',
name='infos_de',
field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock())))),), blank=True, null=True),
),
migrations.AddField(
model_name='homepage',
name='infos_fr',
field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock())))),), blank=True, null=True),
),
]

View file

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-21 17:11
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('home', '0005_auto_20170221_1748'),
]
operations = [
migrations.AlterField(
model_name='homepage',
name='infos_de',
field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock()), ('action', wagtail.wagtailcore.blocks.CharBlock(required=True))))),), blank=True, null=True),
),
migrations.AlterField(
model_name='homepage',
name='infos_fr',
field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock()), ('action', wagtail.wagtailcore.blocks.CharBlock(required=True))))),), blank=True, null=True),
),
]

View file

@ -1,18 +1,41 @@
from __future__ import unicode_literals
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore import blocks
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.fields import StreamField, RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel, MultiFieldPanel
from wagtail.wagtailimages.blocks import ImageChooserBlock
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsearch import index
from .util import TranslatedField
class HomePage(Page):
class ArticleIndexPage(Page):
title_fr = models.CharField(max_length=255, default="")
translated_title = TranslatedField(
'title',
'title_fr',
)
content_panels = Page.content_panels + [
FieldPanel('title_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()
return context
class ArticlePage(Page):
title_fr = models.CharField(max_length=255, default="")
translated_title = TranslatedField(
'title',
'title_fr',
)
date = models.DateField("Date")
body_de = StreamField([
('heading', blocks.CharBlock(classname="full title")),
@ -24,22 +47,87 @@ class HomePage(Page):
('paragraph', blocks.RichTextBlock()),
('image', ImageChooserBlock()),
], null=True, blank=True)
translated_title = TranslatedField(
'title',
'title_fr',
)
body = TranslatedField(
'body_de',
'body_fr',
)
feed_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
search_fields = Page.search_fields + [
index.SearchField('body_de'),
index.SearchField('body_fr'),
index.SearchField('title'),
index.SearchField('title_fr'),
index.FilterField('date'),
]
content_panels = Page.content_panels + [
FieldPanel('title_fr'),
FieldPanel('date'),
StreamFieldPanel('body_de'),
StreamFieldPanel('body_fr'),
InlinePanel('related_links', label="Related links"),
]
promote_panels = [
MultiFieldPanel(Page.promote_panels, "Common page configuration"),
ImageChooserPanel('feed_image'),
]
parent_page_types = ['home.ArticleIndexPage']
subpage_types = []
class ArticleRelatedLink(Orderable):
page = ParentalKey(ArticlePage, related_name='related_links')
name = models.CharField(max_length=255)
url = models.URLField()
panels = [
FieldPanel('name'),
FieldPanel('url'),
]
class InfoBlock(blocks.StructBlock):
title = blocks.CharBlock(required=True)
photo = ImageChooserBlock()
summary = blocks.RichTextBlock()
action = blocks.CharBlock(required=True)
url = models.URLField()
class HomePage(Page):
intro_de = RichTextField(default='')
intro_fr = RichTextField(default='')
intro = TranslatedField(
'intro_de',
'intro_fr',
)
body_de = RichTextField(default='')
body_fr = RichTextField(default='')
body = TranslatedField(
'body_de',
'body_fr',
)
infos_de = StreamField([
('info', InfoBlock())
], null=True, blank=True)
infos_fr = StreamField([
('info', InfoBlock())
], null=True, blank=True)
infos = TranslatedField(
'infos_de',
'infos_fr',
)
content_panels = Page.content_panels + [
FieldPanel('intro_de', classname="full"),
FieldPanel('intro_fr', classname="full"),
FieldPanel('body_de', classname="full"),
FieldPanel('body_fr', classname="full"),
StreamFieldPanel('infos_de'),
StreamFieldPanel('infos_fr'),
]

View file

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
{% block content %}
<h1>{{ page.translated_title }}</h1>
<small>{{ page.date }}</small>
{% include_block feed_image %}
<!-- Main content -->
<div class="container" role="main">
{% for block in page.body %}
{% if block.block_type == 'heading' %}
<h2>{{ block.value }}</h2>
{% else %}
<section class="block-{{ block.block_type }}">
{% include_block block %}
</section>
{% endif %}
{% endfor %}
</div>
{% endblock %}

View file

@ -1,3 +1,5 @@
{% load wagtailcore_tags %}
<!-- Banner -->
<div id="carousel-banner" class="slide">
@ -44,8 +46,9 @@
<section id="banner">
<div class="container">
<footer class="container">
<p class="lead">Public Health Schweiz ist die unabhängige, nationale Organisation, die die Anliegen der Public-Health-Fachleute vertritt, ein themen- und disziplinenübergreifendes gesamtschweizerisches Netzwerk in Public Health bietet, sich für optimale Rahmenbedingungen
für die Gesundheit der Bevölkerung in der Schweiz engagiert und Entscheidungsträgerinnen und Entscheidungsträger fachlich unterstützt. Public Health Schweiz stützt ihr Handeln auf wissenschaftlicher Basis ab.</p>
<p class="lead">
{{ page.intro|richtext }}
</p>
</footer>
</div>
</section><!-- /banner -->

View file

@ -11,15 +11,9 @@
<section>
<div class="container">
<div class="">
<h2>Informationen zu Public Health</h2>
<p>Hier finden Sie Links zu wichtigen Institutionen und Organisationen aus dem Public Health Bereich. Die Liste erhebt keinen Anspruch auf Vollständigkeit. Gerne nehmen wir Ihre Anregungen und Ergänzungsvorschläge entgegen.</p>
<a href="#" class="btn btn-default">Mehr erfahren</a>
<div class="homepage-body">
{{ page.body|richtext }}
</div>
<center style="margin-top:2em">
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/hashtag/publichealth" data-widget-id="831771377740967937">#publichealth Tweets</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</center>
</div>
</section>
@ -27,60 +21,30 @@
<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 round">
<img src="/static/images/ipad.jpg" alt="Pic 01" />
<img src="{{ block.photo }}" />
</div>
<header>
<h3>Über uns</h3>
<h3>{{ block.title }}</h3>
</header>
<p>Werden Sie jetzt Mitglied von Public Health Schweiz und profitieren Sie von vielen Vorteilen und Vergünstigungen. Als Mitglied tragen Sie zudem dazu bei, dass sich Public Health Schweiz weiterhin für die Anliegen der Public-Health-Fachleute einsetzen
kann.</p>
{{ block.summary|richtext }}
<footer>
<a href="#" class="btn btn-default">Mitglied werden</a>
<a href="{{ block.url }}" class="btn btn-default">{{ block.action }}</a>
</footer>
</article>
<article class="col-md-4">
<div class="image round">
<img src="/static/images/konf.jpg" alt="Pic 02" />
</div>
<header>
<h3>Veranstaltungen</h3>
</header>
<p>An unseren Konferenzen und Symposien können Sie erfahren, wie sich die entsprechenden Versorgungsstrukturen in der Schweiz vorbereiten können und welche Erfahrungen und Best-Practice-Beispiele bereits vorliegen.</p>
<footer>
<a href="#" class="btn btn-default">Kommende Symposien</a>
</footer>
</article>
<article class="col-md-4">
<div class="image round">
<img src="/static/images/steth.jpg" alt="Pic 02" />
</div>
<header>
<h3>Projekte und Aktivitäten</h3>
</header>
<p>Public Health Schweiz will Prävention und Gesundheitsförderung stärken. Durch unsere Aktionen und Stellungsnahmen treten wir für dieses Ziel ein und stehen damit immer im Zentrum der Aktualität.</p>
<footer>
<a href="#" class="btn btn-default">Unterstützen</a>
</footer>
</article>
</div>
{% endif %}
</div>
</div>
</section>
<!-- Main content -->
<div class="container" role="main">
{% for block in page.body %}
{% if block.block_type == 'heading' %}
<h2>{{ block.value }}</h2>
{% else %}
<section class="block-{{ block.block_type }}">
{% include_block block %}
</section>
{% endif %}
{% endfor %}
</div>