Skip to content

Commit

Permalink
Merge pull request #5586 from nyaruka/cleanup_trigger_list_template
Browse files Browse the repository at this point in the history
Cleanup trigger list template
  • Loading branch information
rowanseymour authored Oct 25, 2024
2 parents f27867a + 0d14497 commit a3cf135
Showing 1 changed file with 84 additions and 100 deletions.
184 changes: 84 additions & 100 deletions templates/triggers/trigger_list.html
Original file line number Diff line number Diff line change
@@ -1,107 +1,91 @@
{% extends "smartmin/list.html" %}
{% load smartmin sms temba compress humanize i18n %}
{% extends "orgs/base/list.html" %}
{% load smartmin temba i18n %}

{% block content %}
<div id="pjax"></div>
{% block pjax %}
<temba-dialog header="{{ _("Delete All Triggers") |escapejs }}"
primaryButtonName="{{ _("Delete") |escapejs }}"
destructive="true"
class="hide"
id="delete-all-confirmation">
<div class="p-6">
{% blocktrans trimmed with count=paginator.count %}
Are you sure you want to delete all {{ count }} archived triggers? This cannot be undone.
{% block modaxes %}
<temba-modax id="update-trigger">
</temba-modax>
<temba-dialog header="{{ _("Delete All Triggers") |escapejs }}"
primaryButtonName="{{ _("Delete") |escapejs }}"
destructive="true"
class="hide"
id="delete-all-confirmation">
<div class="p-6">
{% blocktrans trimmed with count=paginator.count %}
Are you sure you want to delete all {{ count }} archived triggers? This cannot be undone.
{% endblocktrans %}
{% if paginator.count > 50 %}
<br>
<br>
{% blocktrans trimmed %}
This operation can take a while to complete. Triggers may remain in this view during the process.
{% endblocktrans %}
{% if paginator.count > 50 %}
<br>
<br>
{% blocktrans trimmed %}
This operation can take a while to complete. Triggers may remain in this view during the process.
{% endblocktrans %}
{% endif %}
</div>
</temba-dialog>
<temba-dialog header="{{ _("Delete Selected Triggers") |escapejs }}"
primaryButtonName="{{ _("Delete") |escapejs }}"
destructive="true"
class="hide"
id="delete-confirmation">
<div class="p-6">{% trans "Are you sure you want to delete the selected triggers? This cannot be undone." %}</div>
</temba-dialog>
{% endblock pjax %}
<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" %}
{% if paginator.is_es_search and not page_obj.has_next_page and page_obj.number == paginator.num_pages and paginator.count > 10000 %}
<div class="text-gray-400 text-sm self-end mt-2">{% trans "To view more than 10,000 search results, save it as a group." %}</div>
{% endif %}
</div>
<div class="flex-grow overflow-y-auto shadow">
<table class="{% if org_perms.flows.flow_update %}selectable{% endif %} list scrolled lined selectable">
<tbody>
{% for obj in object_list %}
<tr data-object-id="{{ obj.id }}"
onclick="updateTrigger(event, {{ obj.id }})"
class="trigger object-row">
{% if org_perms.triggers.trigger_update %}
<td onclick="checkInner(event);" class="trigger checkbox object-row-checkbox" width="32px">
<temba-checkbox onclick="handleRowSelection(this)">
</temba-checkbox>
</td>
{% endif %}
<td>
<div>
<div style="max-width:80%" class="flex flex-grow items-center">
<div class="flex items-center mr-2">
<temba-icon name="trigger_{{ obj.type.slug }}" class="text-gray-600">
</temba-icon>
</div>
<div class="flex-grow">
{% with "triggers/types/"|add:obj.type.slug|add:"/desc.html" as type_template %}
{% include type_template with trigger=obj %}
{% endwith %}
</div>
</div>
{% if obj.channel or obj.contacts.all or obj.groups.all or obj.exclude_groups.all %}
<div class="text-sm mt-2">
{% if obj.channel %}
{# djlint:off #}
<a href="{% url 'channels.channel_read' obj.channel.uuid %}" onclick="goto(event, this)"><temba-label icon="{{ obj.channel.type.icon }}" clickable class="mr-1 mb-1">{{ obj.channel }}</temba-label></a>
{# djlint:on #}
{% endif %}
{% include "includes/recipients.html" with contacts=obj.contacts.all groups=obj.groups.all exclude_groups=obj.exclude_groups.all groups_as_filters=True %}
</div>
{% endif %}
</div>
{% endif %}
</div>
</temba-dialog>
<temba-dialog header="{{ _("Delete Selected Triggers") |escapejs }}"
primaryButtonName="{{ _("Delete") |escapejs }}"
destructive="true"
class="hide"
id="delete-confirmation">
<div class="p-6">{% trans "Are you sure you want to delete the selected triggers? This cannot be undone." %}</div>
</temba-dialog>
{% endblock modaxes %}
{% block table %}
<table class="{% if actions %}selectable{% endif %} list scrolled lined selectable">
<tbody>
{% for obj in object_list %}
<tr data-object-id="{{ obj.id }}"
onclick="updateTrigger(event, {{ obj.id }})"
class="trigger object-row">
{% if org_perms.triggers.trigger_update %}
<td onclick="checkInner(event);" class="trigger checkbox object-row-checkbox" width="32px">
<temba-checkbox onclick="handleRowSelection(this)">
</temba-checkbox>
</td>
<td>
<div class="text-right">
<a href="{% url 'flows.flow_editor' obj.flow.uuid %}" onclick="goto(event, this)">
<temba-label icon="flow" primary clickable class="mx-1 my-1">
{{ obj.flow.name }}
</temba-label>
</a>
{% endif %}
<td>
<div>
<div style="max-width:80%" class="flex flex-grow items-center">
<div class="flex items-center mr-2">
<temba-icon name="trigger_{{ obj.type.slug }}" class="text-gray-600">
</temba-icon>
</div>
<div class="flex-grow">
{% with "triggers/types/"|add:obj.type.slug|add:"/desc.html" as type_template %}
{% include type_template with trigger=obj %}
{% endwith %}
</div>
</div>
</td>
</tr>
{% empty %}
<tr class="empty_list">
<td colspan="99" class="text-center">{% trans "No triggers" %}</td>
</tr>
{% endfor %}
</tbody>
{% block extra-rows %}
{% endblock extra-rows %}
</table>
</div>
<temba-modax id="update-trigger">
</temba-modax>
{% endblock content %}
{% if obj.channel or obj.contacts.all or obj.groups.all or obj.exclude_groups.all %}
<div class="text-sm mt-2">
{% if obj.channel %}
{# djlint:off #}
<a href="{% url 'channels.channel_read' obj.channel.uuid %}" onclick="goto(event, this)"><temba-label icon="{{ obj.channel.type.icon }}" clickable class="mr-1 mb-1">{{ obj.channel }}</temba-label></a>
{# djlint:on #}
{% endif %}
{% include "includes/recipients.html" with contacts=obj.contacts.all groups=obj.groups.all exclude_groups=obj.exclude_groups.all groups_as_filters=True %}
</div>
{% endif %}
</div>
</td>
<td>
<div class="text-right">
<a href="{% url 'flows.flow_editor' obj.flow.uuid %}" onclick="goto(event, this)">
<temba-label icon="flow" primary clickable class="mx-1 my-1">
{{ obj.flow.name }}
</temba-label>
</a>
</div>
</td>
</tr>
{% empty %}
<tr class="empty_list">
<td colspan="99" class="text-center">{% trans "No triggers" %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock table %}
{% block extra-script %}
{{ block.super }}
<script type="text/javascript">
Expand Down

0 comments on commit a3cf135

Please sign in to comment.