diff --git a/publichealth/home/models.py b/publichealth/home/models.py index c37654e..ccc1006 100644 --- a/publichealth/home/models.py +++ b/publichealth/home/models.py @@ -13,6 +13,8 @@ from wagtail.wagtailimages.blocks import ImageChooserBlock from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailsearch import index +from puput.models import EntryPage, BlogPage + from .util import TranslatedField class ArticleIndexPage(Page): @@ -123,6 +125,15 @@ class ArticleRelatedLink(Orderable): FieldPanel('url'), ] +class NewsEntryPage(EntryPage): + video_url = models.URLField() + content_panels = EntryPage.content_panels + [ + FieldPanel('video_url') + ] + class Meta: + verbose_name = "News" +BlogPage.subpage_types = NewsEntryPage + class InfoBlock(blocks.StructBlock): title = blocks.CharBlock(required=True) photo = ImageChooserBlock() diff --git a/publichealth/home/templates/home/news_page.html b/publichealth/home/templates/home/news_page.html new file mode 100644 index 0000000..aacc39e --- /dev/null +++ b/publichealth/home/templates/home/news_page.html @@ -0,0 +1,51 @@ +{% extends "base.html" %} +{% load wagtailcore_tags wagtailimages_tags puput_tags %} + +{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %} + +{% block title %}{{ self.title }} | {{ blog_page.title }}{% endblock title %} +{% block meta_title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock meta_title %} +{% block meta_description %}{% if self.search_description %}{{ self.search_description }}{% else %}{{ self.body|striptags|truncatewords:20 }}{% endif %}{% endblock meta_description %} +{% block canonical %}{% canonical_url entry=self %}{% endblock canonical %} +{% block social_share %} + {% image self.header_image fill-800x450 as share_image %} + + + + {% if self.header_image %} + + + + + {% endif %} + + + +{% endblock social_share %} + +{% block content %} +