{% macro count_label(count, singular, plural) -%} {{- count }} {{ singular if count == 1 else plural -}} {%- endmacro %} {% macro mapping_status_text(unselected, missing_labels, ignored, mapped_count, not_in_file=0) -%} {%- set parts = [] -%} {%- if unselected -%} {%- set verb = 'needs' if unselected == 1 else 'need' -%} {%- set _ = parts.append(count_label(unselected, 'column', 'columns') ~ ' still ' ~ verb ~ ' a choice') -%} {%- endif -%} {%- if missing_labels -%} {%- set _ = parts.append(count_label(missing_labels|length, 'field', 'fields') ~ ' not mapped:') -%} {%- endif -%} {%- if parts -%} {{- parts|join(' · ') -}} {%- else -%} Ready to continue · {{ count_label(mapped_count, 'field', 'fields') }} mapped, {{ count_label(ignored, 'column', 'columns') }} not imported{% if not_in_file %} · {{ count_label(not_in_file, 'field', 'fields') }} not in file{% endif %} {%- endif -%} {%- endmacro %} {% macro mapping_missing_fields(missing_labels) -%} {%- for label in missing_labels[:3] -%}{{ label }}{{ ', ' if not loop.last }}{%- endfor -%} {%- if missing_labels|length > 3 %} and {{ missing_labels|length - 3 }} more{% endif -%} {%- endmacro %}