Sort changelogs by date + make sortable in admin panel

This commit is contained in:
slawkens 2023-11-25 20:09:42 +01:00
parent 9c60beeed0
commit 1423046039
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ $next_page = false;
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
$changelogs = Changelog::isPublic()->orderByDesc('id')->limit($limit + 1)->offset($offset)->get()->toArray();
$changelogs = Changelog::isPublic()->orderByDesc('date')->limit($limit + 1)->offset($offset)->get()->toArray();
$i = 0;
foreach($changelogs as $key => &$log)

View File

@ -27,7 +27,7 @@
{% for log in changelogs %}
<tr>
<td>{{ log.id }}</td>
<td>{{ log.date|date("j.m.Y") }}</td>
<td data-sort="{{ log.date }}">{{ log.date|date("j.m.Y") }}</td>
<td>{{ truncate(log.body|raw,20) }}</td>
<td><img src="{{ constant('BASE_URL') }}images/changelog/{{ log.type }}.png" alt="icon" title="{{ log.type|capitalize }}"/> {{ log.type|capitalize }}</td>
<td><img src="{{ constant('BASE_URL') }}images/changelog/{{ log.where }}.png" alt="icon" title="{{ log.where|capitalize }}"/> {{ log.where|capitalize }}</td>
@ -75,7 +75,7 @@
$('.tb_datatable').DataTable({
"order": [[0, "desc"]],
"columnDefs": [{targets: [1, 2,4,5],orderable: false}]
"columnDefs": [{targets: [2, 5], orderable: false}]
});
});
</script>