Change tables to datatables

master
DjVinnii 4 years ago
parent cdfa94c243
commit 7d3c9d412d

@ -1,10 +1,17 @@
require('./app.css'); require('./app.css');
import 'select2'; import 'select2';
import 'admin-lte/plugins/datatables/jquery.dataTables.js';
import 'admin-lte/plugins/datatables-bs4/js/dataTables.bootstrap4.js';
import 'admin-lte/plugins/datatables-responsive/js/dataTables.responsive.js';
import 'admin-lte/plugins/datatables-responsive/js/responsive.bootstrap4.js';
jQuery("document").ready(function() { jQuery("document").ready(function() {
jQuery(".mailselect").select2({ jQuery(".mailselect").select2({
tags: true, tags: true,
tokenSeparators: [',', ' '] tokenSeparators: [',', ' ']
}) });
jQuery(".table").DataTable({
"responsive": true,
});
}); });

@ -14,6 +14,8 @@ import 'admin-lte/plugins/fontawesome-free/css/solid.css';
// AdminLTE // AdminLTE
import 'admin-lte/build/scss/adminlte.scss'; import 'admin-lte/build/scss/adminlte.scss';
import 'admin-lte/plugins/datatables-bs4/css/dataTables.bootstrap4.css';
import 'admin-lte/plugins/datatables-responsive/css/responsive.bootstrap4.css';
// import 'admin-lte/build/less/AdminLTE-without-plugins.less'; // doesn't exist // import 'admin-lte/build/less/AdminLTE-without-plugins.less'; // doesn't exist
// import 'admin-lte/build/less/select2.less'; // doesn't exist // import 'admin-lte/build/less/select2.less'; // doesn't exist
// import 'admin-lte/build/less/skins/skin-blue.less'; // doesn't exist // import 'admin-lte/build/less/skins/skin-blue.less'; // doesn't exist

