Compare commits
77 commits
10472/expi
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
493626336f | ||
f3ada439fa | |||
|
b3b2a73fc9 | ||
|
df467691b8 | ||
|
2a6434e569 | ||
|
87332a9f05 | ||
|
822fca63c3 | ||
|
9618ac0094 | ||
|
a7abe02784 | ||
|
454767b551 | ||
|
99eb7c39fe | ||
|
780a4ce2d7 | ||
|
31a0a6b060 | ||
|
a68dcb7574 | ||
|
fc6f9e43a7 | ||
|
34ad67e8cd | ||
|
cd99b1bc4f | ||
c5026ad0eb | |||
|
a3cdc6b58a | ||
|
b918903fcf | ||
|
5ba9ee52ea | ||
|
5c173f0ffb | ||
|
c88b94f20f | ||
|
c18fb883cc | ||
|
d24fcd7d86 | ||
|
daf3a6baad | ||
|
b5e786e098 | ||
|
c013387b03 | ||
|
aaf1fc1d9b | ||
|
1af8fe3767 | ||
|
0e0b464534 | ||
|
9863959d88 | ||
|
6e835a10e6 | ||
|
4099b039f5 | ||
|
53ae04404b | ||
|
e4a1cf5a77 | ||
|
fdfebf783e | ||
|
fc03ea5927 | ||
|
713f9ca9e3 | ||
|
0289586811 | ||
|
a7fdf769c4 | ||
|
1513c1a4d9 | ||
|
5ddcf13803 | ||
|
9f621c9c3e | ||
|
bd2de38428 | ||
|
79dbc2aa7f | ||
|
3f46a5c25f | ||
d1eecee951 | |||
|
6818359e1a | ||
|
bdff34cf2b | ||
|
8a87944e10 | ||
2c791e7fbc | |||
d04a6fed60 | |||
|
e056b08609 | ||
|
ed9648d81d | ||
|
df9448e745 | ||
9eaf497430 | |||
|
ae3a7d5ca9 | ||
|
673ad6b924 | ||
|
5f2eedeac9 | ||
3946fff314 | |||
|
8927460dd6 | ||
|
3a1fa6d724 | ||
|
849d539478 | ||
|
ae12f220ec | ||
|
86242dbfb1 | ||
|
08ca710b99 | ||
|
78c3548e23 | ||
|
59356a783f | ||
|
f1aa2ad418 | ||
|
0691476d99 | ||
|
a6a00a33f3 | ||
|
c70b86a54b | ||
|
6fa462dcf6 | ||
|
3ff5f1eb50 | ||
|
57e30e6217 | ||
1abbc707f3 |
23 changed files with 511 additions and 28 deletions
|
@ -1,3 +1,8 @@
|
|||
# Change Log
|
||||
|
||||
Please see [Pull Request history](https://github.com/datalets/public-health-ch/pulls?q=is%3Apr+is%3Aclosed) on GitHub.
|
||||
|
||||
## 2.0.0 - 2022-07-12
|
||||
|
||||
- 10694: Introduce table block to show program details
|
||||
- 10695: Add a header image to the article index template
|
||||
|
|
104
Dockerfile
Normal file
104
Dockerfile
Normal file
|
@ -0,0 +1,104 @@
|
|||
#FROM python:3.10-alpine
|
||||
FROM docker.io/python:3.10-slim AS base
|
||||
|
||||
ENV \
|
||||
LANG=C.UTF-8 \
|
||||
LC_ALL=C.UTF-8 \
|
||||
# python:
|
||||
PYTHONFAULTHANDLER=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONHASHSEED=random \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y --no-install-recommends libmagic-dev libglib2.0-dev libpango-1.0-0 libpangoft2-1.0-0
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl gnupg && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y yarn && \
|
||||
apt-get install -y --no-install-recommends build-essential gcc && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV VIRTUAL_ENV=/venv
|
||||
|
||||
# Use production configuration.
|
||||
ENV DJANGO_SETTINGS_MODULE=publichealth.settings
|
||||
ENV DJANGO_CONFIGURATION=production
|
||||
|
||||
|
||||
### builder image
|
||||
|
||||
FROM base as build
|
||||
|
||||
ENV \
|
||||
# pip:
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100
|
||||
|
||||
RUN python3 -m venv $VIRTUAL_ENV
|
||||
|
||||
RUN mkdir -p /build/static
|
||||
WORKDIR /build
|
||||
|
||||
# Install python dependencies.
|
||||
COPY requirements.txt requirements.txt ./
|
||||
RUN . /venv/bin/activate && pip install -r requirements.txt
|
||||
|
||||
# We will run dumb-init as pid 1.
|
||||
RUN . /venv/bin/activate && pip install dumb-init
|
||||
|
||||
# We will run our app using gunicorn.
|
||||
RUN . /venv/bin/activate && pip install gunicorn
|
||||
|
||||
# Copy local code into to the build image.
|
||||
COPY . /build
|
||||
|
||||
# Copy code required for runtime to the /app folder.
|
||||
RUN mkdir -p /app
|
||||
RUN cp -r publichealth feedler yarn.lock manage.py package.json Gruntfile.js setup_libs.sh /app/
|
||||
|
||||
|
||||
#RUN curl -fsSLO https://deb.nodesource.com/setup_18.x && chmod +x setup_18.x && ./setup_18.x
|
||||
#RUN apt install -y nodejs
|
||||
#RUN npm install -g grunt-cli
|
||||
|
||||
# Collect static data into /app/static.
|
||||
#RUN . /venv/bin/activate && \
|
||||
# DJANGO_STATIC_ROOT=/app/static SECRET_KEY=sl DJANGO_SETTINGS_MODULE=publichealth.settings.production ./manage.py collectstatic --no-input -i media
|
||||
|
||||
#RUN mkdir -p /app/publichealth/static/libs
|
||||
|
||||
#RUN cp -rf node_modules/@bower_components/* /app/publichealth/static/libs
|
||||
|
||||
|
||||
#RUN . /venv/bin/activate && \
|
||||
# DJANGO_STATIC_ROOT=/app/static SECRET_KEY=sl DJANGO_SETTINGS_MODULE=publichealth.settings.production ./manage.py compress --force
|
||||
|
||||
#RUN cp -r /build/static /app/static
|
||||
|
||||
### runtime image
|
||||
|
||||
FROM base as runtime
|
||||
|
||||
#RUN apt-get install -y --no-install-recommends libpango-1.0-0 libpangoft2-1.0-0
|
||||
#RUN apt-get install -y --no-install-recommends procps iproute2 curl
|
||||
|
||||
COPY --from=build /venv /venv
|
||||
COPY --from=build /app /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Ensure exectutables from virtualenv are prefered.
|
||||
ENV PATH="/venv/bin:$PATH"
|
||||
ENTRYPOINT ["/venv/bin/dumb-init", "--", "gunicorn", \
|
||||
"-b [::]:8000", \
|
||||
"--log-file=-", \
|
||||
"--worker-tmp-dir", "/dev/shm", \
|
||||
"--workers=2", "--threads=4", "--worker-class=gthread"]
|
||||
CMD ["publichealth.wsgi"]
|
8
publichealth/home/custom_filters.py
Normal file
8
publichealth/home/custom_filters.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django import template
|
||||
from html import unescape
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def ph_html_decode(value):
|
||||
return unescape(str(value))
|
37
publichealth/home/migrations/0034_auto_20220714_1145.py
Normal file
37
publichealth/home/migrations/0034_auto_20220714_1145.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 3.2.13 on 2022-07-14 09:45
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import wagtail.contrib.table_block.blocks
|
||||
import wagtail.core.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailimages', '0023_add_choose_permissions'),
|
||||
('home', '0033_auto_20220207_0731'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='articleindexpage',
|
||||
name='header_image',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='articleindexpage',
|
||||
name='table_de',
|
||||
field=wagtail.core.fields.StreamField([('table_de', wagtail.contrib.table_block.blocks.TableBlock(template='home/program_table.html'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='articleindexpage',
|
||||
name='table_en',
|
||||
field=wagtail.core.fields.StreamField([('table_en', wagtail.contrib.table_block.blocks.TableBlock(template='home/program_table.html'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='articleindexpage',
|
||||
name='table_fr',
|
||||
field=wagtail.core.fields.StreamField([('table_fr', wagtail.contrib.table_block.blocks.TableBlock(template='home/program_table.html'))], blank=True, null=True),
|
||||
),
|
||||
]
|
32
publichealth/home/migrations/0035_auto_20230515_1447.py
Normal file
32
publichealth/home/migrations/0035_auto_20230515_1447.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-15 12:47
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0034_auto_20220714_1145'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
]
|
36
publichealth/home/migrations/0036_auto_20230515_1556.py
Normal file
36
publichealth/home/migrations/0036_auto_20230515_1556.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-15 13:56
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0035_auto_20230515_1447'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='articlepage',
|
||||
name='html_content',
|
||||
field=wagtail.core.fields.RichTextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
]
|
35
publichealth/home/migrations/0037_auto_20230516_1241.py
Normal file
35
publichealth/home/migrations/0037_auto_20230516_1241.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-16 10:41
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0036_auto_20230515_1556'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='articlepage',
|
||||
name='html_content',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -2,3 +2,4 @@ from .forms import *
|
|||
from .models import *
|
||||
from .snippets import *
|
||||
from .admin import *
|
||||
from .image_formats import *
|
||||
|
|
17
publichealth/home/models/image_formats.py
Normal file
17
publichealth/home/models/image_formats.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# image_formats.py
|
||||
from django.utils.html import format_html
|
||||
from wagtail.images.formats import Format, register_image_format
|
||||
|
||||
|
||||
class OriginalImageFormat(Format):
|
||||
|
||||
def image_to_html(self, image, alt_text, extra_attributes=None):
|
||||
|
||||
default_html = super().image_to_html(image, alt_text, extra_attributes)
|
||||
|
||||
return format_html("{}", default_html, alt_text)
|
||||
|
||||
|
||||
register_image_format(
|
||||
OriginalImageFormat('original_fullwidth', 'Original image', 'bodytext-image', 'original')
|
||||
)
|
|
@ -17,6 +17,7 @@ from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePane
|
|||
from wagtail.images.blocks import ImageChooserBlock
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.search import index
|
||||
from wagtail.contrib.table_block.blocks import TableBlock
|
||||
|
||||
from puput.models import EntryPage, BlogPage
|
||||
from feedler.models import Entry, Stream
|
||||
|
@ -40,6 +41,13 @@ class ArticleIndexPage(Page):
|
|||
'title_en',
|
||||
)
|
||||
|
||||
header_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True, blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
intro_de = RichTextField(default='', blank=True)
|
||||
intro_fr = RichTextField(default='', blank=True)
|
||||
intro_en = RichTextField(default='', blank=True)
|
||||
|
@ -49,6 +57,34 @@ class ArticleIndexPage(Page):
|
|||
'intro_en',
|
||||
)
|
||||
|
||||
table_en = StreamField(
|
||||
[
|
||||
('table_en', TableBlock(template='home/program_table.html'))
|
||||
],
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
table_de = StreamField(
|
||||
[
|
||||
('table_de', TableBlock(template='home/program_table.html'))
|
||||
],
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
table_fr = StreamField(
|
||||
[
|
||||
('table_fr', TableBlock(template='home/program_table.html'))
|
||||
],
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
trans_table = TranslatedField(
|
||||
'table_de',
|
||||
'table_fr',
|
||||
'table_en',
|
||||
)
|
||||
|
||||
subscribe_label_de = models.CharField("Button Label (de)", default='', blank=True, max_length=250)
|
||||
subscribe_label_fr = models.CharField("Button Label (fr)", default='', blank=True, max_length=250)
|
||||
subscribe_label_en = models.CharField("Button Label (en)", default='', blank=True, max_length=250)
|
||||
|
@ -73,6 +109,10 @@ class ArticleIndexPage(Page):
|
|||
FieldPanel('intro_fr'),
|
||||
FieldPanel('title_en'),
|
||||
FieldPanel('intro_en'),
|
||||
ImageChooserPanel('header_image'),
|
||||
FieldPanel('table_en'),
|
||||
FieldPanel('table_fr'),
|
||||
FieldPanel('table_de'),
|
||||
ImageChooserPanel('feed_image'),
|
||||
MultiFieldPanel(
|
||||
[
|
||||
|
@ -145,7 +185,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
body_fr = StreamField([
|
||||
('paragraph', RichTextBlock()),
|
||||
|
@ -153,7 +194,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
body_en = StreamField([
|
||||
('paragraph', RichTextBlock()),
|
||||
|
@ -161,7 +203,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
trans_body = TranslatedField(
|
||||
'body_de',
|
||||
|
|
|
@ -16,7 +16,18 @@
|
|||
</section>
|
||||
|
||||
{% else %}
|
||||
{% if page.header_image %}
|
||||
{% image page.header_image fill-1908x400 as img %}
|
||||
<div id="carousel-banner" class="slide">
|
||||
<div class="carousel-inner slick slick-initialized slick-slider" role="listbox">
|
||||
|
||||
<div class="slick-list draggable" tabindex="0"><div class="slick-track" style="opacity: 1; width: 1908px;"><div class="item slick-slide slick-active" data-slick-index="0" style="width: 1908px; position: relative; left: 0px; top: 0px; z-index: 900; opacity: 1;">
|
||||
<img style="background-image:url({{img.url}})">
|
||||
</div></div></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<section id="article-index" class="article-index-page">
|
||||
<div class="container">
|
||||
<h2>{{ page.trans_title }}</h2>
|
||||
|
@ -34,6 +45,14 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- Table content -->
|
||||
<div class="article-table table-program" role="main">
|
||||
{% for block in page.trans_table %}
|
||||
{% if block.block_type == 'table_en' or block.block_type == 'table_fr' or block.block_type == 'table_de' %}
|
||||
{% include_block block %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
{% load wagtailcore_tags wagtailimages_tags custom_filters %}
|
||||
|
||||
{% if page.feed_image %}
|
||||
<div class="image">
|
||||
|
@ -23,6 +23,10 @@
|
|||
{% if block.value == 'gallery' %}
|
||||
{% include 'home/photo_gallery.html' %}
|
||||
{% endif %}
|
||||
{% elif block.block_type == 'iframe' %}
|
||||
{% autoescape off %}
|
||||
{{ block.value|richtext|ph_html_decode}}
|
||||
{% endautoescape %}
|
||||
{% elif block.block_type != 'info' %}
|
||||
<p class="block-{{ block.block_type }}">
|
||||
{% include_block block %}
|
||||
|
|
53
publichealth/home/templates/home/program_table.html
Normal file
53
publichealth/home/templates/home/program_table.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<style>
|
||||
.table-program td, th {
|
||||
padding: 0 10px !important;
|
||||
}
|
||||
</style>
|
||||
<table class="table-program">
|
||||
{% if table_header %}
|
||||
<thead>
|
||||
<tr>
|
||||
{% for column in table_header %}
|
||||
<th>
|
||||
{% if column.strip %}
|
||||
{% if html_renderer %}
|
||||
{{ column.strip|safe|linebreaksbr }}
|
||||
{% else %}
|
||||
{{ column.strip|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% endif %}
|
||||
<tbody>
|
||||
{% for row in data %}
|
||||
<tr>
|
||||
{% for column in row %}
|
||||
{% if first_col_is_header and forloop.first %}
|
||||
<th>
|
||||
{% if column.strip %}
|
||||
{% if html_renderer %}
|
||||
{{ column.strip|safe|linebreaksbr }}
|
||||
{% else %}
|
||||
{{ column.strip|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% else %}
|
||||
<td>
|
||||
{% if column.strip %}
|
||||
{% if html_renderer %}
|
||||
{{ column.strip|safe|linebreaksbr }}
|
||||
{% else %}
|
||||
{{ column.strip|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
|
@ -3,6 +3,6 @@
|
|||
<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|title }}</a></li>
|
||||
<li><a href="{% pageurl child %}">{{ child.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django import template
|
||||
from django.utils import translation
|
||||
from django.db.models import Case, When
|
||||
|
||||
from wagtail.core.models import Site, Page
|
||||
from ..models.forms import ContactForm
|
||||
|
@ -54,19 +55,20 @@ def top_menu(context, parent, calling_page=None):
|
|||
menuitems = parent.get_children().live().in_menu().specific()
|
||||
for menuitem in menuitems:
|
||||
menuitem.show_dropdown = has_menu_children(menuitem)
|
||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||
if calling_page else False)
|
||||
try:
|
||||
menuitem.title = menuitem.trans_title
|
||||
except AttributeError:
|
||||
pass
|
||||
if calling_page:
|
||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||
if calling_page else False)
|
||||
try:
|
||||
menuitem.title = menuitem.trans_title
|
||||
except AttributeError:
|
||||
pass
|
||||
return {
|
||||
'calling_page': calling_page,
|
||||
'menuitems': menuitems,
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
def menuitems_children(parent):
|
||||
def menuitems_children(parent, context=None):
|
||||
remove_mitglied = False
|
||||
remove_devenez = False
|
||||
if 'Qui sommes-nous' in parent.title:
|
||||
|
@ -77,20 +79,45 @@ def menuitems_children(parent):
|
|||
items_to_remove = []
|
||||
for menuitem in menuitems_children:
|
||||
try:
|
||||
if type(menuitem) == ContactForm:
|
||||
menuitem.title = menuitem.title.title()
|
||||
else:
|
||||
menuitem.title = menuitem.trans_title
|
||||
if 'devenez' in menuitem.title.lower() and remove_devenez:
|
||||
items_to_remove.append(menuitem)
|
||||
elif 'mitglied werden' in menuitem.title.lower() and remove_mitglied:
|
||||
items_to_remove.append(menuitem)
|
||||
except AttributeError:
|
||||
menuitem.title = menuitem.trans_title
|
||||
except AttributeError as ae:
|
||||
pass
|
||||
for item in items_to_remove:
|
||||
menuitems_children = menuitems_children & Page.objects.not_page(item)
|
||||
if context:
|
||||
request = context['request']
|
||||
site = Site.find_for_request(request)
|
||||
if site.hostname in ['sphc.ch', 'public-health.ch']:
|
||||
# custom page here is the terms and conditions page for public-health.ch and sphc.ch (common)
|
||||
if request.__dict__.get('LANGUAGE_CODE', 'de').lower() == 'en':
|
||||
custom_page_id = 1020
|
||||
else:
|
||||
custom_page_id = 994
|
||||
custom_page = Page.objects.get(id=custom_page_id)
|
||||
menuitems_children = add_item_to_page_queryset(menuitems_children, custom_page)
|
||||
for menuitem in menuitems_children:
|
||||
try:
|
||||
menuitem.title = menuitem.trans_title
|
||||
except AttributeError as aee:
|
||||
pass
|
||||
return menuitems_children
|
||||
|
||||
def add_item_to_page_queryset(queryset, custom_page):
|
||||
# Convert queryset to a list
|
||||
pages_list = list(queryset)
|
||||
# Add the custom page to the list
|
||||
pages_list.append(custom_page)
|
||||
# Create a new ordered queryset based on the list order
|
||||
page_ids = [page.id for page in pages_list]
|
||||
preserved_order = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(page_ids)])
|
||||
new_queryset = Page.objects.filter(id__in=page_ids).order_by(preserved_order).specific()
|
||||
return new_queryset
|
||||
|
||||
|
||||
# Retrieves the children of the top menu items for the drop downs
|
||||
@register.inclusion_tag('tags/top_menu_children.html', takes_context=True)
|
||||
def top_menu_children(context, parent):
|
||||
|
@ -105,6 +132,6 @@ def top_menu_children(context, parent):
|
|||
def footer_menu(context, parent, calling_page=None):
|
||||
return {
|
||||
'calling_page': calling_page,
|
||||
'menuitems': menuitems_children(parent),
|
||||
'menuitems': menuitems_children(parent, context),
|
||||
'request': context['request'],
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ INSTALLED_APPS = [
|
|||
'wagtail.contrib.redirects',
|
||||
'wagtail.contrib.search_promotions',
|
||||
"wagtail.contrib.legacy.richtext",
|
||||
'wagtail.contrib.table_block',
|
||||
|
||||
'wagtail.embeds',
|
||||
'wagtail.sites',
|
||||
|
@ -108,6 +109,9 @@ TEMPLATES = [
|
|||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
'libraries': {
|
||||
'custom_filters': 'publichealth.home.custom_filters',
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
import dj_database_url
|
||||
|
||||
from logging.handlers import RotatingFileHandler
|
||||
from .base import *
|
||||
|
||||
# Do not set SECRET_KEY, Postgres or LDAP password or any other sensitive data here.
|
||||
|
@ -149,10 +152,19 @@ LOGGING = {
|
|||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler',
|
||||
},
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': sys.stdout,
|
||||
'formatter': 'simple',
|
||||
},
|
||||
},
|
||||
'formatters': {
|
||||
'default': {
|
||||
'verbose': '[%(asctime)s] (%(process)d/%(thread)d) %(name)s %(levelname)s: %(message)s'
|
||||
},
|
||||
'simple': {
|
||||
'verbose': '[%(asctime)s] (%(process)d/%(thread)d) %(name)s %(levelname)s: %(message)s'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
|
@ -194,7 +206,7 @@ if 'LOG_DIR' in env:
|
|||
# Public Health Schweiz log
|
||||
LOGGING['handlers']['publichealth_file'] = {
|
||||
'level': 'INFO',
|
||||
'class': 'cloghandler.ConcurrentRotatingFileHandler',
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(env['LOG_DIR'], 'publichealth.log'),
|
||||
'maxBytes': 5242880, # 5MB
|
||||
'backupCount': 5
|
||||
|
@ -204,7 +216,7 @@ if 'LOG_DIR' in env:
|
|||
# Wagtail log
|
||||
LOGGING['handlers']['wagtail_file'] = {
|
||||
'level': 'WARNING',
|
||||
'class': 'cloghandler.ConcurrentRotatingFileHandler',
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(env['LOG_DIR'], 'wagtail.log'),
|
||||
'maxBytes': 5242880, # 5MB
|
||||
'backupCount': 5
|
||||
|
@ -214,7 +226,7 @@ if 'LOG_DIR' in env:
|
|||
# Error log
|
||||
LOGGING['handlers']['errors_file'] = {
|
||||
'level': 'ERROR',
|
||||
'class': 'cloghandler.ConcurrentRotatingFileHandler',
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(env['LOG_DIR'], 'error.log'),
|
||||
'maxBytes': 5242880, # 5MB
|
||||
'backupCount': 5
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// Language menu hack, until this is configurable
|
||||
nav .language-nav a[lang='en'] { display: inline; }
|
||||
|
||||
#footer, .contact-nav .link { display: none; }
|
||||
//#footer, .contact-nav .link { display: none; }
|
||||
|
||||
a.navbar-brand {
|
||||
height: 60px;
|
||||
|
@ -49,6 +49,7 @@
|
|||
html[lang='fr'] .site-ngo-allianz-ebk .navbar-brand {
|
||||
background-image: url('/static/org/NGO-Allianz_Logo-fr.jpg');
|
||||
}
|
||||
|
||||
// -site-ngo-allianz-ebk
|
||||
|
||||
// Custom styles for gesundheitsmanifest.ch
|
||||
|
@ -61,3 +62,18 @@ html[lang='fr'] .site-ngo-allianz-ebk .navbar-brand {
|
|||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.site-dev-pro-salutech {
|
||||
.navbar-brand {
|
||||
width: 240px;
|
||||
height: 64px;
|
||||
background-size: contain !important;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('/static/images/pro-salute-logo.png');
|
||||
|
||||
font-size: 0px !important;
|
||||
img { display: none !important; }
|
||||
}
|
||||
#carousel-banner .carousel-caption { display: none; }
|
||||
}
|
||||
|
||||
|
|
BIN
publichealth/static/images/favicon-prosalute.ico
Normal file
BIN
publichealth/static/images/favicon-prosalute.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -32,7 +32,7 @@
|
|||
|
||||
<div class="copyright">
|
||||
{% contact_name the_site=the_site %}
|
||||
© 2020
|
||||
© 2022
|
||||
• <a href="https://public-health.ch/privacy/">Privacy</a>
|
||||
• <a href="https://public-health.ch/impressum/">Impressum</a>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
{% get_site_root as site_root %}
|
||||
{% get_site as the_site %}
|
||||
|
||||
|
||||
<style>
|
||||
</style>
|
||||
<nav class="navbar-pre navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="nav">
|
||||
|
@ -27,9 +30,16 @@
|
|||
<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]">
|
||||
<span class="hidden-xs">{% contact_name the_site=the_site %}</span></a>
|
||||
|
||||
<a class="navbar-brand" href="{% pageurl site_root %}">
|
||||
|
||||
{% if the_site|default:""|truncatechars:"255" == "dev.pro-salute.ch"%}
|
||||
<img src="{% static 'images/pro-salute-logo.png' %}" alt="Pro Salute Logo">
|
||||
{% else %}
|
||||
<img src="{% static 'images/public-health-logo-sign.png' %}" alt="[logo]">
|
||||
{% endif %}
|
||||
|
||||
<span class="hidden-xs">{% contact_name the_site=the_site %}</span></a>
|
||||
</div>
|
||||
|
||||
{% block menu %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Updated: 21.07.2021
|
||||
# Updated: 22.05.2024
|
||||
|
||||
# Core
|
||||
wagtail==2.15.1
|
||||
|
@ -30,5 +30,7 @@ Pillow==8.4.0
|
|||
gunicorn
|
||||
whitenoise
|
||||
python-dotenv
|
||||
ConcurrentLogHandler
|
||||
#ConcurrentLogHandler
|
||||
unidecode
|
||||
|
||||
django-configurations
|
||||
|
|
18
setup_libs.sh
Executable file
18
setup_libs.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /app
|
||||
rm -rf node_modules
|
||||
yarn install
|
||||
mkdir -p /app/publichealth/static/libs
|
||||
echo "created /app/publichealth/static/libs contents "
|
||||
ls /app/publichealth/static/libs
|
||||
cp -rf node_modules/@bower_components/* /app/publichealth/static/libs/
|
||||
|
||||
# static resources
|
||||
python manage.py collectstatic --no-input -i media --settings=publichealth.settings.production
|
||||
python manage.py compress --force --settings=publichealth.settings.production
|
||||
|
||||
if [ -d /app/static ]; then
|
||||
echo "Copying"
|
||||
cp -a /app/static /pod
|
||||
fi
|
Loading…
Reference in a new issue