Skip to content

Commit

Permalink
Update long-running buttons in import listing template
Browse files Browse the repository at this point in the history
  • Loading branch information
jams2 committed Nov 10, 2023
1 parent 3c65c8a commit bc8b032
Showing 1 changed file with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailadmin_tags %}
{% load i18n wagtailadmin_tags %}

{% block titletag %}Import Airtable Sheets{% endblock %}

{% block content %}
{% include "wagtailadmin/shared/header.html" with title="Airtable Import" %}
{% include "wagtailadmin/shared/header.html" with title="Airtable Import" %}

<div class="nice-padding">
<h2>Models you can import from Airtable</h2>
{% for model_name, model_path, is_airtable_enabled, grouped_models in models %}
<h3>{{ model_name }}</h3>
{% if grouped_models %}
<div class="help-block help-info">
<p>When you import {{ model_name }} you'll also be importing these ({{ grouped_models|length }}) as well: {% for model_name in grouped_models %}{{ model_name }}{% if not forloop.last %}, {% endif %} {% endfor %}</p>
</div>
{% endif %}
{% if is_airtable_enabled %}
<form method="POST" action="{% url 'airtable_import_listing' %}">
{% csrf_token %}
<input type="hidden" name="model" value="{{ model_path }}" />

<div class="nice-padding">
<h2>Models you can import from Airtable</h2>
{% for model_name, model_path, is_airtable_enabled, grouped_models in models %}
<h3>{{ model_name }}</h3>
{% if grouped_models %}
<div class="help-block help-info">
<p>When you import {{ model_name }} you'll also be importing these ({{ grouped_models|length }}) as well: {% for model_name in grouped_models %}{{ model_name }}{% if not forloop.last %}, {% endif %} {% endfor %}</p>
</div>
{% endif %}
{% if is_airtable_enabled %}
<form method="POST" action="{% url 'airtable_import_listing' %}">
{% csrf_token %}
<input type="hidden" name="model" value="{{ model_path }}" />
<button type="submit" class="button button-longrunning" data-clicked-text="Importing...">
{% icon name="spinner" %}
<em>Import {{ model_name }}</em>
</button>
</form>
{% else %}
<em>{{ model_name }} is not setup with the correct Airtable settings</em>
{% endif %}
{% empty %}
<em>There are no models configured yet</em>
{% endfor %}
</div>
<button type="submit" class="button button-longrunning" data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value="{% trans "Importing..." %}">
{% icon name="spinner" %}
<em data-w-progress-target="label">{% blocktrans %}Import {{ model_name }}{% endblocktrans %}</em>
</button>
</form>
{% else %}
<em>{{ model_name }} is not setup with the correct Airtable settings</em>
{% endif %}
{% empty %}
<em>There are no models configured yet</em>
{% endfor %}
</div>
{% endblock %}

0 comments on commit bc8b032

Please sign in to comment.