Skip to content

Commit

Permalink
Use bsae list template for flows as well
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Oct 18, 2024
1 parent 9d80e65 commit c70ffde
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 106 deletions.
194 changes: 89 additions & 105 deletions templates/flows/flow_list.html
Original file line number Diff line number Diff line change
@@ -1,112 +1,96 @@
{% extends "smartmin/list.html" %}
{% extends "orgs/base/list.html" %}
{% load smartmin temba i18n humanize %}

{% block content %}
{% if org_perms.flows.flow_results %}
<temba-modax header="{% trans "Export Results" %}" id="export-results">
</temba-modax>
{% endif %}
{% if org_perms.flows.flowlabel_create %}
<temba-modax header="{% trans "Create Label" %}"
endpoint="{% url 'flows.flowlabel_create' %}"
-temba-loaded="handleCreateLabelModalLoaded"
-temba-submitted="handleCreateLabelModalSubmitted"
id="create-label-modal">
</temba-modax>
{% endif %}
<form method="get" action="{{ request.path }}" id="search-form">
<temba-textinput placeholder="{% trans "Search" %}" name="search" value="{{ search }}" class="w-full">
</temba-textinput>
<input type="submit" class="hide">
</form>
<div class="mt-4 shadow rounded-lg rounded-bl-none rounded-br-none bg-white">{% include "includes/short_pagination.html" %}</div>
<div class="flex-grow overflow-y-auto shadow">
<table class="relative list object-list lined selectable scrolled">
{% if object_list %}
<thead>
<tr>
{% if org_perms.flows.flow_update %}<th></th>{% endif %}
<th></th>
<th style="text-align:right" class="whitespace-nowrap">Runs / Completion</th>
</tr>
</thead>
{% block pre-table %}
<temba-modax header="{% trans "Export Results" %}" id="export-results">
</temba-modax>
<temba-modax header="{% trans "Create Label" %}"
endpoint="{% url 'flows.flowlabel_create' %}"
-temba-loaded="handleCreateLabelModalLoaded"
-temba-submitted="handleCreateLabelModalSubmitted"
id="create-label-modal">
</temba-modax>
{% endblock pre-table %}
{% block table-head %}
<tr>
{% if actions %}<th></th>{% endif %}
<th></th>
<th style="text-align:right" class="whitespace-nowrap">{% trans "Runs / Completion" %}</th>
</tr>
{% endblock table-head %}
{% block table-body %}
{% for object in object_list %}
<tr onclick="handleRowClicked(event)"
data-uuid="{{ object.uuid }}"
data-object-id="{{ object.id }}"
href="{% url 'flows.flow_editor' object.uuid %}"
class="object-row select-row">
{% if actions %}
<td onclick="checkInner(event);" style="width:0px" class="checkbox object-row-checkbox">
<temba-checkbox onclick="handleRowSelection(this)">
</temba-checkbox>
</td>
{% endif %}
<tbody>
{% for object in object_list %}
<tr onclick="handleRowClicked(event)"
data-uuid="{{ object.uuid }}"
data-object-id="{{ object.id }}"
href="{% url 'flows.flow_editor' object.uuid %}"
class="object-row select-row">
{% if org_perms.flows.flow_update %}
<td onclick="checkInner(event);" style="width:0px" class="checkbox object-row-checkbox">
<temba-checkbox onclick="handleRowSelection(this)">
</temba-checkbox>
</td>
{% endif %}
<td>
<div class="flex items-center">
<div class="flex-grow">
<div style="max-width:80%" class="flex whitespace-nowrap flex-grow items-center">
<div class="flex items-center text-gray-600">
{% if object.flow_type == 'V' %}
<temba-icon name="flow_ivr" class="mr-2">
</temba-icon>
{% elif object.flow_type == 'S' %}
<temba-icon name="flow_surveyor" class="mr-2">
</temba-icon>
{% elif object.flow_type == 'B' %}
<temba-icon name="flow_background" class="mr-2">
</temba-icon>
{% endif %}
</div>
<div class="name truncate flex-grow">{{ object.name }}</div>
</div>
</div>
<div class="whitespace-no-break flex items-center ml-2 justify-end flex-wrap">
{% for label in object.labels.all %}
<a href="{% url 'flows.flow_filter' label.uuid %}" onclick="goto(event, this)">
<temba-label data-id="{{ label.id }}" icon="label" clickable class="mx-1 my-1">
{{ label.name }}
</temba-label>
</a>
{% endfor %}
</div>
<td>
<div class="flex items-center">
<div class="flex-grow">
<div style="max-width:80%" class="flex whitespace-nowrap flex-grow items-center">
<div class="flex items-center text-gray-600">
{% if object.flow_type == 'V' %}
<temba-icon name="flow_ivr" class="mr-2">
</temba-icon>
{% elif object.flow_type == 'S' %}
<temba-icon name="flow_surveyor" class="mr-2">
</temba-icon>
{% elif object.flow_type == 'B' %}
<temba-icon name="flow_background" class="mr-2">
</temba-icon>
{% endif %}
</div>
</td>
<td>
{% if not object.is_archived %}
<div class="whitespace-no-break flex items-center justify-end">
{% if object.has_issues %}
<div>
<temba-tip position="top" text="{{ _("Has issues") |escapejs }}" slot="toggle">
<temba-icon name="issue" class="mr-2" clickable="true">
</temba-icon>
</temba-tip>
</div>
{% endif %}
{% if object.run_stats.total %}
<div onclick="goto(event)"
href="{% url "flows.flow_results" object.uuid %}"
class="linked mr-2 whitespace-nowrap">{{ object.run_stats.total|intcomma }}</div>
/
<div onclick="goto(event)"
href="{% url "flows.flow_results" object.uuid %}"
class="text-center linked mx-2 whitespace-nowrap">{{ object.run_stats.completion }}%</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
{% empty %}
<tr class="empty_list">
<td colspan="99" class="text-center">{% trans "No flows" %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}
<div class="name truncate flex-grow">{{ object.name }}</div>
</div>
</div>
<div class="whitespace-no-break flex items-center ml-2 justify-end flex-wrap">
{% for label in object.labels.all %}
<a href="{% url 'flows.flow_filter' label.uuid %}" onclick="goto(event, this)">
<temba-label data-id="{{ label.id }}" icon="label" clickable class="mx-1 my-1">
{{ label.name }}
</temba-label>
</a>
{% endfor %}
</div>
</div>
</td>
<td>
{% if not object.is_archived %}
<div class="whitespace-no-break flex items-center justify-end">
{% if object.has_issues %}
<div>
<temba-tip position="top" text="{{ _("Has issues") |escapejs }}" slot="toggle">
<temba-icon name="issue" class="mr-2" clickable="true">
</temba-icon>
</temba-tip>
</div>
{% endif %}
{% if object.run_stats.total %}
<div onclick="goto(event)"
href="{% url "flows.flow_results" object.uuid %}"
class="linked mr-2 whitespace-nowrap">{{ object.run_stats.total|intcomma }}</div>
/
<div onclick="goto(event)"
href="{% url "flows.flow_results" object.uuid %}"
class="text-center linked mx-2 whitespace-nowrap">{{ object.run_stats.completion }}%</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
{% empty %}
<tr class="empty_list">
<td colspan="99" class="text-center">{% trans "No flows" %}</td>
</tr>
{% endfor %}
{% endblock table-body %}
{% block extra-script %}
{{ block.super }}
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion templates/orgs/base/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% endif %}
<div class="mt-4 shadow rounded-lg rounded-bl-none rounded-br-none bg-white">{% include "includes/short_pagination.html" %}</div>
<div class="flex-grow overflow-y-auto shadow">
<table class="list lined scrolled">
<table class="list lined scrolled {% if actions %}selectable{% endif %}">
<thead>
{% block table-head %}
{% endblock table-head %}
Expand Down

0 comments on commit c70ffde

Please sign in to comment.