Compare commits

...

29 Commits

Author SHA1 Message Date
PCoder 79dbc2aa7f Remove title case in template 2022-10-28 19:45:46 +02:00
PCoder 3f46a5c25f Remove title case for menuitem title 2022-10-27 21:12:34 +05:30
pcoder116 d1eecee951 Merge pull request 'Introduce Original image format' (#6) from original-image-format into master
Reviewed-on: #6
2022-07-28 15:19:02 +00:00
PCoder 6818359e1a Remove unwanted code 2022-07-28 20:36:01 +05:30
PCoder bdff34cf2b Introduce Original image format 2022-07-28 20:19:00 +05:30
app 8a87944e10 Update year in the footer 2022-07-21 14:53:51 +00:00
pcoder116 2c791e7fbc Merge pull request 'Remove styles to hide footer for sphc.ch' (#5) from 10751-add-footer-to-sphc into master
Reviewed-on: #5
2022-07-19 12:55:36 +00:00
pcoder116 d04a6fed60 Merge branch 'master' into 10751-add-footer-to-sphc 2022-07-19 12:54:48 +00:00
PCoder e056b08609 Remove styles to hide footer for sphc.ch 2022-07-19 14:53:30 +02:00
app ed9648d81d Add migration 2022-07-14 09:47:21 +00:00
PCoder df9448e745 Update Changelog 2022-07-12 12:21:49 +05:30
pcoder116 9eaf497430 Merge pull request 'WIP 10694-table-block' (#3) from 10694-table-block into master
Reviewed-on: #3
2022-07-12 06:45:54 +00:00
PCoder ae3a7d5ca9 Revert back changes to main.scss 2022-07-12 12:14:03 +05:30
PCoder 673ad6b924 Remove unwanted code 2022-07-12 12:11:17 +05:30
PCoder 5f2eedeac9 Merge branch 'master' into 10694-table-block 2022-07-12 12:06:53 +05:30
pcoder116 3946fff314 Merge pull request '10695-header-image' (#4) from 10695-header-image into master
Reviewed-on: #4
2022-07-12 06:32:58 +00:00
PCoder 8927460dd6 Fix accessing the header image's url 2022-07-11 15:04:51 +02:00
PCoder 3a1fa6d724 Use proper field for image 2022-07-11 18:18:55 +05:30
PCoder 849d539478 Add header_image to Article Index Page 2022-07-11 18:12:57 +05:30
PCoder ae12f220ec Use program_table template for all language tables 2022-07-11 17:35:12 +05:30
PCoder 86242dbfb1 Add missing comma 2022-07-11 17:19:11 +05:30
PCoder 08ca710b99 Put styles into template for the moment 2022-07-11 17:16:20 +05:30
PCoder 78c3548e23 Use correct template path 2022-07-11 13:36:14 +02:00
PCoder 59356a783f Add program_table.html template 2022-07-11 16:51:55 +05:30
PCoder f1aa2ad418 Use custom table template 2022-07-11 16:51:25 +05:30
PCoder 0691476d99 Cleanup unused code + format 2022-07-11 16:45:46 +05:30
PCoder a6a00a33f3 Attempt classname for table 2022-07-11 16:21:11 +05:30
PCoder c70b86a54b Revert back change in page_content 2022-07-11 16:16:57 +05:30
PCoder 6fa462dcf6 Minimal table style 2022-07-11 16:09:50 +05:30
12 changed files with 145 additions and 47 deletions

View File

@ -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

View 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),
),
]

View File

@ -2,3 +2,4 @@ from .forms import *
from .models import *
from .snippets import *
from .admin import *
from .image_formats import *

View 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')
)

View File