@ -12,17 +12,21 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
</tr> <th>{% trans %}Email{% endtrans %}</th>
{% for admin in admins %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.admin_delete', admin=admin.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> {% for admin in admins %}
</td> <tr>
<td>{{ admin }}</td> <td>
</tr> <a href="{{ url_for('.admin_delete', admin=admin.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
{% endfor %} </td>
<td>{{ admin }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -14,26 +14,30 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Destination{% endtrans %}</th> <th>{% trans %}Email{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Destination{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Last edit{% endtrans %}</th> <th>{% trans %}Created{% endtrans %}</th>
</tr> <th>{% trans %}Last edit{% endtrans %}</th>
{% for alias in domain.aliases %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.alias_edit', alias=alias.email) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp; {% for alias in domain.aliases %}
<a href="{{ url_for('.alias_delete', alias=alias.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> <tr>
</td> <td>
<td>{{ alias }}</td> <a href="{{ url_for('.alias_edit', alias=alias.email) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp;
<td>{{ alias.destination|join(', ') or '-' }}</td> <a href="{{ url_for('.alias_delete', alias=alias.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
<td>{{ alias.comment or '' }}</td> </td>
<td>{{ alias.created_at }}</td> <td>{{ alias }}</td>
<td>{{ alias.updated_at or '' }}</td> <td>{{ alias.destination|join(', ') or '-' }}</td>
</tr> <td>{{ alias.comment or '' }}</td>
{% endfor %} <td>{{ alias.created_at }}</td>
<td>{{ alias.updated_at or '' }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -14,19 +14,23 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Name{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Name{% endtrans %}</th>
</tr> <th>{% trans %}Created{% endtrans %}</th>
{% for alternative in domain.alternatives %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.alternative_delete', alternative=alternative.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> {% for alternative in domain.alternatives %}
</td> <tr>
<td>{{ alternative }}</td> <td>
<td>{{ alternative.created_at }}</td> <a href="{{ url_for('.alternative_delete', alternative=alternative.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
</tr> </td>
{% endfor %} <td>{{ alternative }}</td>
<td>{{ alternative.created_at }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -12,40 +12,44 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Manage{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Domain name{% endtrans %}</th> <th>{% trans %}Manage{% endtrans %}</th>
<th>{% trans %}Mailbox count{% endtrans %}</th> <th>{% trans %}Domain name{% endtrans %}</th>
<th>{% trans %}Alias count{% endtrans %}</th> <th>{% trans %}Mailbox count{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Alias count{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Last edit{% endtrans %}</th> <th>{% trans %}Created{% endtrans %}</th>
</tr> <th>{% trans %}Last edit{% endtrans %}</th>
{% for domain in current_user.get_managed_domains() %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.domain_details', domain_name=domain.name) }}" title="{% trans %}Details{% endtrans %}"><i class="fa fa-list"></i></a>&nbsp; {% for domain in current_user.get_managed_domains() %}
{% if current_user.global_admin %} <tr>
<a href="{{ url_for('.domain_edit', domain_name=domain.name) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp; <td>
<a href="{{ url_for('.domain_delete', domain_name=domain.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>&nbsp; <a href="{{ url_for('.domain_details', domain_name=domain.name) }}" title="{% trans %}Details{% endtrans %}"><i class="fa fa-list"></i></a>&nbsp;
{% endif %} {% if current_user.global_admin %}
</td> <a href="{{ url_for('.domain_edit', domain_name=domain.name) }}" title="{% trans %}Edit{% endtrans %}"><i class="fas fa-pencil-alt"></i></a>&nbsp;
<td> <a href="{{ url_for('.domain_delete', domain_name=domain.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>&nbsp;
<a href="{{ url_for('.user_list', domain_name=domain.name) }}" title="{% trans %}Users{% endtrans %}"><i class="fa fa-envelope-o"></i></a>&nbsp; {% endif %}
<a href="{{ url_for('.alias_list', domain_name=domain.name) }}" title="{% trans %}Aliases{% endtrans %}"><i class="fa fa-at"></i></a>&nbsp; </td>
<a href="{{ url_for('.manager_list', domain_name=domain.name) }}" title="{% trans %}Managers{% endtrans %}"><i class="fa fa-user"></i></a>&nbsp; <td>
{% if current_user.global_admin %} <a href="{{ url_for('.user_list', domain_name=domain.name) }}" title="{% trans %}Users{% endtrans %}"><i class="far fa-envelope"></i></a>&nbsp;
<a href="{{ url_for('.alternative_list', domain_name=domain.name) }}" title="{% trans %}Alternatives{% endtrans %}"><i class="fa fa-asterisk"></i></a>&nbsp; <a href="{{ url_for('.alias_list', domain_name=domain.name) }}" title="{% trans %}Aliases{% endtrans %}"><i class="fa fa-at"></i></a>&nbsp;
{% endif %} <a href="{{ url_for('.manager_list', domain_name=domain.name) }}" title="{% trans %}Managers{% endtrans %}"><i class="fa fa-user"></i></a>&nbsp;
</td> {% if current_user.global_admin %}
<td>{{ domain.name }}</td> <a href="{{ url_for('.alternative_list', domain_name=domain.name) }}" title="{% trans %}Alternatives{% endtrans %}"><i class="fa fa-asterisk"></i></a>&nbsp;
<td>{{ domain.users | count }} / {{ '∞' if domain.max_users == -1 else domain.max_users }}</td> {% endif %}
<td>{{ domain.aliases | count }} / {{ '∞' if domain.max_aliases == -1 else domain.max_aliases }}</td> </td>
<td>{{ domain.comment or '' }}</td> <td>{{ domain.name }}</td>
<td>{{ domain.created_at }}</td> <td>{{ domain.users | count }} / {{ '∞' if domain.max_users == -1 else domain.max_users }}</td>
<td>{{ domain.updated_at or '' }}</td> <td>{{ domain.aliases | count }} / {{ '∞' if domain.max_aliases == -1 else domain.max_aliases }}</td>
</tr> <td>{{ domain.comment or '' }}</td>
{% endfor %} <td>{{ domain.created_at }}</td>
<td>{{ domain.updated_at or '' }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -14,30 +14,34 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Endpoint{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Username{% endtrans %}</th> <th>{% trans %}Endpoint{% endtrans %}</th>
<th>{% trans %}Keep emails{% endtrans %}</th> <th>{% trans %}Username{% endtrans %}</th>
<th>{% trans %}Last check{% endtrans %}</th> <th>{% trans %}Keep emails{% endtrans %}</th>
<th>{% trans %}Status{% endtrans %}</th> <th>{% trans %}Last check{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Status{% endtrans %}</th>
<th>{% trans %}Last edit{% endtrans %}</th> <th>{% trans %}Created{% endtrans %}</th>
</tr> <th>{% trans %}Last edit{% endtrans %}</th>
{% for fetch in user.fetches %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.fetch_edit', fetch_id=fetch.id) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp; {% for fetch in user.fetches %}
<a href="{{ url_for('.fetch_delete', fetch_id=fetch.id) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> <tr>
</td> <td>
<td>{{ fetch.protocol }}{{ 's' if fetch.tls else '' }}://{{ fetch.host }}:{{ fetch.port }}</td> <a href="{{ url_for('.fetch_edit', fetch_id=fetch.id) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp;
<td>{{ fetch.username }}</td> <a href="{{ url_for('.fetch_delete', fetch_id=fetch.id) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
<td>{% if fetch.keep %}{% trans %}yes{% endtrans %}{% else %}{% trans %}no{% endtrans %}{% endif %}</td> </td>
<td>{{ fetch.last_check or '-' }}</td> <td>{{ fetch.protocol }}{{ 's' if fetch.tls else '' }}://{{ fetch.host }}:{{ fetch.port }}</td>
<td>{{ fetch.error or '-' }}</td> <td>{{ fetch.username }}</td>
<td>{{ fetch.created_at }}</td> <td>{% if fetch.keep %}{% trans %}yes{% endtrans %}{% else %}{% trans %}no{% endtrans %}{% endif %}</td>
<td>{{ fetch.updated_at or '' }}</td> <td>{{ fetch.last_check or '-' }}</td>
</tr> <td>{{ fetch.error or '-' }}</td>
{% endfor %} <td>{{ fetch.created_at }}</td>
<td>{{ fetch.updated_at or '' }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -86,11 +86,9 @@
{% macro table(theme="primary") %} {% macro table(theme="primary") %}
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="box box-{{ theme }}"> <div class="card card-{{ theme }}">
<table class="table table-bordered"> <table class="table table-bordered">
<tbody>
{{ caller() }} {{ caller() }}
</tbody>
</table> </table>
</div> </div>
</div> </div>

@ -14,10 +14,13 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
</tr> <th>{% trans %}Email{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% for manager in domain.managers %} {% for manager in domain.managers %}
<tr> <tr>
<td> <td>
@ -26,5 +29,6 @@
<td>{{ manager }}</td> <td>{{ manager }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -12,26 +12,30 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Domain name{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Remote host{% endtrans %}</th> <th>{% trans %}Domain name{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Remote host{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Last edit{% endtrans %}</th> <th>{% trans %}Created{% endtrans %}</th>
</tr> <th>{% trans %}Last edit{% endtrans %}</th>
{% for relay in relays %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.relay_edit', relay_name=relay.name) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp; {% for relay in relays %}
<a href="{{ url_for('.relay_delete', relay_name=relay.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>&nbsp; <tr>
</td> <td>
<td>{{ relay.name }}</td> <a href="{{ url_for('.relay_edit', relay_name=relay.name) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp;
<td>{{ relay.smtp or '-' }}</td> <a href="{{ url_for('.relay_delete', relay_name=relay.name) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>&nbsp;
<td>{{ relay.comment or '' }}</td> </td>
<td>{{ relay.created_at }}</td> <td>{{ relay.name }}</td>
<td>{{ relay.updated_at or '' }}</td> <td>{{ relay.smtp or '-' }}</td>
</tr> <td>{{ relay.comment or '' }}</td>
{% endfor %} <td>{{ relay.created_at }}</td>
<td>{{ relay.updated_at or '' }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -14,21 +14,25 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Authorized IP{% endtrans %}</th> <th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Authorized IP{% endtrans %}</th>
</tr> <th>{% trans %}Created{% endtrans %}</th>
{% for token in user.tokens %} </tr>
<tr> </thead>
<td> <tbody>
<a href="{{ url_for('.token_delete', token_id=token.id) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> {% for token in user.tokens %}
</td> <tr>
<td>{{ token.comment }}</td> <td>
<td>{{ token.ip or "any" }}</td> <a href="{{ url_for('.token_delete', token_id=token.id) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
<td>{{ token.created_at }}</td> </td>
</tr> <td>{{ token.comment }}</td>
{% endfor %} <td>{{ token.ip or "any" }}</td>
<td>{{ token.created_at }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

@ -14,37 +14,41 @@
{% block content %} {% block content %}
{% call macros.table() %} {% call macros.table() %}
<tr> <thead>
<th>{% trans %}Actions{% endtrans %}</th> <tr>
<th>{% trans %}User settings{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}User settings{% endtrans %}</th>
<th>{% trans %}Features{% endtrans %}</th> <th>{% trans %}Email{% endtrans %}</th>
<th>{% trans %}Quota{% endtrans %}</th> <th>{% trans %}Features{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Quota{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th> <th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Last edit{% endtrans %}</th> <th>{% trans %}Created{% endtrans %}</th>
</tr> <th>{% trans %}Last edit{% endtrans %}</th>
{% for user in domain.users %} </tr>
<tr {% if not user.enabled %}class="warning"{% endif %}> </thead>
<td> <tbody>
<a href="{{ url_for('.user_edit', user_email=user.email) }}" title="{% trans %}Edit{% endtrans %}"><i class="fa fa-pencil"></i></a>&nbsp; {% for user in domain.users %}
<a href="{{ url_for('.user_delete', user_email=user.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a> <tr {% if not user.enabled %}class="warning"{% endif %}>
</td> <td>
<td> <a href="{{ url_for('.user_edit', user_email=user.email) }}" title="{% trans %}Edit{% endtrans %}"><i class="fas fa-pencil-alt"></i></a>&nbsp;
<a href="{{ url_for('.user_settings', user_email=user.email) }}" title="{% trans %}Settings{% endtrans %}"><i class="fa fa-wrench"></i></a>&nbsp; <a href="{{ url_for('.user_delete', user_email=user.email) }}" title="{% trans %}Delete{% endtrans %}"><i class="fa fa-trash"></i></a>
<a href="{{ url_for('.user_reply', user_email=user.email) }}" title="{% trans %}Auto-reply{% endtrans %}"><i class="fa fa-plane"></i></a>&nbsp; </td>
<a href="{{ url_for('.fetch_list', user_email=user.email) }}" title="{% trans %}Fetched accounts{% endtrans %}"><i class="fa fa-download"></i></a>&nbsp; <td>
</td> <a href="{{ url_for('.user_settings', user_email=user.email) }}" title="{% trans %}Settings{% endtrans %}"><i class="fa fa-wrench"></i></a>&nbsp;
<td>{{ user }}</td> <a href="{{ url_for('.user_reply', user_email=user.email) }}" title="{% trans %}Auto-reply{% endtrans %}"><i class="fa fa-plane"></i></a>&nbsp;
<td> <a href="{{ url_for('.fetch_list', user_email=user.email) }}" title="{% trans %}Fetched accounts{% endtrans %}"><i class="fa fa-download"></i></a>&nbsp;
{% if user.enable_imap %}<span class="label label-info">imap</span>{% endif %} </td>
{% if user.enable_pop %}<span class="label label-info">pop3</span>{% endif %} <td>{{ user }}</td>
</td> <td>
<td>{{ user.quota_bytes_used | filesizeformat }} / {{ (user.quota_bytes | filesizeformat) if user.quota_bytes else '∞' }}</td> {% if user.enable_imap %}<span class="label label-info">imap</span>{% endif %}
<td>{{ user.comment or '-' }}</td> {% if user.enable_pop %}<span class="label label-info">pop3</span>{% endif %}
<td>{{ user.created_at }}</td> </td>
<td>{{ user.updated_at or '' }}</td> <td>{{ user.quota_bytes_used | filesizeformat }} / {{ (user.quota_bytes | filesizeformat) if user.quota_bytes else '∞' }}</td>
</tr> <td>{{ user.comment or '-' }}</td>
{% endfor %} <td>{{ user.created_at }}</td>
<td>{{ user.updated_at or '' }}</td>
</tr>
{% endfor %}
</tbody>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

Loading…
Cancel
Save