diff --git a/publichealth/home/models.py b/publichealth/home/models.py index 03db4c3..e8582d1 100644 --- a/publichealth/home/models.py +++ b/publichealth/home/models.py @@ -71,6 +71,7 @@ class ArticlePage(Page): 'body_fr', ) + date = models.DateField("Date", null=True, blank=True) feed_image = models.ForeignKey( 'wagtailimages.Image', null=True, @@ -101,6 +102,7 @@ class ArticlePage(Page): ] promote_panels = [ ImageChooserPanel('feed_image'), + FieldPanel('date'), InlinePanel('related_links', label="Links"), MultiFieldPanel(Page.promote_panels, "Common page configuration"), ] @@ -167,7 +169,7 @@ class HomePage(Page): @property def featured(self): # Get list of live pages that are descendants of this page - articles = ArticlePage.objects.live().descendant_of(self) + articles = ArticlePage.objects.live()[:4] #.descendant_of(self) # Order by most recent date first #articles = articles.order_by('-date') return articles diff --git a/publichealth/home/templates/home/article_index_page.html b/publichealth/home/templates/home/article_index_page.html index 726836b..394d61b 100644 --- a/publichealth/home/templates/home/article_index_page.html +++ b/publichealth/home/templates/home/article_index_page.html @@ -4,15 +4,27 @@ {% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %} {% block content %} -{% for entry in banner_articles %} -
- - +
+
+ +

{{ page.trans_title }}

+ +

{{ page.trans_intro|richtext }}

+ +
+ {% for entry in banner_articles %} +
+ + +
+ {% empty %} + No articles found + {% endfor %} +
-{% empty %} - No articles found -{% endfor %} +
+
{% endblock %} diff --git a/publichealth/home/templates/home/article_page.html b/publichealth/home/templates/home/article_page.html index d927e37..51835cf 100644 --- a/publichealth/home/templates/home/article_page.html +++ b/publichealth/home/templates/home/article_page.html @@ -15,7 +15,9 @@

{{ page.trans_intro|richtext }}

+ {% if page.date %}

{{ page.date }}

+ {% endif %}
@@ -33,5 +35,4 @@
- {% endblock %} diff --git a/publichealth/home/templates/home/home_page.html b/publichealth/home/templates/home/home_page.html index b0a1e21..575146a 100644 --- a/publichealth/home/templates/home/home_page.html +++ b/publichealth/home/templates/home/home_page.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags %} +{% load wagtailcore_tags %} {% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %} @@ -12,7 +12,6 @@ {% include 'news.html' %} -{% if page.trans_body %}
@@ -20,28 +19,8 @@
-{% endif %} -
-
-
- {% for block in page.trans_infos %} -
-
- {% image block.value.photo fill-300x300 %} -
-
-

{{ block.value.title }}

-
- {{ block.value.summary|richtext }} - -
- {% endfor %} -
-
-
+{% include 'infos.html' %} {% endblock %} diff --git a/publichealth/home/templates/infos.html b/publichealth/home/templates/infos.html new file mode 100644 index 0000000..ec40989 --- /dev/null +++ b/publichealth/home/templates/infos.html @@ -0,0 +1,22 @@ +{% load wagtailcore_tags wagtailimages_tags %} + +
+
+
+ {% for block in page.trans_infos %} +
+
+ {% image block.value.photo fill-300x300 %} +
+
+

{{ block.value.title }}

+
+ {{ block.value.summary|richtext }} + +
+ {% endfor %} +
+
+
\ No newline at end of file diff --git a/publichealth/home/templates/tags/top_menu_children.html b/publichealth/home/templates/tags/top_menu_children.html index 5ae4613..d4e679c 100644 --- a/publichealth/home/templates/tags/top_menu_children.html +++ b/publichealth/home/templates/tags/top_menu_children.html @@ -1,7 +1,6 @@ {% load navigation wagtailcore_tags %}