58
58
for at in attrs.keys() %}{%
59
59
if at != 'offset' %}{%
60
60
if attrs[at] not in [None,''] %}{%
61
- if key not in [None,''] and key == at %}&{{ at }}={{ val }}{%
61
+ if key not in [None,''] and key == at %}{%
62
+ if val != '' %}&{{ at }}={{ val }}{% endif %}{%
62
63
else %}&{{ at }}={{ attrs[at] }}{%
63
64
endif %}{%
64
65
endif %}{%
65
66
endif %}{%
66
- if key not in attrs.keys() %}&{{ key }}={{ val }}{% endif %}{%
67
- endfor %}{%
67
+ endfor %}{%
68
+ if key not in attrs.keys() %}&{{ key }}={{ val }}{% endif %}{%
68
69
endmacro %}
69
70
70
71
{% macro reseturl(key,val) %}{{
122
123
</ div >
123
124
{% if data['facets'] %}
124
125
{% for facet in data['facets'].keys() %}
126
+ {% if data['facets'][facet]['buckets']|length > 0 %}
125
127
< div class ="card mt-3 ">
126
- < div class ="card-header text-capitalize "> {{ facet }}</ div >
128
+ < div class ="card-header text-capitalize "> {{ facet }} {% if facet in attrs.keys() %}
129
+ < a href ="{{ updateurl(facet,'') }} "
130
+ class ="btn btn-sm btn-outline-secondary " style ="float:right "> Reset</ a >
131
+ {% endif %}</ div >
127
132
< div class ="card-body ">
128
- {% for bucket in data['facets'][facet].buckets %}
133
+ {% for bucket in data['facets'][facet]['buckets'] %}
134
+ {% if loop.index == 8 %}
135
+ < div id ="more-{{facet}} " class ="collapse ">
136
+ {% endif %}
129
137
{% if bucket['value'] %}
130
138
< a href ="{{ updateurl(facet,bucket['value']) }} " title ="{{bucket['value']}} "
131
139
> {{(bucket['value'] or "") | truncate(20, False, '..') | capitalize }}</ a >
132
140
< span class ="badge rounded-pill bg-secondary " style ="float:right "> {{bucket['count']}}</ span > < br >
133
141
{% endif %}
134
142
{% endfor %}
143
+ {% if data['facets'][facet]['buckets']|length > 7 %}</ div >
144
+ < button onclick ="$('#more-{{facet}}').toggle() "
145
+ class ="btn btn-sm btn-outline-secondary mt-2 "> Show more</ button >
146
+ {% endif %}
135
147
</ div >
136
148
</ div >
149
+ {% endif %}
137
150
{% endfor %}
138
151
{% endif %}
139
152
</ div >
334
347
}
335
348
}
336
349
</ script >
337
- {% endblock %}
350
+ {% endblock %}
0 commit comments