src/templates/_index.twig
{% extends '_layouts/cp' %}
{% set canHaveDrafts = false %}
{% set title = 'Exports'|t('exporter') %}
{% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%}
{% do view.registerTranslations('exporter', [
'New export'
]) %}
{% block content %}
<div id="exporter-vue-admin-table"></div>
{% endblock %}
{% set tableData = [] %}
{% for export in exports %}
{% set tableData = tableData|merge([{
id: export.id,
title: export.name,
url: export.getCpEditUrl(),
elementType: export.elementType,
dateCreated: craft.app.formatter.asDatetime(export.dateCreated)
}]) %}
{% endfor %}
{% set actions = [] %}
{% set columns = [
{ name: '__slot:title', title: "Name" },
{ name: 'elementType', title: "Element Type" },
{ name: 'dateCreated', title: "Date Created", sortField: 'dateCreated'},
] %}
{% js %}
new Craft.VueAdminTable({
container: '#exporter-vue-admin-table',
columns: {{ columns|json_encode|raw }},
tableData: {{ tableData|json_encode|raw }},
deleteAction: {{ currentUser.can('exporter-deleteExports') ? '\'exporter/element/delete\'' : 0 }},
emptyMessage: 'No exports available',
checkboxes: false,
allowMultipleSelections: false,
search: true,
searchPlaceholder: 'Search exporter by name'
});
{% endjs %}
{% block actionButton %}
{% if currentUser.can('exporter-createExports') %}
{{ tag('a', {
class: 'btn submit add icon',
href: cpUrl('exporter/create'),
text: 'New export'|t('exporter'),
}) }}
{% endif %}
{% endblock %}