{% extends "admin/base.html" %} {#- Clean-up of inactive or missing registry records that datasets still use. See cleanup.py. Plain forms, no JavaScript. -#} {% block subtitle %}{{ _('Cleanup') }}{% endblock %} {% block breadcrumb_content %}
  • {{ _('Cleanup') }}
  • {% endblock %} {% macro replace_form(entry, records, kind, label_remove) %}
    {{ h.csrf_input() }} {#- Nothing is preselected except the publisher a record was merged into: replacing must be a deliberate choice. -#} {% set suggested = entry.merged_into.id if entry.merged_into else '' %}
    {% endmacro %} {% macro dataset_links(entry) %} {% for dataset in entry.datasets[:5] %}{{ dataset.title }}{% if not loop.last %}, {% endif %}{% endfor %}{% if entry.datasets|length > 5 %} {% trans count=entry.datasets|length - 5 %}and {{ count }} more{% pluralize %}and {{ count }} more{% endtrans %}{% endif %} {% endmacro %} {% block primary_content_inner %}

    {{ _('Cleanup') }}

    {{ _('Publishers and contact points that have been deactivated keep working on the datasets that already use them, but can no longer be chosen. Here you find the ones still in use, and datasets that point to records that no longer exist, and replace them on the datasets you may edit.') }}

    {% if not (data.publishers or data.contact_points or data.missing) %}

    {{ _('Nothing to clean up.') }}

    {% endif %} {% for section, entries, records, kind, remove_label in [ ('publishers', data.publishers, actors, 'publisher', _('Remove the publisher')), ('contact_points', data.contact_points, contact_points, 'contact_point', _('Remove the contact point'))] %} {% if entries %}

    {{ _('Inactive publishers still in use') if kind == 'publisher' else _('Inactive contact points still in use') }}

    {% for entry in entries %} {% endfor %}
    {{ _('Name') }}{{ _('Datasets') }}{{ _('Replace with') }}
    {{ entry.record.name }} {% if entry.merged_into %}
    {{ _('Merged into {name}').format(name=entry.merged_into.name) }}{% endif %}
    {% if entry.datasets|length == entry.total %}{{ entry.total }}{% else %}{{ _('{mine} of {total} (the ones you may edit)').format(mine=entry.datasets|length, total=entry.total) }}{% endif %} {% if entry.datasets %}
    {{ dataset_links(entry) }}{% endif %}
    {% if entry.datasets %}{{ replace_form(entry, records, kind, remove_label) }}{% else %}{{ _('None of these datasets is yours to edit.') }}{% endif %}
    {% endif %} {% endfor %} {% if data.missing %}

    {{ _('References to records that no longer exist') }}

    {% for entry in data.missing %} {% endfor %}
    {{ _('Reference') }}{{ _('Datasets') }}{{ _('Replace with') }}
    {{ _('Publisher') if entry.kind == 'publisher' else _('Contact point') }}
    {{ entry.id }}
    {{ entry.total }}{% if entry.datasets %}
    {{ dataset_links(entry) }}{% endif %}
    {% if entry.datasets %}{{ replace_form(entry, actors if entry.kind == 'publisher' else contact_points, entry.kind, _('Remove the publisher') if entry.kind == 'publisher' else _('Remove the contact point')) }}{% endif %}
    {% endif %} {% endblock %} {% block secondary_content %}

    {{ _('About cleanup') }}

    {{ _('Replacing changes only the datasets you may edit, one by one with the usual checks; a dataset that cannot be saved is reported and left as it is.') }}

    {{ _('Removing a required publisher is refused for each dataset; choose a replacement instead.') }}

    {% endblock %}