diff --git a/hypha/public/home/migrations/0012_add_news_homepage.py b/hypha/public/home/migrations/0012_add_news_homepage.py new file mode 100644 index 0000000000000000000000000000000000000000..c342becc2a9544cb47f94258db9bbffae09d02a9 --- /dev/null +++ b/hypha/public/home/migrations/0012_add_news_homepage.py @@ -0,0 +1,30 @@ +# 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), + ), + ] diff --git a/hypha/public/home/models.py b/hypha/public/home/models.py index d2598eb8e11ce79b47299e7aa6c6accc30ac8780..7415300813caa5e846a81dc99f1c9a07718dc848 100644 --- a/hypha/public/home/models.py +++ b/hypha/public/home/models.py @@ -70,6 +70,10 @@ class HomePage(BasePage): strapline_link = models.ForeignKey('wagtailcore.Page', related_name='+', on_delete=models.PROTECT) 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 = StreamField([ ('work', OurWorkBlock()), @@ -100,6 +104,11 @@ class HomePage(BasePage): PageChooserPanel('strapline_link'), FieldPanel('strapline_link_text'), ], heading='Introduction'), + MultiFieldPanel([ + FieldPanel('news_title'), + PageChooserPanel('news_link'), + FieldPanel('news_link_text'), + ], heading='News'), MultiFieldPanel([ FieldPanel('our_work_title'), StreamFieldPanel('our_work'), diff --git a/hypha/public/home/templates/home/home_page.html b/hypha/public/home/templates/home/home_page.html index 56ad6b704dd62fceea2ec98e1476ad69d44209db..f3f5cb7e344f971ca288bb6d6690b39c498c8fe2 100644 --- a/hypha/public/home/templates/home/home_page.html +++ b/hypha/public/home/templates/home/home_page.html @@ -81,6 +81,19 @@ {% endblock %} {% 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"> <h2 class="heading heading--center heading--focus-areas">{{ page.our_work_title }}</h2> <div class="grid grid--focus-areas">