commit
066c3e60a4
22 changed files with 442 additions and 237 deletions
8
Makefile
8
Makefile
|
@ -69,14 +69,18 @@ django-shell:
|
|||
logs:
|
||||
docker-compose logs -f --tail=500
|
||||
|
||||
backup:
|
||||
docker-compose start postgres
|
||||
backup-data:
|
||||
docker-compose exec web ./manage.py dumpdata --natural-foreign -e auth.permission -e contenttypes -e wagtailcore.GroupCollectionPermission -e wagtailimages.rendition -e sessions -e feedler.feedlysettings > ~/publichealth.home.json
|
||||
zip ~/publichealth.home.json.`date +"%d%m%Y-%H%M"`.zip ~/publichealth.home.json
|
||||
rm ~/publichealth.home.json
|
||||
|
||||
backup-images:
|
||||
echo "Backing up images ..."
|
||||
sudo chown -R ansible media
|
||||
zip -ruq ~/media.zip media
|
||||
|
||||
backup: backup-data backup-images
|
||||
|
||||
django-loaddata:
|
||||
gunzip ~/publichealth.home.json.gz
|
||||
docker-compose exec web ./manage.py loaddata ~/publichealth.home.json
|
||||
|
|
|
@ -21,3 +21,9 @@ django_secret_key: "{{ vault_django_secret_key }}"
|
|||
|
||||
# Default: postgres://postgres:@postgres:5432/postgres
|
||||
django_postgres_url: "{{ vault_django_postgres_url }}"
|
||||
|
||||
# Default: http://elasticsearch:9200
|
||||
django_elasticsearch_url: "{{ vault_django_elasticsearch_url }}"
|
||||
|
||||
# Default: redis://redis:6379
|
||||
django_redis_url: "{{ vault_django_redis_url }}"
|
||||
|
|
|
@ -1,32 +1,46 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
39613133383630663164333437633037383936663266623861313565663964346232643666653332
|
||||
6165666665373661643663323337656163373631366135620a663164653335333166333865383139
|
||||
34633364623536663564363536333737316638353266316261393530386330633963336233346336
|
||||
6336383237646233630a656337626566373165313264386438636230646438353131623663666236
|
||||
62633739623431656535383166343862646133396630306264636563643536373562363163316135
|
||||
38373966323162653330316135333333643637323732663530336432383066316636303231653534
|
||||
37333765313830646662663761376266386262323437373230333231616162393961396162383732
|
||||
62633431343062316365316361343432373261623439656533393331383735646639646662653133
|
||||
36303039383339353961336664343436653066626561393761383733656664663939333233396134
|
||||
63393361396334666330376362643732326266336263393730623464333436336436313639613635
|
||||
64646237333739373137356262373666356631356632323466383363356366366366666330646230
|
||||
63386232663430386139393864626333326331323031313231346630326133353137373565326538
|
||||
36633032653637316531353131653235613331333436316365316661313835373563646534353239
|
||||
38623338373365623066613832623836626135326235623538396538366663306365666135633264
|
||||
34306464663230616538343539653663326339333437303762323066343933326634633530653565
|
||||
34663963353562363132396338623435646165393431303364623834636266373164663933633339
|
||||
32346536363330303539373461376631613863656366646437343165633464623064396231346137
|
||||
30643261346465303137306161613036336339326530306162393165363766353839316262363263
|
||||
38303236633436323830356461653234666534646363336463313064386230663763323632313563
|
||||
35396233363933333463326333633737333962353830336135386339613564343237363932306362
|
||||
31333535376630363739653433663865366566356132633032666562653234373938633031323139
|
||||
61306539376464666664316461303966613231646136623937643965326139303461616366333631
|
||||
39323638633661623064623334333864633235646131353237663361343839303537306261656131
|
||||
66656331316264636261643165643861376330633035386165626166313133376538656166353136
|
||||
31303433633134323532646132386130616431383065363832326533653535663763623733353764
|
||||
63383061653062353263383739643366363763363635663165353761623832366139643065396565
|
||||
31363435613761623538383237346431613335346437616538643462316665656337343832633937
|
||||
33663266663163306461626462626132613961626238333538666233613934346631346231363833
|
||||
36633138656563643262393764663331333237386164626230383562396663336564663134356632
|
||||
39386137343662666166326131363633353536326130396361376138363132363861313832303262
|
||||
326364356331366330393435346330373561
|
||||
31623061306338643731643236656264313365323238383734373466653131336263653365396337
|
||||
3864346638623236343833646264393366666230396662300a623038333531393836356163623731
|
||||
38633239636431653935633763316639383562366332346531316632616666346532326239313933
|
||||
6135323639373465300a343438306338653633633465363938363865333530343663383838653738
|
||||
62663439333565343565666434646438346566633933333863303361373166616339626630623930
|
||||
66646162353034623439653262386130656564613962373234633234346138386132323362323839
|
||||
66656533333537303165336634346666306436626236343561343336343135346665666539643232
|
||||
65613166373464373035373666646533316365383931623966353939393765343062306230363963
|
||||
34306538383064336137313034633764316130653536353035323030326533633431633866646463
|
||||
39376234373437313334386465623837613362666337326562396364626332356463313165653661
|
||||
32333266396261306565333061323138646531376639666264353366633033646366396634623863
|
||||
61653030353061656666326561613736356461363032333937623362363734656466323032303661
|
||||
35633635353638613632653639643232313932353232386531353737663436396531396334313837
|
||||
63633333393632356166656266643165373238333237363930333132643962636263346466366130
|
||||
62343731353939336330316363613238363136366436343732353762626263663736383863356365
|
||||
61343361303933346239323165353365626431623938326464396438316332633563663465653337
|
||||
63323862393063633965383932393930326266323237643839366231666166636265623637346264
|
||||
66326662363735373638343561643239626265643630356239653536623930313564316636303130
|
||||
65383661633130323138323330633161386138646564306636643835666333316535636665626464
|
||||
37663531646130376564346261363064323434373864663939353835376262346130393338303833
|
||||
63626539633332383930373862316237363966363566383735383162396165363662363764366530
|
||||
34646135353534306237393233383764376330313234323364363834623438363537386331343934
|
||||
63343464353862616339326565626134353661353134306431326666643635383165633964353936
|
||||
30646437616436363539346433646463666535303530653533653062376633306332366237373434
|
||||
32303964633532336430343662373731356365326366383431616631373132636136653539323037
|
||||
64366334386637623436316161613535636130363162363264663033623531633932623462343331
|
||||
31343232333064623063326666323038663839643439353166346366663934353565653433366362
|
||||
33363432383533663263663761633762366633363563623237636636386337626338653238386533
|
||||
33326632646562386134343138663937346464643733616339316162653566323865643633376537
|
||||
36343636396263353037316631333933313739316135343766666432373633363166373866333632
|
||||
62623734653863303566643331303462363137346233636130333830323333323863356538356139
|
||||
37303231663966623034323138666664326236626439383638666664363531303433636662666561
|
||||
39626265323136313037383164646636653265373832663931356237343138396638376135346636
|
||||
66666536616135386666666464303539616135333064636135346430383431303037393036353435
|
||||
65306131333532663038306136303930636661373764343736383364303266356330333661386635
|
||||
34666539636239656637353131333330346563386334306535643230353439623762343932303361
|
||||
65353163346535396563383862653963326261386531363934356266653461313437633661313035
|
||||
33643766613366643065663637663733363563663633393238623633653664386630376637643464
|
||||
61316135633961636337303735656365356437653730373965343933333433386132633061363064
|
||||
37376337356262613136633431343461333237333063623834616165643637366362393137373339
|
||||
37363430393939663734303364343064666533653363656633303966613334356363316436326438
|
||||
30336236343731656566656631323737346630363538663361303734613738303462366238386563
|
||||
31623135633062666566346561386438663031383232376562623533656437333665376439653932
|
||||
66373134303762356238323962343339386161333038353038393936306434643739396464323532
|
||||
3236
|
||||
|
|
|
@ -5,39 +5,39 @@ web:
|
|||
volumes:
|
||||
- ./:/usr/src/app
|
||||
- {{ django_log_dir }}:/var/log/wagtail
|
||||
links:
|
||||
- redis
|
||||
- postgres
|
||||
- elasticsearch
|
||||
#links:
|
||||
# - redis
|
||||
# - postgres
|
||||
# - elasticsearch
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- DJANGO_SETTINGS_MODULE={{ django_project_name }}.settings.production
|
||||
- ALLOWED_HOSTS=www.{{ allowed_domains|join(',www.') }},{{ allowed_domains }},{{ ipv4_addresses|join(':5000,') }}
|
||||
- ALLOWED_HOSTS=www.{{ allowed_domains|join(',www.') }},{{ allowed_domains|join(',') }},{{ ipv4_addresses|join(':5000,') }}
|
||||
- SECRET_KEY={{ django_secret_key }}
|
||||
- MAILGUN_KEY={{ django_email_key }}
|
||||
- MAILGUN_DOMAIN={{ django_email_domain }}
|
||||
- MAILGUN_FROM={{ django_email_from }}
|
||||
- DATABASE_URL={{ django_postgres_url }}
|
||||
- ELASTICSEARCH_URL=http://elasticsearch:9200
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- REDIS_URL={{ django_redis_url }}
|
||||
- ELASTICSEARCH_URL={{ django_elasticsearch_url }}
|
||||
- LOG_DIR=/var/log/wagtail
|
||||
redis:
|
||||
image: redis
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- {{ redis_data_dir }}:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
postgres:
|
||||
image: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
elasticsearch:
|
||||
image: elasticsearch:5
|
||||
ports:
|
||||
- "9200:9200"
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
mem_limit: 1g
|
||||
# elasticsearch:
|
||||
# image: elasticsearch:5
|
||||
# ports:
|
||||
# - "9200:9200"
|
||||
# environment:
|
||||
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
# mem_limit: 1g
|
||||
# redis:
|
||||
# image: redis
|
||||
# command: ["redis-server", "--appendonly", "yes"]
|
||||
# restart: on-failure
|
||||
# volumes:
|
||||
# - {{ redis_data_dir }}:/data
|
||||
# ports:
|
||||
# - "6379:6379"
|
||||
# postgres:
|
||||
# image: postgres
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
|
|
|
@ -6,21 +6,14 @@ upstream wagtail-site {
|
|||
server localhost:5000;
|
||||
}
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
proxy_pass http://wagtail-site;
|
||||
}
|
||||
listen 80 default_server;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
server_name _;
|
||||
|
||||
listen 443 ssl default_server;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/certs/public-health.ch/cloudflare.pem;
|
||||
ssl_certificate_key /etc/certs/public-health.ch/cloudflare.key;
|
||||
|
@ -39,7 +32,7 @@ server {
|
|||
access_log off; expires 36000;
|
||||
alias {{ release_dir }}/static/;
|
||||
add_header Cache-Control "public";
|
||||
add_header Access-Control-Allow-Origin https://{{ domain }};
|
||||
add_header Access-Control-Allow-Origin *; #https://{{ domain }};
|
||||
}
|
||||
|
||||
# Set a longer expiry for CACHE/, because the filenames are unique.
|
||||
|
@ -54,18 +47,30 @@ server {
|
|||
alias {{ release_dir }}/static/images/favicon.ico;
|
||||
}
|
||||
|
||||
# Only serve /media/images by default, not e.g. original_images/.
|
||||
location /media/images {
|
||||
alias {{ release_dir }}/media/images;
|
||||
access_log off; expires max;
|
||||
# Directly serve media with max caching
|
||||
location /media {
|
||||
root {{ release_dir }};
|
||||
autoindex off;
|
||||
access_log off;
|
||||
expires max;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
# Only serve media by default, not e.g. original_images/.
|
||||
#location ~* ^/media {
|
||||
# alias {{ release_dir }}/media;
|
||||
#}
|
||||
|
||||
# Disable English home page (for now)
|
||||
if ($host = 'public-health.ch') {
|
||||
if ($host !~* 'sphc.ch') {
|
||||
rewrite ^/en/$ $scheme://$host/de/;
|
||||
}
|
||||
|
||||
# Redirect French home page as appropriate
|
||||
if ($host = 'manifestesante.ch') {
|
||||
rewrite ^/$ $scheme://$host/fr/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
|
31
feedler/management/commands/invalidpage.py
Normal file
31
feedler/management/commands/invalidpage.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import Client
|
||||
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.admin.views.pages import edit
|
||||
|
||||
# Scans for broken editors, via
|
||||
# https://github.com/wagtail/wagtail/issues/4602
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
def handle(self, **options):
|
||||
invalid_page_ids = []
|
||||
pages = Page.objects.all()
|
||||
client = Client()
|
||||
# use any existing super user account
|
||||
user = User.objects.get(username='oleg')
|
||||
client.force_login(user)
|
||||
|
||||
for page in pages:
|
||||
id = page.id
|
||||
# print statement to assure the script is running
|
||||
print(id)
|
||||
url = f'/cms/pages/{id}/edit/'
|
||||
try:
|
||||
response = client.get(url)
|
||||
except:
|
||||
invalid_pages.append(id)
|
||||
|
||||
print(invalid_page_ids)
|
25
publichealth/home/migrations/0027_auto_20191017_1715.py
Normal file
25
publichealth/home/migrations/0027_auto_20191017_1715.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 2.1.12 on 2019-10-17 15:15
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailimages', '0001_squashed_0021'),
|
||||
('home', '0026_auto_20190625_1521'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contact',
|
||||
name='color',
|
||||
field=models.CharField(blank=True, default='', max_length=40),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='contact',
|
||||
name='logo',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
|
||||
),
|
||||
]
|
18
publichealth/home/migrations/0028_contact_style.py
Normal file
18
publichealth/home/migrations/0028_contact_style.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.1.13 on 2019-10-21 18:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0027_auto_20191017_1715'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contact',
|
||||
name='style',
|
||||
field=models.TextField(blank=True, default=''),
|
||||
),
|
||||
]
|
|
@ -7,6 +7,7 @@ from django.db import models
|
|||
from wagtail.snippets.models import register_snippet
|
||||
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
|
||||
|
||||
from .forms import ContactForm
|
||||
|
@ -63,11 +64,21 @@ class Contact(models.Model):
|
|||
'title_fr',
|
||||
'title_en',
|
||||
)
|
||||
|
||||
address = models.TextField(default="", blank=True)
|
||||
phone = models.CharField(max_length=40, blank=True, default="")
|
||||
email = models.EmailField(max_length=100, blank=True, default="")
|
||||
www = models.URLField(null=True, blank=True)
|
||||
|
||||
style = models.TextField(default="", blank=True)
|
||||
color = models.CharField(max_length=40, blank=True, default="")
|
||||
logo = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True, blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
map_url = models.URLField(null=True, blank=True,
|
||||
help_text="Optional link of address to mapping provider")
|
||||
analytics = models.CharField(max_length=60, default="", blank=True,
|
||||
|
@ -95,6 +106,9 @@ class Contact(models.Model):
|
|||
FieldPanel('phone'),
|
||||
FieldPanel('email'),
|
||||
FieldPanel('www'),
|
||||
ImageChooserPanel('logo'),
|
||||
FieldPanel('color'),
|
||||
FieldPanel('style'),
|
||||
FieldPanel('map_url'),
|
||||
FieldPanel('analytics'),
|
||||
PageChooserPanel('contact_form', 'home.ContactForm'),
|
||||
|
|
|
@ -24,9 +24,17 @@
|
|||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="{{ blog_page.title }}" />
|
||||
<meta name="twitter:description" content="{{ blog_page.description }}" />
|
||||
|
||||
<link rel="alternate" type="application/rss+xml"
|
||||
title="{{ blog_page.title }}" href="{% feeds_url blog_page %}">
|
||||
|
||||
{% endblock social_share %}
|
||||
|
||||
{% block blog_content %}
|
||||
<section id="blog">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
{% with per_page=blog_page.num_entries_page %}
|
||||
{# 'paginate' tag cannot render dotted variables, so we need to create a context var #}
|
||||
{% paginate per_page entries %}
|
||||
|
@ -44,44 +52,39 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<article class="box page-content blog_grid">
|
||||
<section>
|
||||
{% if entry.header_image %}
|
||||
<span class="img-responsive"><a href="{{ post_url }}">
|
||||
{% image entry.header_image fill-800x240 as header_image %}
|
||||
<img alt="{{ entry.header_image.title }}" src="{{ header_image.url }}">
|
||||
</a></span>
|
||||
{% endif %}
|
||||
<!--{% include 'puput/entry_links.html' %}-->
|
||||
</section>
|
||||
<section class="article">
|
||||
<h4><a href="{{ post_url }}">{{ entry.title }}</a></h4>
|
||||
{% if entry.excerpt %}
|
||||
{{ entry.excerpt|richtext }}
|
||||
{% else %}
|
||||
{{ entry.body|richtext|truncatewords_html:70 }}
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<ul class="social-share col-md-9">
|
||||
<li class="social-item">
|
||||
{% post_to_facebook post_url '<span><i class="fa fa-facebook"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_twitter entry.title post_url '<span><i class="fa fa-twitter"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_linkendin post_url '<span><i class="fa fa-linkedin"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_gplus post_url '<span><i class="fa fa-google-plus"></i></span>' %}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="col-md-3">
|
||||
<a class="blog_btn continue" href="{{ post_url }}">/{{ entry.slug|truncatechars:25 }} »</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
{% if forloop.counter0|divisibleby:3 %}
|
||||
</div><div class="row">
|
||||
{% endif %}
|
||||
|
||||
<!-- Blog post {{ entry.id }} -->
|
||||
<div class="col-md-4 blog-entry">
|
||||
<a href="{{ post_url }}">
|
||||
<div class="panel panel-default">
|
||||
{% if entry.header_image %}
|
||||
{% image entry.header_image fill-360x270 %}
|
||||
{% endif %}
|
||||
<div class="panel-body">
|
||||
{% for category in entry.categories.all %}
|
||||
<div class="entry-category">{{ category.name }}</div>
|
||||
{% endfor %}
|
||||
|
||||
<h3 class="entry-title">{{ entry.title }}</h3>
|
||||
|
||||
<p>
|
||||
{% if entry.excerpt %}
|
||||
{{ entry.excerpt|safe }}
|
||||
{% else %}
|
||||
{{ entry.body|striptags|truncatewords_html:40 }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<span class="entry-meta">
|
||||
{{ entry.date|date:"d.m.Y" }}
|
||||
</span>
|
||||
</div><!-- -/panel-body -->
|
||||
</div><!-- -/panel -->
|
||||
</a>
|
||||
</div><!-- /blog-entry -->
|
||||
{% empty %}
|
||||
<span>{% trans 'No results found.' %}</span>
|
||||
{% endfor %}
|
||||
|
@ -89,5 +92,15 @@
|
|||
<div class="pagination">
|
||||
{% show_paginator %}
|
||||
</div>
|
||||
|
||||
<div class="rss-sitemap">
|
||||
<a href="{% feeds_url blog_page %}" target="_blank" title="RSS">
|
||||
<i class="fa fa-rss-square"></i> <span>RSS</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endwith %}
|
||||
|
||||
</div><!-- /row -->
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
{% endblock blog_content %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "puput/base.html" %}
|
||||
{% load i18n wagtailcore_tags wagtailimages_tags puput_tags social_share %}
|
||||
{% load i18n wagtailcore_tags wagtailimages_tags puput_tags wagtailroutablepage_tags social_share %}
|
||||
|
||||
{% block title %}
|
||||
{{ self.title }} | {{ blog_page.title }}
|
||||
|
@ -43,47 +43,70 @@
|
|||
|
||||
{% block blog_content %}
|
||||
|
||||
<div class="entry-categories">
|
||||
{% categories_list self.categories %}
|
||||
</div>
|
||||
|
||||
<h1 class="title">{{ self.title }}</h1>
|
||||
|
||||
<ul class="links">
|
||||
<li>
|
||||
{{ self.date|date:"d.m.Y" }}
|
||||
</li>
|
||||
{% if self.tags.count > 0 %}
|
||||
<li>
|
||||
<i class="fa fa-tag"></i>
|
||||
{% tags_list blog_page.num_tags_entry_header self.tags %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if blog_page.display_comments %}
|
||||
<li>
|
||||
<i class="fa fa-comments"></i>
|
||||
{{ self.num_comments }}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<p class="excerpt">
|
||||
{{ self.excerpt|safe }}
|
||||
</p>
|
||||
|
||||
{% if self.header_image %}
|
||||
<div class="image">
|
||||
{% image self.header_image fill-940x400 class="img-responsive" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="title">{{ self.title }}</h1>
|
||||
|
||||
<article class="box page-content"
|
||||
{% if self.id %}data-entry-page-update-comments-url="{% url 'entry_page_update_comments' self.id %}{% endif %}">
|
||||
{% include 'puput/entry_links.html' with entry=self %}
|
||||
<section>
|
||||
{{ self.body|richtext}}
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<a href="{% pageurl blog_page %}" class="blog_btn back">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
<i class="fa fa-angle-left"></i>
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% entry_url self blog_page as post_url %}
|
||||
<ul class="social-share-all text-right col-md-10">
|
||||
<li class="social-item">
|
||||
{% post_to_facebook post_url '<span><i class="fa fa-facebook"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_twitter self.title post_url '<span><i class="fa fa-twitter"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_linkendin post_url '<span><i class="fa fa-linkedin"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_gplus post_url '<span><i class="fa fa-google-plus"></i></span>' %}
|
||||
</li>
|
||||
</ul>
|
||||
<article class="box page-content"
|
||||
{% if self.id %}data-entry-page-update-comments-url="{% url 'entry_page_update_comments' self.id %}{% endif %}">
|
||||
<section>
|
||||
{{ self.body|richtext}}
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<a href="{% pageurl blog_page %}" class="blog_btn back">
|
||||
<i class="fa fa-home"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% entry_url self blog_page as post_url %}
|
||||
<ul class="social-share-all text-right col-md-10">
|
||||
<li class="social-item">
|
||||
{% post_to_facebook post_url '<span><i class="fa fa-facebook"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_twitter self.title post_url '<span><i class="fa fa-twitter"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_linkendin post_url '<span><i class="fa fa-linkedin"></i></span>' %}
|
||||
</li>
|
||||
<li class="social-item">
|
||||
{% post_to_gplus post_url '<span><i class="fa fa-google-plus"></i></span>' %}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
{% show_comments %}
|
||||
</article>
|
||||
</section>
|
||||
{% show_comments %}
|
||||
</article>
|
||||
{% endblock blog_content %}
|
||||
|
||||
{% block extra_content %}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% load wagtailimages_tags %}
|
||||
|
||||
<address>
|
||||
<p>
|
||||
{% if contact.map_url %}
|
||||
|
@ -19,6 +21,25 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<style type="text/css">
|
||||
{{ contact.style }}
|
||||
{% if contact.color %}
|
||||
footer#footer, .navbar-pre {
|
||||
background-color: {{ contact.color }};
|
||||
}
|
||||
{% endif %}
|
||||
{% if contact.logo %}
|
||||
{% image contact.logo original as contact_logo %}
|
||||
.navbar-brand {
|
||||
background-size: contain !important;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('{{ contact_logo.url }}');
|
||||
padding-left: 80px;
|
||||
}
|
||||
.navbar-brand img { display: none !important; }
|
||||
{% endif %}
|
||||
</style>
|
||||
|
||||
{% if contact.is_google_analytics %}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ contact.analytics }}"></script>
|
||||
|
|
|
@ -6,23 +6,22 @@ from ..models.snippets import Contact, SocialContact
|
|||
|
||||
register = template.Library()
|
||||
|
||||
def get_contacts(site_root):
|
||||
if not site_root: return {}
|
||||
site = site_root.get_site()
|
||||
def get_contacts(the_site):
|
||||
if not the_site: return {}
|
||||
|
||||
# Selected or default contact snippet
|
||||
top_contact = Contact.objects.filter(home_site=site)
|
||||
top_contact = Contact.objects.filter(home_site=the_site)
|
||||
if top_contact.exists():
|
||||
top_contact = top_contact.last()
|
||||
top_contact = top_contact.first()
|
||||
else:
|
||||
default_contact = Contact.objects.filter(home_site=None)
|
||||
if default_contact.exists():
|
||||
top_contact = default_contact.last()
|
||||
top_contact = default_contact.first()
|
||||
else:
|
||||
top_contact = Contact.objects.last()
|
||||
top_contact = Contact.objects.first()
|
||||
|
||||
# Selected or default social contact snippet
|
||||
social_contacts = SocialContact.objects.filter(home_site=site)
|
||||
social_contacts = SocialContact.objects.filter(home_site=the_site)
|
||||
if social_contacts.exists():
|
||||
social_contacts = social_contacts.all()
|
||||
else:
|
||||
|
@ -38,24 +37,24 @@ def get_contacts(site_root):
|
|||
|
||||
# Contact information (footer)
|
||||
@register.inclusion_tag('tags/contact_info.html')
|
||||
def contact_info(site_root):
|
||||
return get_contacts(site_root)
|
||||
def contact_info(the_site):
|
||||
return get_contacts(the_site)
|
||||
|
||||
# Contact form (footer)
|
||||
@register.inclusion_tag('tags/footer_form.html')
|
||||
def footer_form(site_root):
|
||||
cc = get_contacts(site_root)
|
||||
def footer_form(the_site):
|
||||
cc = get_contacts(the_site)
|
||||
if cc['contact']:
|
||||
return { 'form': cc['contact'].contact_form }
|
||||
return None
|
||||
|
||||
# Contact links (header)
|
||||
@register.inclusion_tag('tags/contact_links.html')
|
||||
def contact_links(site_root):
|
||||
return get_contacts(site_root)
|
||||
def contact_links(the_site):
|
||||
return get_contacts(the_site)
|
||||
|
||||
# Styled contact name (header)
|
||||
@register.inclusion_tag('tags/contact_name.html')
|
||||
def contact_name(site_root, html=True):
|
||||
contactname = get_contacts(site_root)['contact']
|
||||
def contact_name(the_site, html=True):
|
||||
contactname = get_contacts(the_site)['contact']
|
||||
return { 'contact': contactname, 'html': html }
|
||||
|
|
|
@ -33,11 +33,15 @@ def language_switcher(context):
|
|||
'request': context['request'],
|
||||
}
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def get_site(context):
|
||||
return context['request'].site
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def get_site_root(context):
|
||||
# NB this returns a core.Page, not the implementation-specific model used
|
||||
# so object-comparison to self will return false as objects would differ
|
||||
return context['request'].site.root_page
|
||||
return get_site(context).root_page
|
||||
|
||||
def has_menu_children(page):
|
||||
return page.get_children().live().in_menu().exists()
|
||||
|
|
|
@ -43,7 +43,7 @@ INSTALLED_APPS = [
|
|||
'wagtail.contrib.forms',
|
||||
'wagtail.contrib.redirects',
|
||||
'wagtail.contrib.search_promotions',
|
||||
|
||||
|
||||
'wagtail.embeds',
|
||||
'wagtail.sites',
|
||||
'wagtail.users',
|
||||
|
@ -198,6 +198,12 @@ COMPRESS_PRECOMPILERS = [
|
|||
|
||||
WAGTAIL_SITE_NAME = "Public Health Schweiz"
|
||||
|
||||
WAGTAILADMIN_RICH_TEXT_EDITORS = {
|
||||
'default': {
|
||||
'WIDGET': 'wagtail.admin.rich_text.HalloRichTextArea'
|
||||
}
|
||||
}
|
||||
|
||||
# Puput settings
|
||||
|
||||
PUPUT_AS_PLUGIN = True
|
||||
|
|
|
@ -56,35 +56,74 @@ $slider-nav: 200px;
|
|||
.language-nav a[lang='en'] { display: none; }
|
||||
|
||||
// Disable metas and override blog styles
|
||||
.blog-page .sidebar .meta { display: none; }
|
||||
.blog-page section { padding: 0; }
|
||||
.blog-page .blog-tags ul { padding: 0; }
|
||||
.blog-page ul.sidebar { background: transparent; }
|
||||
.blog-page .searchTerm {
|
||||
.blog-page {
|
||||
padding-top: 1em;
|
||||
|
||||
.sidebar .meta { display: none; }
|
||||
ul.sidebar { background: transparent; }
|
||||
|
||||
section { padding: 0; }
|
||||
.blog-tags ul { padding: 0; }
|
||||
|
||||
.searchTerm {
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
// background: #fff;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.searchDescription {
|
||||
// background: #fff;
|
||||
margin-bottom: 20px;
|
||||
padding: 0 20px 20px;
|
||||
line-height: normal;
|
||||
color: #555;
|
||||
}
|
||||
.social-item {
|
||||
font-size: 70%;
|
||||
background: #2643A9 !important;
|
||||
}
|
||||
|
||||
h1.title {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
ul.links {
|
||||
margin: 0; padding: 0;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.blog-entry {
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
.panel img {
|
||||
width: 100%; height: auto;
|
||||
}
|
||||
.entry-category, .entry-meta {
|
||||
font-size: 80%;
|
||||
color: #777;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
}
|
||||
.blog-header {
|
||||
a {
|
||||
color: white !important;
|
||||
text-shadow: 1px 1px 2px black;
|
||||
text-decoration: none;
|
||||
}
|
||||
.lead {
|
||||
color: white;
|
||||
font-size: 100%;
|
||||
}
|
||||
}
|
||||
.blog .entry-categories {
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
background: #fff;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.blog-page .searchDescription {
|
||||
background: #fff;
|
||||
margin-bottom: 20px;
|
||||
padding: 0 20px 20px;
|
||||
line-height: normal;
|
||||
color: #555;
|
||||
}
|
||||
.blog-page .social-item {
|
||||
font-size: 70%;
|
||||
background: #2643A9 !important;
|
||||
}
|
||||
.blog-header a {
|
||||
color: white !important;
|
||||
text-shadow: 1px 1px 2px black;
|
||||
text-decoration: none;
|
||||
}
|
||||
.blog-header .lead {
|
||||
color: white;
|
||||
font-size: 100%;
|
||||
a { color: #555; font-weight: bold; }
|
||||
li { list-style: none; margin: 0; padding: 0; }
|
||||
ul { list-style: none; margin: 0; padding: 1em 0 0; }
|
||||
}
|
||||
|
||||
@import "subsites";
|
||||
|
|
|
@ -149,7 +149,5 @@
|
|||
padding: 1em;
|
||||
margin: 0em;
|
||||
list-style-type: none;
|
||||
|
||||
li:first-child { display: none; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// TODO: delete this file and references to it once styles are migrated.
|
||||
|
||||
// Only show news on the main home page
|
||||
#news { display: none; }
|
||||
.site-home #news { display: block; }
|
||||
|
@ -20,25 +22,6 @@
|
|||
|
||||
#carousel-banner .carousel-caption > * { display: none; }
|
||||
#carousel-banner .carousel-caption { display: none; }
|
||||
|
||||
/*
|
||||
#carousel-banner .carousel-caption {
|
||||
width: 13em;
|
||||
background: rgba(0,0,50,0.4);
|
||||
border: 6px solid white;
|
||||
font-size: 155%;
|
||||
padding: 1em 1em;
|
||||
left: 50%;
|
||||
margin-left: -6.5em;
|
||||
bottom: 2em;
|
||||
}
|
||||
#carousel-banner .carousel-caption:before {
|
||||
content: 'SPHC 2018'; display: block;
|
||||
}
|
||||
#carousel-banner .carousel-caption:after {
|
||||
content: 'Better Health Faster';
|
||||
}
|
||||
*/
|
||||
}
|
||||
// -site-sphc
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
{% load compress static wagtailuserbar navigation information %}
|
||||
{% get_site_root as site_root %}
|
||||
{% get_site as the_site %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{% language_cur %}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{% if page.trans_title %}{{ page.trans_title }} - {% endif %}{% contact_name site_root=site_root html=False %}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %}</title>
|
||||
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{% if page.trans_title %}{{ page.trans_title }} - {% endif %}{% contact_name the_site=the_site html=False %}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="{% block description %}{% endblock %}">
|
||||
|
||||
|
@ -29,13 +30,13 @@
|
|||
|
||||
{% include 'footer.html' %}
|
||||
|
||||
{% block extra_js %}
|
||||
<script src="{% static 'libs/jquery/dist/jquery.js' %}"></script>
|
||||
<script src="{% static 'libs/bootstrap-sass/assets/javascripts/bootstrap.min.js' %}"></script>
|
||||
<script src="{% static 'libs/slick-carousel/slick/slick.min.js' %}"></script>
|
||||
<script src="{% static 'libs/slick-lightbox/dist/slick-lightbox.js' %}"></script>
|
||||
<script src="{% static 'libs/cookieconsent/build/cookieconsent.min.js' %}"></script>
|
||||
{% endblock %}
|
||||
<script src="{% static 'libs/jquery/dist/jquery.js' %}"></script>
|
||||
<script src="{% static 'libs/bootstrap-sass/assets/javascripts/bootstrap.min.js' %}"></script>
|
||||
<script src="{% static 'libs/slick-carousel/slick/slick.min.js' %}"></script>
|
||||
<script src="{% static 'libs/slick-lightbox/dist/slick-lightbox.js' %}"></script>
|
||||
<script src="{% static 'libs/cookieconsent/build/cookieconsent.min.js' %}"></script>
|
||||
|
||||
{% block extra_js %}{% endblock %}
|
||||
|
||||
{% compress js %}
|
||||
<script type="text/javascript" src="{% static 'js/main.js' %}"></script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load static wagtailcore_tags navigation information %}
|
||||
{% get_site_root as site_root %}
|
||||
{% get_site as the_site %}
|
||||
|
||||
<!-- Footer -->
|
||||
<footer id="footer">
|
||||
|
@ -20,18 +20,18 @@
|
|||
|
||||
<a name="contact-info"></a>
|
||||
<div class="col-md-4" id="contact-info">
|
||||
{% contact_info site_root=site_root %}
|
||||
{% contact_info the_site=the_site %}
|
||||
</div>
|
||||
<div class="col-md-4" id="contact-form">
|
||||
{% footer_form site_root=site_root %}
|
||||
{% footer_form the_site=the_site %}
|
||||
</div>
|
||||
</div><!-- /row -->
|
||||
</div><!-- /container -->
|
||||
</footer>
|
||||
|
||||
<div class="copyright">
|
||||
{% contact_name site_root=site_root %}
|
||||
© 2019
|
||||
{% contact_name the_site=the_site %}
|
||||
© 2020
|
||||
• <a href="/privacy/">Privacy</a>
|
||||
• <a href="/impressum/">Impressum</a>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% load static wagtailcore_tags navigation information %}
|
||||
{% get_site_root as site_root %}
|
||||
{% get_site as the_site %}
|
||||
|
||||
<nav class="navbar-pre navbar-fixed-top">
|
||||
<div class="container">
|
||||
|
@ -9,7 +10,7 @@
|
|||
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
|
||||
<span class="sr-only">Contact</span>
|
||||
</a>
|
||||
{% contact_links site_root=site_root %}
|
||||
{% contact_links the_site=the_site %}
|
||||
</span>
|
||||
<span class="language-nav">
|
||||
{% language_switcher %}
|
||||
|
@ -28,7 +29,7 @@
|
|||
</button>
|
||||
<a class="navbar-brand" href="{% pageurl site_root %}">
|
||||
<img src="{% static 'images/public-health-logo-sign.png' %}" alt="[logo]">
|
||||
<span class="hidden-xs">{% contact_name site_root=site_root %}</span></a>
|
||||
<span class="hidden-xs">{% contact_name the_site=the_site %}</span></a>
|
||||
</div>
|
||||
|
||||
{% block menu %}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Updated: 9.9.2019
|
||||
# Updated: 21.10.2019
|
||||
|
||||
# Core
|
||||
wagtail==2.6.1
|
||||
Django==2.1.12
|
||||
wagtail==2.6.2
|
||||
Django==2.1.13
|
||||
elasticsearch>=5.0.0,<6.0.0
|
||||
|
||||
# Database
|
||||
psycopg2-binary==2.8.3
|
||||
psycopg2-binary==2.8.4
|
||||
dj-database-url==0.5.0
|
||||
|
||||
# Content
|
||||
|
@ -22,15 +22,15 @@ django-el-pagination==3.2.4
|
|||
django-libsass==0.7
|
||||
django-social-share==1.3.2
|
||||
libsass==0.19.2
|
||||
Pillow==6.1.0
|
||||
Pillow==6.2.1
|
||||
|
||||
# Development tools
|
||||
stellar==0.4.5
|
||||
|
||||
# Production dependencies
|
||||
gunicorn==19.9.0
|
||||
whitenoise==4.1.3
|
||||
whitenoise==4.1.4
|
||||
ConcurrentLogHandler==0.9.1
|
||||
django-anymail==7.0.0
|
||||
django-crispy-forms==1.7.2
|
||||
django-crispy-forms==1.8.0
|
||||
python-dotenv==0.10.3
|
||||
|
|
Loading…
Reference in a new issue