{#- To do (0.6.0): the datasets that lack a publisher and/or a contact point, where an editor sets them. Each row the viewer may edit has a box and its own choices; the same bar above and below the list holds the choices for the ticked rows, so it is seen at once and still at hand after a long list. One Save, in either bar, saves it all: every row's own choices, and the bar's choices on the ticked rows (a row's own choice comes first; views._todo_plan). Only what a row lacks can be chosen, and nothing already set is overwritten (cleanup.assign); what is set has an Edit link to the dataset's form, and what is missing stands out. ``assign`` comes from views._assign_choices and is none when the viewer may edit none of the rows. A search and filters on tags (all of them) and organisations (any of them) narrow the list, so datasets on one theme can get the same publisher or contact point at once. Every link and form of the page leads back to the filters or the list, not to the top of the page, and the messages of a save are shown at the list. With JavaScript (assign-links.js): "Select all", a count on the Save button, rows marked while ticked or chosen and not saved, a question before leaving the page with any of that unsaved, "Create new…" in each list and the scroll position kept over a save; (todo-filters.js) the filters apply as soon as something is chosen. The second tab is the clean-up page. -#} {% extends "actor_registry/base.html" %} {% block subtitle %}{{ _('To do') }}{% endblock %} {% block breadcrumb_content %}
  • {{ _('To do') }}
  • {% endblock %} {#- The messages are shown at the list (below), where the work goes on. -#} {% block flash_inner %}{% endblock %} {#- The whole width: the table has a column per field. -#} {% block secondary %}{% endblock %} {% block wrapper_class %} registry-wide{% endblock %} {% macro contact_point_label(item) -%}{{ item.name }}{% if item.email %} ({{ item.email }}){% endif %}{%- endmacro %} {% macro choices(name, id, label, items, kind, label_hidden=false, small=false, option_label=none) -%} {%- endmacro %} {% macro bar(where) -%}
    {% if where == 'top' %}

    {{ _('Select datasets in the list and choose here what they should get. Save saves this and the choices on every row. Only what is missing is filled in.') }}

    {% endif %}
    {% set select_all = _('Select all') %} {% if assign.publisher %}{{ choices('publisher_actor_id_' ~ where, 'assign-publisher-' ~ where, _('Publisher'), assign.actors, 'publisher') }}{% endif %} {% if assign.contact_point %}{{ choices('contact_point_id_' ~ where, 'assign-contact-point-' ~ where, _('Contact point'), assign.contact_points, 'contact_point', option_label=contact_point_label) }}{% endif %}
    {%- endmacro %} {% block primary_content_inner %} {% asset 'actor_registry/assign-links' %} {% asset 'actor_registry/todo-filters' %} {% asset 'actor_registry/todo-css' %}

    {{ _('To do') }}

    {% snippet 'actor_registry/snippets/page_tabs.html', tabs=tabs %}

    {{ _('Datasets that lack a publisher or a contact point. Choose on the rows, or select several datasets and choose what they should all get, and save it all at once. Only what is missing can be set here; to change what is already set, use Edit on the row.') }}

    {% if facets.chosen %} {% endif %} {% if facets.tags or filters.tag or facets.organizations or filters.org %}

    {%- if facets.tags or filters.tag %}{{ _('Choose a tag to add it. With several tags, the list shows the datasets that have all of them.') }} {% endif -%} {%- if facets.organizations or filters.org %}{{ _('With several organizations, it shows the datasets of any of them.') }} {% endif -%} {{ _('Remove a filter with ×.') }}

    {% endif %} {% set show_text = _('Show datasets that lack') %}
    {% for category, message in h.get_flashed_messages(with_categories=true) %} {% endfor %}

    {{ heading }}

    {% if not data.rows %}

    {{ _('No datasets match the filters.') if filters else _('Nothing to do here.') }}

    {% else %} {% if assign %}
    {{ h.csrf_input() }} {% if filters.q %}{% endif %} {% for tag in filters.tag or [] %}{% endfor %} {% for org in filters.org or [] %}{% endfor %} {{ bar('top') }} {% else %}

    {{ _('Open each dataset to add what is missing.') }}

    {% endif %}
    {% if assign %}{% endif %} {% for dataset in data.rows %} {% set editable = assign and dataset.id in assign.ids %} {# Edit opens the dataset's form at the field itself. #} {% macro edit_link(field) %}{% if editable %} {{ _('Edit') }} {{ dataset.title }}{% endif %}{% endmacro %} {% if assign %}{% endif %} {% if not dataset.publisher_field %} {% elif dataset.has_publisher %} {% else %}{% endif %} {% if not dataset.contact_point_field %} {% elif dataset.has_contact_point %} {% else %}{% endif %} {% endfor %}
    {{ _('Select') }}{{ _('Dataset') }}{{ _('Publisher') }}{{ _('Contact point') }}
    {% if editable %}{% endif %} {{ dataset.title }}{% if dataset.private %} {{ _('Private') }}{% endif %}
    {% if dataset.organization %}{{ dataset.organization }}{% endif %}{% if dataset.organization and dataset.modified %} · {% endif %}{% if dataset.modified %}{{ _('Updated {date}').format(date=h.render_datetime(dataset.modified)) }}{% endif %}
    {{ _('No such field') }}{{ dataset.publisher_name or _('Set') }}{{ edit_link('publisher_actor_id') }}{% if editable %}{{ choices('publisher_for_' ~ dataset.id, 'publisher-for-' ~ dataset.id, _('Publisher of {title}').format(title=dataset.title), assign.actors, 'publisher', label_hidden=true, small=true) }}{% else %}{{ _('Missing') }}{% endif %}{{ _('No such field') }}{{ dataset.contact_point_names|select|join(', ') or _('Set') }}{{ edit_link('contact_point_ids') }}{% if editable %}{{ choices('contact_point_for_' ~ dataset.id, 'contact-point-for-' ~ dataset.id, _('Contact point of {title}').format(title=dataset.title), assign.contact_points, 'contact_point', label_hidden=true, small=true, option_label=contact_point_label) }}{% else %}{{ _('Missing') }}{% endif %}
    {% if assign %} {{ bar('bottom') }}
    {#- "Create new…" in a list opens one of these (assign-links.js); it is saved at once, like the dataset form's quick create, and chosen in that list. -#} {% for kind, title, endpoint in [('publisher', _('New publisher'), h.url_for('actor_registry.actors_quick_create')), ('contact_point', _('New contact point'), h.url_for('actor_registry.contactpoints_quick_create'))] %}

    {{ title }}

    {{ h.csrf_input() }}
    {% if kind == 'publisher' %}
    {% else %}
    {% endif %}

    {{ _('You can add more details on its own page later.') }}

    {% endfor %} {% endif %} {{ pager.pager() }} {% endif %} {% endblock %}