Hello everyone, I have a resource page with a filter by content_type, everything is working properly, but I need to add a filter to show-all. Here is my code:
<select name="topic">
<option value="">View Resources By Type</option>
<option value="show-all">Show All</option>
{% set content_type_array = [] %}
{% for content_type in resource_content_type|map(attribute='content_type') %}
{% unless content_type.name in content_type_array %}
{% unless content_type.name == null %}
{% do content_type_array.append(content_type.name) %}
{% endunless %}
{% endunless %}
{% endfor %}
{% for item in content_type_array %}
<option {% if request.query_dict.topic == item %} selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
<script>
jQuery('select[name="topic"]').on('change',function(){
let topic = jQuery(this).val();
if(topic !='') {
document.location.href='{{module.resources_page_link.url.href}}?topic={{tag}}'+topic;
}
});
</script>
I'm not sure how to display all the resources with a show-all filter, any help is appreciated.
a really long time ago there was a so called "real estate" HubDB Tutorial at developers.hubspot.com but unfortunately it's no longer available. @Jaycee_Lewis - any chance it will be available again?
Long story short - the idea was to work with queryparams. Kinda the same thing you're doing @jpineda91,
To get the "show all" option I'd say you could do it like this