diff --git a/templates/batch.html b/templates/batch.html index f36a7cc..42074dc 100644 --- a/templates/batch.html +++ b/templates/batch.html @@ -1,104 +1,110 @@ {% extends "base.html" %} {% block title %}QuickCategories batch #{{ batch.id }}{% if batch.title %} ({{ render_batch_title_text(batch) }}){% endif %}{% endblock %} {% block main %}

Batch #{{ batch.id }} by {{ render_local_user(batch.local_user) }}

{% if batch.title %}

{{ render_batch_title( batch ) }}

{% endif %} {% set background_run = batch.background_runs.get_last() %} {% set currently_running = background_run and not background_run[1] %}

Targeting {{ batch.domain }}. Created {{ batch.created | render_datetime }}, last updated {{ batch.last_updated | render_datetime }}.

{% set summary = batch.command_records.get_summary() %} {% set total = summary.values() | sum %} {{ total }} command{% if total > 1 %}s{% endif -%} {%- for type, count in summary | dictsort(by='value', reverse=true) -%} , {{ count }} {{ type | render_command_record_type }} {%- endfor %} (export).

{% if background_run %}

{% if currently_running %} Running in background since {{ background_run[0][0] | render_datetime }}, reload to refresh {% else %} Ran in background from {{ background_run[0][0] | render_datetime }} to {{ background_run[1][0] | render_datetime }}{% if background_run[1][1] and background_run[1][1] != background_run[0][1] %}, stopped by {{ render_local_user(background_run[1][1]) }} {% endif %} {% endif %} (full history). {% if currently_running and can_stop_background() %} {% endif %}

{% endif %} +{% set command_records_length = batch.command_records | length %} +{% set nav %} +{% endset %} +{{ nav }} {% set command_records = batch.command_records.get_slice(offset, limit) %} -{% for command_record in command_records %} -
- {{ render_command_record(command_record, batch.domain) }} +
+ {% for command_record in command_records %} +
+ {{ render_command_record(command_record, batch.domain) }} +
+ {% endfor %}
-{% endfor %} +{{ nav }} {% set can_run_command_records = can_run_commands(command_records) %} {% set can_start_new_background = can_start_background() and not currently_running %} {% if can_run_command_records or can_start_new_background %}
{% if can_start_new_background and offset == 0 %}{# common case: on the first page, we emphasize the background running and tuck the foreground run button away #}
{% if offset + limit < command_records_length %}{# new users often don’t notice that the rest of the batch isn’t run in this mode #} This will not run the other commands in the batch. {% endif %}
{% else %}{# on pages other than the first one, put the foreground run first under the assumption that users care about this particular page; but to avoid confusing them, primary/secondary aren’t swapped (background is still primary)#} {% if can_run_command_records %}
{% if offset > 0 or offset + limit < command_records_length %} This will not run the other commands in the batch. {% endif %}
{% endif %} {% if can_start_new_background %}
{% endif %} {% endif %}
{% endif %} {% endblock %} diff --git a/templates/batches.html b/templates/batches.html index d1bb73d..c4ed164 100644 --- a/templates/batches.html +++ b/templates/batches.html @@ -1,23 +1,27 @@ {% extends "base.html" %} {% block title %}QuickCategories batches{% endblock %} {% block main %} +{% set nav %} +{% endset %} +{{ nav }} {% include "batch_list.html" %} +{{ nav }} {% endblock %}