Skip to content
Draft
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,20 +1,12 @@
{% import 'v1/includes/atoms/tag.html' as tag %}
{% import 'v1/includes/molecules/pagination.html' as pagination with context %}
{% from 'teachers_digital_platform/tdp_expandable.html' import expandable with context %}

{% macro build_filter_section(name) %}
<div class="filter-section">
{% set label = name | capitalize | replace('_', ' ') %}
{% set items = facets[name] %}
{% set expandable_settings = {
'label': label,
'is_expanded': true,
'is_collapsed_for_mobile': true,
'is_midtone': true
} %}
{% call() expandable(expandable_settings) %}
{{build_form_group(name, items)}}
{% endcall %}
<h4>{{label}}</h4>
{{build_form_group(name, items)}}
</div>
{% endmacro %}

Expand Down Expand Up @@ -78,22 +70,15 @@ <h3 class="h2">Filter results by</h3>
{% if facets.grade_level %}{{build_filter_section('grade_level')}}{% endif %}
{% if facets.activity_duration %}{{build_filter_section('activity_duration')}}{% endif %}
{% if facets.topic %}
{% set topic_dict = {'Earn': 'Earning', 'Save and invest': 'Saving and investing', 'Protect': 'Protecting', 'Spend': 'Spending', 'Borrow': 'Borrowing'} %}
{% set topic_dict = {'Earn': 'Earning', 'Save and invest': 'Saving and investing', 'Protect': 'Protecting', 'Spend': 'Spending', 'Borrow': 'Borrowing'} %}
<div class="filter-section">
<h4>Topic</h4>
{% set items = facets.topic %}
{% set expandable_settings = {
'label': 'Topic',
'is_expanded': true,
'is_collapsed_for_mobile': true,
'is_midtone': true
} %}
{% call() expandable(expandable_settings) %}
{% for topic in items %}
<h5>{{topic_dict[topic.title]}}</h5>
{{build_form_group('topic', topic.children)}}
<br/>
{% endfor %}
{% endcall %}
{% for topic in items %}
<h5>{{topic_dict[topic.title]}}</h5>
{{build_form_group('topic', topic.children)}}
<br/>
{% endfor %}
</div>
{% endif %}

Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions cfgov/teachers_digital_platform/models/activity_index_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
FACET_DICT["aggs"].update(
{"{}_terms".format(facet): {"terms": {"field": facet}}}
)
ALWAYS_EXPANDED = {"topic", "school_subject"}
SEARCH_FIELDS = [
"text",
"related_text",
Expand Down Expand Up @@ -132,7 +131,6 @@ def dsl_search(self, request, *args, **kwargs):
"total_activities": total_activities,
"selected_facets": selected_facets,
"all_facets": all_facets,
"expanded_facets": ALWAYS_EXPANDED,
}
self.results = payload
results_per_page = validate_results_per_page(request)
Expand Down Expand Up @@ -195,18 +193,6 @@ def dsl_search(self, request, *args, **kwargs):
"selected_facets": selected_facets,
"all_facets": all_facets,
}
# List all facet blocks that need to be expanded
conditionally_expanded = {
facet_name
for facet_name, facet_items in all_facets.items()
if any(facet["selected"] is True for facet in facet_items)
}
expanded_facets = ALWAYS_EXPANDED.union(set(conditionally_expanded))
payload.update(
{
"expanded_facets": expanded_facets,
}
)
self.results = payload
results_per_page = validate_results_per_page(request)
paginator = Paginator(payload["results"], results_per_page)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
@import (reference) 'cfpb-typography.less';
@import (reference) 'cfpb-notifications.less';
@import (reference) 'cfpb-pagination.less';
@import (reference) 'cfpb-expandables.less';
@import (reference) 'cfpb-tables.less';

// Project specific Less goes here or you can break it up into discrete files.
@import url('atoms/icon.less');
@import url('molecules/form-fields.less');
@import url('molecules/search-hero.less');
@import url('organisms/expandable.less');
@import url('organisms/expandable-facets.less');
@import url('pages/activity-search.less');
@import url('utilities/hide-on.less');

This file was deleted.

Loading