Skip to content
Snippets Groups Projects
Unverified Commit 6a757de4 authored by Fredrik Jonsson's avatar Fredrik Jonsson Committed by GitHub
Browse files

Merge pull request #1893 from OpenTechFund/feature/add-news-to-homepage

Add ability to add top news link to top of home page.
parents 932fe82c 5f90b98e
No related branches found
No related tags found
No related merge requests found
# Generated by Django 2.2.11 on 2020-03-28 15:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0045_assign_unlock_grouppagepermission'),
('home', '0011_correct_related_page_behaviour'),
]
operations = [
migrations.AddField(
model_name='homepage',
name='news_link',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.Page'),
),
migrations.AddField(
model_name='homepage',
name='news_link_text',
field=models.CharField(blank=True, max_length=255),
),
migrations.AddField(
model_name='homepage',
name='news_title',
field=models.CharField(blank=True, max_length=255),
),
]
...@@ -70,6 +70,10 @@ class HomePage(BasePage): ...@@ -70,6 +70,10 @@ class HomePage(BasePage):
strapline_link = models.ForeignKey('wagtailcore.Page', related_name='+', on_delete=models.PROTECT) strapline_link = models.ForeignKey('wagtailcore.Page', related_name='+', on_delete=models.PROTECT)
strapline_link_text = models.CharField(max_length=255) strapline_link_text = models.CharField(max_length=255)
news_title = models.CharField(blank=True, max_length=255)
news_link = models.ForeignKey('wagtailcore.Page', blank=True, null=True, related_name='+', on_delete=models.PROTECT)
news_link_text = models.CharField(blank=True, max_length=255)
our_work_title = models.CharField(max_length=255) our_work_title = models.CharField(max_length=255)
our_work = StreamField([ our_work = StreamField([
('work', OurWorkBlock()), ('work', OurWorkBlock()),
...@@ -100,6 +104,11 @@ class HomePage(BasePage): ...@@ -100,6 +104,11 @@ class HomePage(BasePage):
PageChooserPanel('strapline_link'), PageChooserPanel('strapline_link'),
FieldPanel('strapline_link_text'), FieldPanel('strapline_link_text'),
], heading='Introduction'), ], heading='Introduction'),
MultiFieldPanel([
FieldPanel('news_title'),
PageChooserPanel('news_link'),
FieldPanel('news_link_text'),
], heading='News'),
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('our_work_title'), FieldPanel('our_work_title'),
StreamFieldPanel('our_work'), StreamFieldPanel('our_work'),
......
...@@ -81,6 +81,19 @@ ...@@ -81,6 +81,19 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if page.news_title and page.news_link and page.news_link_text %}
<div class="wrapper wrapper--inner-space-large">
<h2 class="heading heading--center heading--focus-areas">{{ page.news_title }}</h2>
<div class="wrapper wrapper--center">
<h5 class="heading heading--contains-link">
<a class="link link--arrow-pixels-blue" href="{% pageurl page.news_link %}">
{{ page.news_link_text }}
<svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
</a>
</h5>
</div>
</div>
{% endif %}
<div class="wrapper wrapper--inner-space-large"> <div class="wrapper wrapper--inner-space-large">
<h2 class="heading heading--center heading--focus-areas">{{ page.our_work_title }}</h2> <h2 class="heading heading--center heading--focus-areas">{{ page.our_work_title }}</h2>
<div class="grid grid--focus-areas"> <div class="grid grid--focus-areas">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment