2022-04-17 21:04:21 +00:00
|
|
|
{% extends "index.twig" %}
|
|
|
|
|
|
|
|
{% block title %}Items{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="uk-container uk-margin">
|
|
|
|
<h1 class="uk-article-title">Items</h1>
|
2022-04-19 03:49:18 +00:00
|
|
|
{{ block("messages_queue", "message_queue.twig") }}
|
|
|
|
<a class="uk-button uk-button-default" href="{{ route() }}index.php/item?task=create">Create</a>
|
|
|
|
{% if list %}
|
2022-04-17 21:04:21 +00:00
|
|
|
<table class="uk-table uk-table-justify uk-table-divider">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2022-04-19 03:49:18 +00:00
|
|
|
<th class="uk-width-small">Action</th>
|
|
|
|
<th class="uk-width-small">Title</th>
|
|
|
|
<th>Content</th>
|
|
|
|
<th class="uk-width-small">State</th>
|
|
|
|
<th>ID</th>
|
2022-04-17 21:04:21 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-04-19 03:49:18 +00:00
|
|
|
{% for item in list %}
|
2022-04-17 21:04:21 +00:00
|
|
|
<tr>
|
2022-04-19 03:49:18 +00:00
|
|
|
<td>
|
|
|
|
<div class="uk-button-group uk-width-1-1">
|
|
|
|
<a class="uk-button uk-button-default uk-button-small" href="{{ route() }}index.php/item?id={{ item.id }}&task=edit">Edit</a>
|
|
|
|
<button class="uk-button uk-button-default uk-button-small" onclick="confirmDeletion('{{ item.title }}', {{ item.id }});">Delete</button>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>{{ item.title }}</td>
|
|
|
|
<td>{% if item.introtext %}{{ shorten_string(item.introtext|striptags) }} {% endif %}{{ shorten_string(item.fulltext|striptags) }}</td>
|
|
|
|
<td>
|
|
|
|
{% if item.state == 1 %}
|
|
|
|
<button class="uk-button uk-button-primary uk-button-small uk-width-1-1">Published</button>
|
|
|
|
{% elseif item.state == 2 %}
|
|
|
|
<button class="uk-button uk-button-small uk-width-1-1" disabled>Archived</button>
|
|
|
|
{% elseif item.state == -1 %}
|
|
|
|
<button class="uk-button uk-button-danger uk-button-small uk-width-1-1">Trashed</button>
|
|
|
|
{% elseif item.state == 0 %}
|
|
|
|
<button class="uk-button uk-button-default uk-button-small uk-width-1-1">Unpublished</button>
|
|
|
|
{% else %}
|
|
|
|
Error
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
<td>{{ item.id }}</td>
|
2022-04-17 21:04:21 +00:00
|
|
|
</tr>
|
2022-04-19 03:49:18 +00:00
|
|
|
{% endfor %}
|
2022-04-17 21:04:21 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2022-04-19 03:49:18 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="uk-alert-primary" uk-alert>
|
|
|
|
<p>There has no items been found, click create to add some.</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2022-04-17 21:04:21 +00:00
|
|
|
</div>
|
2022-04-19 03:49:18 +00:00
|
|
|
<script>
|
|
|
|
function confirmDeletion(title, id){
|
|
|
|
UIkit.modal.confirm('You are about to permanently delete <b>' + title + '</b>?').then(function () {
|
|
|
|
window.open("{{ route() }}index.php/item?id=" + id + "&task=delete", "_self")
|
|
|
|
}, function () {
|
|
|
|
// we do nothing ;)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2022-04-17 21:04:21 +00:00
|
|
|
{% endblock %}
|