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

TDP: semi-terrible fix for activities search bug #7659

Merged
merged 4 commits into from
Apr 13, 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,6 +1,6 @@
{% import 'v1/includes/atoms/tag.html' as tag %}
{% import 'v1/includes/molecules/pagination.html' as pagination with context %}
{% from 'v1/includes/organisms/expandable.html' import expandable with context %}
{% from 'teachers_digital_platform/tdp_expandable.html' import expandable with context %}

{% macro build_nested_facets(facets, type, is_child=False) %}
<ul class="m-list m-list__unstyled{% if not is_child %} u-mt15{% else %} o-expandable-facets_content{% endif %}">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{#
TODO: Note that this is a copy of our standard expandable for TDP,
in order to isolate TDP customizations.
#}
{# ==========================================================================

Expandable

==========================================================================

Description:

Create an Expandable molecule when given:

value: Object defined from a StreamField block.

value.label: Label you want on the Expandable.
Default is an empty string.

value.content: Main content of the expandable.

value.is_bordered: Whether the Expandable has a bottom border or not.
Default is false.

value.is_collapsed_for_mobile:
Whether the Expandable is always initially
collapsed below 800px.
Default is false.

value.is_midtone: Whether the Expandable is gray or not.
Default is false.

value.is_expanded: Whether the Expandable is expanded or not.
Default is false.

value.hide_cue_label: Whether the Expandable's cue label is hidden or not.
Default is false. The plus/minus icon is always shown.

========================================================================== #}

{% macro expandable(value, expandable_cue_additional_text='') %}
<div class="o-expandable
o-expandable__padded
{{ 'o-expandable__background' if value.is_midtone else '' }}
{{ 'o-expandable__border' if value.is_bordered else '' }}">
<button class="o-expandable_header o-expandable_target" type="button">
<span class="h4 o-expandable_label">
{{ value.label }}
</span>
<span class="o-expandable_link">
<span class="o-expandable_cue o-expandable_cue-open">
<span class="{{ 'u-visually-hidden' if value.hide_cue_label else 'u-visually-hidden-on-mobile' }}">
{{ _('Show') }}
{{ expandable_cue_additional_text }}
</span>
{{ svg_icon('plus-round') }}
</span>
<span class="o-expandable_cue o-expandable_cue-close">
<span class="{{ 'u-visually-hidden' if value.hide_cue_label else 'u-visually-hidden-on-mobile' }}">
{{ _('Hide') }}
{{ expandable_cue_additional_text }}
</span>
{{ svg_icon('minus-round') }}
</span>
</span>
</button>

<div class="o-expandable_content
{{ 'o-expandable_content__onload-open'
if value.is_expanded else '' }}
{{ 'o-expandable__mobile-collapsed'
if value.is_collapsed_for_mobile else '' }}">
{% if caller is defined %}
{{ caller() }}
{% else %}
{% for block in value.content %}
{% if 'paragraph' in block.block_type %}
{{ block.value | safe }}
{% else %}
{{ render_stream_child(block) }}
{% endif %}
{% endfor %}
{% endif %}
</div>

</div>
{% endmacro %}

{% if value %}
{{ expandable(value) }}
{% endif %}
Loading