Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate template breadcrumbs #8233

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 '_breadcrumbs.html' %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I please request that we use the "absolute" path to this ('v1/layouts/_breadcrumbs.html') instead of the relative one (here, and in the other instance below)? See comment here for rationale -- loading via relative paths is something bespoke to cf.gov which ideally we could deprecate someday.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, that also makes it consistent with the full layout that was already using the absolute path. Done in eb583e0

{%- 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 '_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
Loading