-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generating a generic listing page and blog listing specific page (#3427)
* generating a generic listing page
- Loading branch information
Showing
9 changed files
with
193 additions
and
46 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
network-api/networkapi/wagtailpages/migrations/0071_indexpage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Generated by Django 2.2.3 on 2019-07-24 22:15 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import wagtailmetadata.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'), | ||
('wagtailimages', '0001_squashed_0021'), | ||
('wagtailpages', '0070_auto_20190716_1200'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='IndexPage', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
('header', models.CharField(blank=True, max_length=250)), | ||
('header_en', models.CharField(blank=True, max_length=250, null=True)), | ||
('header_de', models.CharField(blank=True, max_length=250, null=True)), | ||
('header_pt', models.CharField(blank=True, max_length=250, null=True)), | ||
('header_es', models.CharField(blank=True, max_length=250, null=True)), | ||
('header_fr', models.CharField(blank=True, max_length=250, null=True)), | ||
('header_pl', models.CharField(blank=True, max_length=250, null=True)), | ||
('intro', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250)), | ||
('intro_en', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('intro_de', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('intro_pt', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('intro_es', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('intro_fr', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('intro_pl', models.CharField(blank=True, help_text='Intro paragraph to show in hero cutout box', max_length=250, null=True)), | ||
('search_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image', verbose_name='Search image')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=(wagtailmetadata.models.MetadataMixin, 'wagtailcore.page', models.Model), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/blog-card.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends "./generic-card.html" %} | ||
|
||
{% load wagtailcore_tags %} | ||
|
||
{% block tags-DISABLED-FOR-NOW %} | ||
<div> | ||
{% with tag=page.specific.tags.first %} | ||
<a class="main-tag" href="#">{{ tag }}</a> | ||
{% endwith %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block byline %} | ||
By {{ page.specific.author }} on {{ page.first_published_at|date:"F j, Y" }} | ||
{% endblock%} |
5 changes: 5 additions & 0 deletions
5
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/blog-cards.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% load wagtailcore_tags %} | ||
|
||
{% for page in entries %} | ||
{% include "./blog-card.html" %} | ||
{% endfor %} |
14 changes: 14 additions & 0 deletions
14
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/generic-card.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% load wagtailcore_tags wagtailimages_tags %} | ||
|
||
<div class="child-card col-6 col-md-4 mb-5"> | ||
<div> | ||
<a href="{{ page.url }}"> | ||
{% image page.specific.get_meta_image fill-400x225 %} | ||
</a> | ||
</div> | ||
{% block tags %}{% endblock %} | ||
<a class="h4-heading d-inline-block my-2" href={{ page.url }}>{{ page.title }}</a> | ||
<p class="body-small mb-0"> | ||
{% block byline %}{% endblock %} | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{% extends "./modular_page.html" %} | ||
|
||
{% load wagtailcore_tags mini_site_tags %} | ||
|
||
|
||
{% block content %} | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12 col-md-8 pt-4"> | ||
<h1 class="h1-heading mb-0 mt-1 pt-2"> | ||
{% if root.title %}{{ root.title }}{% elif page.header %}{{ page.header }}{% else %}{{ page.title }}{% endif %} | ||
</h1> | ||
<p class="body-large mt-3 mb-0">{{ page.intro }}</p> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-12"> | ||
<hr class="intro-and-content-divider"> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
{% block subcontent %} | ||
|
||
{% for entry in page.get_children.live %} | ||
{% with type=entry.specific_class.get_verbose_name|lower %} | ||
{% if type == "blog page" %} | ||
{% include "./fragments/blog-card.html" with page=entry %} | ||
{% else %} | ||
{% include "./fragments/generic-card.html" with page=entry %} | ||
{% endif %} | ||
{% endwith %} | ||
{% endfor %} | ||
|
||
{% endblock %} | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.