Merge pull request #1 from datalets/alpha-revision-loleg
Alpha revision loleg
This commit is contained in:
commit
c60dfaa76a
6 changed files with 116 additions and 30 deletions
|
@ -31,7 +31,13 @@ You will be asked a few questions to create an administrator account.
|
|||
|
||||
**Frontend setup**
|
||||
|
||||
Make sure a recent version of node.js is installed, then:
|
||||
You will need to have Ruby and SASS installed on your system, e.g.:
|
||||
|
||||
```
|
||||
sudo yum install rubygem-sass
|
||||
```
|
||||
|
||||
Make sure a recent version of node.js, then:
|
||||
|
||||
```
|
||||
npm install -g bower grunt-cli
|
||||
|
|
38
publichealth/home/migrations/0012_auto_20170419_1749.py
Normal file
38
publichealth/home/migrations/0012_auto_20170419_1749.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-04-19 15:49
|
||||
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', '0011_auto_20170412_1256'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.wagtailcore.fields.StreamField((('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False)))))), blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.wagtailcore.fields.StreamField((('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False)))))), blank=True, null=True),
|
||||
),
|
||||
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(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False))))),), 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(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False))))),), blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -17,6 +17,13 @@ from puput.models import EntryPage
|
|||
|
||||
from ..util import TranslatedField
|
||||
|
||||
class InfoBlock(blocks.StructBlock):
|
||||
title = blocks.CharBlock(required=True)
|
||||
photo = ImageChooserBlock(required=True)
|
||||
summary = blocks.RichTextBlock(required=True)
|
||||
action = blocks.CharBlock(required=False)
|
||||
url = blocks.URLBlock(required=False)
|
||||
|
||||
class ArticleIndexPage(Page):
|
||||
title_fr = models.CharField(max_length=255, default="")
|
||||
trans_title = TranslatedField(
|
||||
|
@ -41,9 +48,15 @@ class ArticleIndexPage(Page):
|
|||
context = super(ArticleIndexPage, self).get_context(request)
|
||||
articles = ArticlePage.objects.child_of(self).live()
|
||||
context['articles'] = articles
|
||||
subcategories = ArticleIndexPage.objects.child_of(self).live()
|
||||
context['subcategories'] = subcategories
|
||||
return context
|
||||
|
||||
subpage_types = ['home.ArticlePage', 'home.ArticleIndexPage', 'home.ContactForm']
|
||||
subpage_types = [
|
||||
'home.ArticlePage',
|
||||
'home.ArticleIndexPage',
|
||||
'home.ContactForm'
|
||||
]
|
||||
class Meta:
|
||||
verbose_name = "Rubrik"
|
||||
|
||||
|
@ -65,11 +78,13 @@ class ArticlePage(Page):
|
|||
('paragraph', blocks.RichTextBlock()),
|
||||
('image', ImageChooserBlock()),
|
||||
('section', blocks.CharBlock(classname="full title")),
|
||||
('info', InfoBlock()),
|
||||
], null=True, blank=True)
|
||||
body_fr = StreamField([
|
||||
('paragraph', blocks.RichTextBlock()),
|
||||
('image', ImageChooserBlock()),
|
||||
('section', blocks.CharBlock(classname="full title")),
|
||||
('info', InfoBlock()),
|
||||
], null=True, blank=True)
|
||||
trans_body = TranslatedField(
|
||||
'body_de',
|
||||
|
@ -131,14 +146,7 @@ class ArticleRelatedLink(Orderable):
|
|||
FieldPanel('name'),
|
||||
FieldPanel('url'),
|
||||
]
|
||||
|
||||
class InfoBlock(blocks.StructBlock):
|
||||
title = blocks.CharBlock(required=True)
|
||||
photo = ImageChooserBlock()
|
||||
summary = blocks.RichTextBlock(required=True)
|
||||
action = blocks.CharBlock()
|
||||
url = blocks.URLBlock()
|
||||
|
||||
|
||||
class HomePage(Page):
|
||||
intro_de = RichTextField(default='')
|
||||
intro_fr = RichTextField(default='')
|
||||
|
|
|
@ -6,24 +6,35 @@
|
|||
{% block content %}
|
||||
<section id="article-index">
|
||||
<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 articles %}
|
||||
<div class="item">
|
||||
<div class="article-caption">
|
||||
<h3><a href="{% pageurl entry %}">{{ entry.trans_title }}</a></h3>
|
||||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
___
|
||||
{% endfor %}
|
||||
|
||||
<div class="article-body" role="main">
|
||||
{% for entry in articles %}
|
||||
<div class="item">
|
||||
<div class="article-caption">
|
||||
<h3><a href="{% pageurl entry %}">{{ entry.trans_title }}</a></h3>
|
||||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
|
||||
{% if subcategories %}
|
||||
<section id="three" class="article-subcategories" class="wrapper align-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for block in subcategories %}
|
||||
<article class="col-md-4">
|
||||
<header><a href="{% pageurl block %}">
|
||||
<h3>{{ block.trans_title }}</h3>
|
||||
</a></header>
|
||||
{{ block.trans_intro|richtext }}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
{% image page.feed_image fill-940x400 class="img-responsive" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<h2>{{ page.trans_title }}</h2>
|
||||
|
||||
|
||||
<p class="lead">{{ page.trans_intro|richtext }}</p>
|
||||
|
||||
{% if page.date %}
|
||||
|
@ -26,13 +26,36 @@
|
|||
{% for block in page.trans_body %}
|
||||
{% if block.block_type == 'heading' %}
|
||||
<h3>{{ block.value }}</h3>
|
||||
{% else %}
|
||||
{% elif block.block_type != 'info' %}
|
||||
<p class="block-{{ block.block_type }}">
|
||||
{% include_block block %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Infoblocks -->
|
||||
<div class="row">
|
||||
{% for block in page.trans_body %}
|
||||
{% if block.block_type == 'info' %}
|
||||
<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 }}
|
||||
{% if block.value.action %}
|
||||
<footer>
|
||||
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
|
||||
</footer>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Core
|
||||
wagtail==1.9
|
||||
Django==1.10.6
|
||||
Django==1.10.7
|
||||
|
||||
# Database
|
||||
psycopg2==2.7.1
|
||||
|
@ -20,7 +20,7 @@ django-redis==4.7.0
|
|||
# Frontend
|
||||
django-libsass==0.7
|
||||
libsass==0.12.3
|
||||
Pillow==4.0.0
|
||||
Pillow==4.1.0
|
||||
|
||||
# Development tools
|
||||
stellar==0.4.3
|
||||
|
|
Loading…
Add table
Reference in a new issue