{% from "components/search_field.html" import search_field %} {% from "components/record_status_filter.html" import record_status_filter %} {% macro hidden_criteria(values, exclude=[]) %} {% for name, value in values.items() if name not in exclude and value is not none %} {% if value is iterable and value is not string %} {% for item in value %}{% endfor %} {% else %}{% endif %} {% endfor %} {% endmacro %} {# Change filters are independent toggles. With none selected all Records are shown. Counts follow the applied search term and the controls work without JavaScript. #} {% macro record_status_toggles() %}
{{ hidden_criteria(criteria_parameters, ['record_status']) }} {% for label, count, selected, target in record_change_options %} {% endfor %}
{% endmacro %} {% macro mapping_status_toggles() %} {% if mapping_source and mapping_source.draft %}
{{ hidden_criteria(criteria_parameters, ['mapping_status']) }} {% for value, label, count in [('unmapped', 'Unmapped', mapping_source.draft.unmapped), ('removed', 'Removed from source', mapping_source.draft.removed)] %} {% endfor %}
{% endif %} {% endmacro %} {% macro record_search_controls() %}
{% if not version_state %}{{ record_status_toggles() }}{{ mapping_status_toggles() }}{% endif %}
{% endmacro %}