Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Add our thinking and our work as extra optional sections on the proposition page #551

Merged
merged 6 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% load wagtailcore_tags %}
{% include "patterns/organisms/related-content/related-content.html" with id=value.title title=value.title items=featured_case_studies see_more_link=True data_attrs="data-service-section" classes="service-section" see_more_link_text="See more case studies" filter_by=page.filter_by %}
{% include "patterns/organisms/related-content/related-content.html" with id=value.title title=value.title items=featured_case_studies see_more_link=True data_attrs="data-service-section" classes="service-section" see_more_link_text="See more case studies" filter_by=page.filter_by hide_title=hide_title %}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{% load wagtailcore_tags %}
{% include "patterns/organisms/latest-posts/latest-posts.html" with blogs_section_title=value.title classes="service-section" feature_first=True data_attrs="data-service-section" filter_by=page.filter_by %}

{% include "patterns/organisms/latest-posts/latest-posts.html" with blogs_section_title=value.title classes="service-section" feature_first=True data_attrs="data-service-section" filter_by=page.filter_by hide_title=hide_title %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
{% if data_attrs %}{{ data_attrs }}{% endif %}
>
<div class="blog-listing__content">
{% if page.blogs_section_title %}
{% if page.blogs_section_title and not hide_title %}
{% include "patterns/atoms/section-title/section-title.html" with title=page.blogs_section_title %}
{% elif blogs_section_title %}
{% elif blogs_section_title and not hide_title %}
{% include "patterns/atoms/section-title/section-title.html" with title=blogs_section_title %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="related-content {% if classes %}{{ classes }}{% endif %}" {% if id %}id="{{ id|slugify }}"{% endif %} {% if data_attrs %}data-service-section{% endif %}>
{% if title %}
{% if title and not hide_title %}
{% include "patterns/atoms/section-title/section-title.html" with title=title %}
{% endif %}
<div class="related-content__list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ <h3 class="proposition-section__title">
</div>

{# Team section #}
<div class="proposition-section" id="{{ 'our-team' }}" data-service-section>
{# add extra space below the team section if there is no body content added - common for the team section #}
<div class="proposition-section {% if not page.team_section_body %}proposition-section--bottom-space{% endif %}" id="{{ 'our-team' }}" data-service-section>

<h2 class="proposition-section__anchor">Our team</h2>

Expand All @@ -67,4 +68,24 @@ <h3 class="proposition-section__title">
{% include_block page.team_section_body %}
</div>

{# Our work section #}
{% if page.our_work_section_body %}
<div class="proposition-section" id="{{ 'work' }}" data-service-section>
{# there is just one block allowed #}
<h2 class="proposition-section__anchor">{{ page.our_work_section_body.0.value.title }}</h2>
</div>
{# work block sits outside the proposition-section wrapper as it is full-width #}
{% include_block page.our_work_section_body with hide_title=True %}
{% endif %}

{# Our thinking section #}
{% if page.our_thinking_section_body %}
<div class="proposition-section" id="{{ 'thinking' }}" data-service-section>
{# there is just one block allowed #}
<h2 class="proposition-section__anchor">{{ page.our_thinking_section_body.0.value.title }}</h2>
</div>
{# our thinking block sits outside the proposition-secion wrapper as it has it's own left and right padding, and so the 'more' button aligns with the one under 'work' above #}
{% include_block page.our_thinking_section_body with hide_title=True %}
{% endif %}

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.20 on 2023-11-06 11:48

from django.db import migrations
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('propositions', '0015_add_optional_link_to_testimonials'),
]

operations = [
migrations.AddField(
model_name='propositionpage',
name='our_thinking_section_body',
field=wagtail.fields.StreamField([('our_thinking', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(default='Thinking', label='Blogs section title')), ('featured_blog_posts', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['blog.BlogPage'])))]))], blank=True, use_json_field=True),
),
migrations.AddField(
model_name='propositionpage',
name='our_work_section_body',
field=wagtail.fields.StreamField([('our_work', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(default='Work', label='Case studies section title')), ('featured_case_studies', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['work.WorkPage'])))]))], blank=True, use_json_field=True),
),
]
54 changes: 52 additions & 2 deletions tbx/propositions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
from tbx.blog.models import BlogIndexPage
from tbx.core.blocks import PageSectionStoryBlock
from tbx.core.utils.models import SocialFields
from tbx.propositions.blocks import SubPropositionPageStoryBlock
from tbx.propositions.blocks import (
SubPropositionPageStoryBlock,
ThinkingBlock,
WorkBlock,
)
from tbx.work.models import WorkIndexPage
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.fields import RichTextField, StreamField
Expand Down Expand Up @@ -80,6 +84,26 @@ class PropositionPage(SocialFields, Page):
PageSectionStoryBlock(), blank=True, use_json_field=True, collapsed=True
)

# Our thinking section
our_thinking_section_body = StreamField(
[
("our_thinking", ThinkingBlock()),
],
use_json_field=True,
blank=True,
max_num=1,
)

# Our work section
our_work_section_body = StreamField(
[
("our_work", WorkBlock()),
],
use_json_field=True,
blank=True,
max_num=1,
)

search_fields = Page.search_fields + [
index.SearchField("service"),
index.SearchField("intro"),
Expand Down Expand Up @@ -134,6 +158,8 @@ class PropositionPage(SocialFields, Page):
heading="Our team",
classname="collapsible",
),
FieldPanel("our_work_section_body"),
FieldPanel("our_thinking_section_body"),
]

promote_panels = [
Expand All @@ -143,12 +169,36 @@ class PropositionPage(SocialFields, Page):

@property
def section_titles(self):
return [
section_titles = [
"Services",
"Our clients",
"Our team",
]

if self.our_work_section_body:
section_titles.append("Work")

if self.our_thinking_section_body:
section_titles.append("Thinking")

return section_titles

@property
def filter_by(self):
if self.service:
return self.service.slug

# If no service defined, don't filter by anything
return ""

def get_context(self, request):
context = super().get_context(request)
context.update(
blog_index_page=BlogIndexPage.objects.live().first(),
work_index_page=WorkIndexPage.objects.live().first(),
)
return context


class SubPropositionPage(SocialFields, Page):
template = "patterns/pages/proposition/sub_proposition.html"
Expand Down
4 changes: 4 additions & 0 deletions tbx/static_src/sass/components/_proposition-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
}
}

&--bottom-space {
padding-bottom: 100px;
}

.streamfield {
margin: 0;

Expand Down