Skip to content

Commit

Permalink
Merge pull request #8233 from cfpb/ans_breadcrumbs_condition
Browse files Browse the repository at this point in the history
Consolidate template breadcrumbs
  • Loading branch information
chosak authored Mar 21, 2024
2 parents d12eabb + 077ebca commit 4ed4051
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
{% endif %}
{% set banner_modification = ' o-banner__dark' if version_status == 'Archived' else '' %}

{% if page and not breadcrumb_items %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% block banner_top %}
{% if version_status %}
{% import 'v1/includes/molecules/notification.html' as notification with context %}
Expand Down Expand Up @@ -47,12 +43,7 @@
<div class="u-layout-grid_wrapper">
{% block hero -%}{%- endblock %}
{% block pre_content scoped -%}
{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
{% include 'v1/layouts/_breadcrumbs.html' %}
{%- endblock %}
{% block body_content scoped %}
<aside class="u-layout-grid_secondary-nav u-layout-grid_secondary-nav__sticky">
Expand Down
11 changes: 0 additions & 11 deletions cfgov/form_explainer/jinja2/form-explainer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@
<link rel="stylesheet" href="{{ static('apps/form-explainer/css/main.css') }}">
{%- endblock css %}

{% if page and not breadcrumb_items %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% if breadcrumb_items | length > 0 %}
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs with context -%}
<div class="block block__sub block__flush-top">
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}

{% block content_main_modifiers -%}
{{ super() }} content__flush-bottom
{%- endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,14 @@
#content_main
{%- endblock %}

{% if page and not breadcrumb_items %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% block content scoped %}
<main class="u-layout-grid u-layout-grid__1-3
{% block content_modifiers -%}{%- endblock %}"
id="main">
<div class="u-layout-grid_wrapper">
{% block hero -%}{%- endblock %}
{% block pre_content scoped -%}
{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
{% include 'v1/layouts/_breadcrumbs.html' %}
{%- endblock %}
{% block body_content scoped %}
<aside class="u-layout-grid_secondary-nav o-regs3k-sidebar">
Expand Down
10 changes: 10 additions & 0 deletions cfgov/v1/jinja2/v1/layouts/_breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% if not breadcrumb_items and page and page.get_breadcrumbs %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs with context -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
11 changes: 1 addition & 10 deletions cfgov/v1/jinja2/v1/layouts/layout-1-3.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#content_main
{%- endblock %}

{% if page and not breadcrumb_items %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% block content scoped %}
<main class="u-layout-grid u-layout-grid__1-3
{% block content_modifiers -%}{%- endblock %}"
Expand All @@ -20,12 +16,7 @@
<div class="u-layout-grid_wrapper">
{% block hero -%}{%- endblock %}
{% block pre_content scoped -%}
{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs with context -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
{% include 'v1/layouts/_breadcrumbs.html' %}
{%- endblock %}
{% block body_content scoped %}
<aside class="u-layout-grid_secondary-nav">
Expand Down
15 changes: 1 addition & 14 deletions cfgov/v1/jinja2/v1/layouts/layout-2-1.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% extends 'v1/layouts/base.html' %}

{% if page and not breadcrumb_items %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% block content scoped %}
<main class="u-layout-grid u-layout-grid__2-1
{% block content_modifiers -%}{%- endblock %}"
Expand All @@ -18,16 +14,7 @@

<div class="u-layout-grid_wrapper">
{% block pre_content scoped -%}
{% if not breadcrumb_items and page and page.get_breadcrumbs %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs with context -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
{% include 'v1/layouts/_breadcrumbs.html' %}
{%- endblock %}

{% block body_content scoped %}
Expand Down
11 changes: 1 addition & 10 deletions cfgov/v1/jinja2/v1/layouts/layout-full.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@

<div class="u-layout-grid_wrapper">
{% block pre_content scoped -%}
{% if not breadcrumb_items and page and page.get_breadcrumbs %}
{% set breadcrumb_items = page.get_breadcrumbs(request) %}
{% endif %}

{% if breadcrumb_items | length > 0 %}
<div class="u-layout-grid_breadcrumbs">
{%- import 'v1/includes/molecules/breadcrumbs.html' as breadcrumbs with context -%}
{{ breadcrumbs.render(breadcrumb_items) }}
</div>
{% endif %}
{% include 'v1/layouts/_breadcrumbs.html' %}
{%- endblock %}

{% block body_content scoped %}
Expand Down

0 comments on commit 4ed4051

Please sign in to comment.