/
orgtype.html.j2
78 lines (74 loc) · 3.04 KB
/
orgtype.html.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{% extends 'base.html.j2' %}
{% set sources = get_sources() %}
{% set orgtypes = get_orgtypes() %}
{% set locations = get_locations() %}
{% set heading = '{}'.format(
base_query.title,
) if base_query else 'Search Results' %}
{% if res.has_other_pages() %}
{% set subtitle = "Showing organisation {:,.0f} to {:,.0f} out of {:,.0f}".format(
res.start_index(),
res.end_index(),
res.paginator.count
) %}
{% else %}
{% set subtitle = "Showing all {:,.0f} organisations".format(res.paginator.count) %}
{% endif %}
{% block headscripts %}
<link rel="stylesheet" href="{{ static('lib/choices/choices.min.css') }}" />
<script src="{{ static('lib/choices/choices.min.js') }}"></script>
{{ super() }}
{% endblock headscripts %}
{% block bodyscripts %}
{{ super() }}
<script src='{{ static("js/choices.js") }}' type="text/javascript"></script>
{% endblock bodyscripts %}
{% macro filter_tag(key, value) %}
<li class="b--dark-gray bn mr2 mb2 dib f6">
<span class="bg-near-black yellow pv1 ph2 br-pill br--left dib b">{{ key }}</span><span
class="bg-moon-gray pv1 ph2 br-pill br--right dib">{{ value }}</span>
</li>
{% endmacro %}
{% block content %}
<main class="">
<form class="" action="{{ url_remove(request, 'q') }}">
<div class="fl w-100 w-70-l pa2">
{% include 'components/search_form.html.j2' %}
{% if search.other_orgtypes or search.source or search.location %}
<div class="w-100">
<span class="f6 b mr2">Filters: </span>
<ul class="list pa0 ma0 dib">
{% if search.other_orgtypes %}
{% for r in search.other_orgtypes if r in orgtypes and base_query.slug != r %}
{{ filter_tag('Type', orgtypes[r].title) }}
{% endfor %}
{% endif %}
{% if search.source %}
{% for r in search.source if r in sources and base_query.slug != r %}
{{ filter_tag('Source', sources[r].title) }}
{% endfor %}
{% endif %}
{% if search.location %}
{% for l in search.location if base_query.slug != l %}
{{ filter_tag('Location', l|get_geoname) }}
{% endfor %}
{% endif %}
</ul>
<a href="{{ url_remove(request, ['orgtype', 'source', 'location']) }}"
class="f6 link blue underline">Clear filters</a>
</div>
{% endif %}
<div class="mt4">
{% include 'components/search_results.html.j2' %}
</div>
</div>
<div class="fl w-100 w-30-l pa2">
{% if download_url %}
<a class="mb1 tr w-100 db b link dark-blue underline-hover" href="{{ download_url }}">Download as CSV</a>
{% include 'components/about_this_download.html.j2' %}
{% endif %}
{% include 'components/search_facets.html.j2' %}
</div>
</form>
</main>
{% endblock %}