@ -41,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)
@ -50,32 +57,28 @@ class ArticleIndexPage(Page):
'intro_en',
)
table_en = StreamField(
[
('table_en', TableBlock())
('table_en', TableBlock(template='home/program_table.html'))
],
null=True,
blank = True,
blank=True,
)
table_de = StreamField(
[
('table_de', TableBlock())
('table_de', TableBlock(template='home/program_table.html'))
],
null=True,
blank = True,
blank=True,
)
table_fr = StreamField(
[
('table_fr', TableBlock())
('table_fr', TableBlock(template='home/program_table.html'))
],
null=True,
blank = True,
blank=True,
)
#table_en = TableBlock()
#table_fr = TableBlock()
#table_de = TableBlock()
trans_table = TranslatedField(
'table_de',
'table_fr',
@ -106,6 +109,7 @@ class ArticleIndexPage(Page):
FieldPanel('intro_fr'),
FieldPanel('title_en'),
FieldPanel('intro_en'),
ImageChooserPanel('header_image'),
FieldPanel('table_en'),
FieldPanel('table_fr'),
FieldPanel('table_de'),
@ -204,14 +208,6 @@ class ArticlePage(Page):
'body_fr',
'body_en',
)
table_en = TableBlock()
table_fr = TableBlock()
table_de = TableBlock()
trans_table = TranslatedField(
'table_en',
'table_fr',
'table_de',
)
date = models.DateField("Date", null=True, blank=True)
@ -305,15 +301,6 @@ class HomePage(Page):
'body_en',
)
#table_en = TableBlock()
#table_fr = TableBlock()
#table_de = TableBlock()
#trans_table = TranslatedField(
# 'table_en',
# 'table_fr',
# 'table_de',
#)
infos_de = StreamField([
('info', InfoBlock())
], null=True, blank=True)
@ -328,27 +315,24 @@ class HomePage(Page):
'infos_fr',
'infos_en',
)
# content_table = StreamField(TableBlock(), verbose_name=_('Content Table'), blank=True)
content_panels = Page.content_panels + [
MultiFieldPanel([
FieldPanel('intro_de', classname="full"),
FieldPanel('body_de', classname="full"),
StreamFieldPanel('infos_de'),
#StreamFieldPanel('table_de'),
], heading="Deutsch",
classname="collapsible collapsed"),
MultiFieldPanel([
FieldPanel('intro_fr', classname="full"),
FieldPanel('body_fr', classname="full"),
StreamFieldPanel('infos_fr'),
#StreamFieldPanel('table_fr'),
], heading="Français",
classname="collapsible collapsed"),
MultiFieldPanel([
FieldPanel('intro_en', classname="full"),
FieldPanel('body_en', classname="full"),
StreamFieldPanel('infos_en'),
#StreamFieldPanel('table_fr'),
], heading="English",
classname="collapsible collapsed"),
]

View File

@ -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>
@ -35,7 +46,7 @@
{% endfor %}
</div>
<!-- Table content -->
<div class="article-table" role="main">
<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 %}

View File

@ -27,19 +27,9 @@
<p class="block-{{ block.block_type }}">
{% include_block block %}
</p>
{% endfor %}
</div>
<h1>Mmmm</h1>
<!-- Table content -->
<div class="article-table" role="main">
{% for block in page.trans_table %}
{% if block.block_type == 'table' %}
Inside if
{% include_block block %}
{% endif %}
{% endfor %}
</div>
<!-- Infoblocks -->
<div class="row infoblocks">

View 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>

View File

@ -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>

View File

@ -78,7 +78,7 @@ def menuitems_children(parent):
for menuitem in menuitems_children:
try:
if type(menuitem) == ContactForm:
menuitem.title = menuitem.title.title()
menuitem.title = menuitem.title
else:
menuitem.title = menuitem.trans_title
if 'devenez' in menuitem.title.lower() and remove_devenez:

View File

@ -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;

View File

@ -32,7 +32,7 @@
<div class="copyright">
{% contact_name the_site=the_site %}
&copy; 2020
&copy; 2022
&bull; <a href="https://public-health.ch/privacy/">Privacy</a>
&bull; <a href="https://public-health.ch/impressum/">Impressum</a>
</div>