Skip to content

Commit

Permalink
fix: content item page rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ngurenyaga committed Nov 22, 2021
1 parent d14a8fe commit 960873a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
re_path(
r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$", ServeView.as_view(), name="wagtailimages_serve"
),
path("content/", include(wagtail_urls), name="wagtail"),
path("", include(wagtail_urls), name="wagtail"),
]
4 changes: 4 additions & 0 deletions mycarehub/content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ class ContentItemTagIndexPage(Page):
e.g https://<site>/?tag=<tag>
"""

parent_page_types = [
"home.HomePage",
]

def get_context(self, request):

# Filter by tag
Expand Down
1 change: 1 addition & 0 deletions mycarehub/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class HomePage(Page):
content_panels = Page.content_panels + [
FieldPanel("body", classname="full"),
]
parent_page_types = ["wagtailcore.page"]
subpage_types = [
"content.ContentItemIndexPage",
]
Expand Down
11 changes: 9 additions & 2 deletions mycarehub/templates/content/content_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
<h1>{{ page.title }}</h1>
<p class="meta">{{ page.date }}</p>

{% video self.header_video autoplay controls width=256 %}
{% if page.hero_image %}
<div style="float: left; margin: 10px">
{% image page.hero_image fill-320x240 %}
<p>{{ page.hero_image.caption }}</p>
</div>
{% endif %}

{% with categories=page.categories.all %}
{% if categories %}
<h3>Posted in:</h3>
<ul>
{% for category in categories %}
<li style="display: inline">
{% image category.icon fill-32x32 style="vertical-align: middle" %}
{% if category.icon %}
{% image category.icon fill-32x32 style="vertical-align: middle" %}
{% endif %}
{{ category.name }}
</li>
{% endfor %}
Expand Down

0 comments on commit 960873a

Please sign in to comment.