💄 (admin): rework contents page

This commit is contained in:
Kazhnuz 2025-01-18 15:11:02 +01:00
parent ef6dc0bd30
commit d6cfe59983

View file

@ -15,7 +15,7 @@ function table($type) {
if ($type=='published') {
$list = $published;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo '<p class="alert alert-warning">';
echo $L->g('There are no pages at this moment.');
echo '</p>';
return false;
@ -23,7 +23,7 @@ function table($type) {
} elseif ($type=='draft') {
$list = $drafts;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo '<p class="alert alert-warning">';
echo $L->g('There are no draft pages at this moment.');
echo '</p>';
return false;
@ -31,7 +31,7 @@ function table($type) {
} elseif ($type=='scheduled') {
$list = $scheduled;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo '<p class="alert alert-warning">';
echo $L->g('There are no scheduled pages at this moment.');
echo '</p>';
return false;
@ -39,7 +39,7 @@ function table($type) {
} elseif ($type=='static') {
$list = $static;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo '<p class="alert alert-warning">';
echo $L->g('There are no static pages at this moment.');
echo '</p>';
return false;
@ -47,7 +47,7 @@ function table($type) {
} elseif ($type=='sticky') {
$list = $sticky;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo '<p class="alert alert-warning">';
echo $L->g('There are no sticky pages at this moment.');
echo '</p>';
return false;
@ -57,9 +57,10 @@ function table($type) {
}
echo '
<table class="table mt-3">
<div class="card">
<table class="table m-0">
<thead>
<tr>
<tr class="card-header">
<th class="border-0" scope="col">'.$L->g('Title').'</th>
';
@ -67,7 +68,7 @@ function table($type) {
echo '<th class="border-0 d-none d-lg-table-cell" scope="col">'.$L->g('URL').'</th>';
}
echo ' <th class="border-0 text-center d-sm-table-cell" scope="col">'.$L->g('Actions').'</th>
echo ' <th class="border-0 text-end d-sm-table-cell" scope="col">'.$L->g('Actions').'</th>
</tr>
</thead>
<tbody>
@ -78,7 +79,7 @@ function table($type) {
try {
$page = new Page($pageKey);
if (!$page->isChild()) {
echo '<tr>
echo '<tr class="card-tablebody">
<td>
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
@ -95,11 +96,11 @@ function table($type) {
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
if (count($page->children())==0) {
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
echo '<a href="#" class="ml-2 btn btn-sm btn-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
}
echo '</td>';
@ -107,7 +108,7 @@ function table($type) {
foreach ($page->children() as $child) {
//if ($child->published()) {
echo '<tr>
echo '<tr class="card-tablebody">
<td class="child">
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">'
@ -124,12 +125,12 @@ function table($type) {
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
if ($type=='published' || $type=='static' || $type=='sticky') {
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$child->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$child->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
}
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
echo '<a class="ml-2 text-danger deletePageButton d-block d-sm-inline" href="#" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$child->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
echo '<a class="ml-2 btn btn-sm btn-danger deletePageButton d-block d-sm-inline" href="#" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$child->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
echo '</td>';
echo '</tr>';
@ -144,7 +145,7 @@ function table($type) {
foreach ($list as $pageKey) {
try {
$page = new Page($pageKey);
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td class="pt-3">
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
@ -161,13 +162,13 @@ function table($type) {
echo '<td class="pt-3 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
if ($type=='published' || $type=='static' || $type=='sticky') {
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
}
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
if (count($page->children())==0) {
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-bs-toggle="modal" data-bs-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
echo '<a href="#" class="ml-2 btn btn-sm btn-danger deletePageButton d-block d-sm-inline" data-bs-toggle="modal" data-bs-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
}
echo '</td>';
@ -181,13 +182,14 @@ function table($type) {
echo '
</tbody>
</table>
</div>
';
}
?>
<!-- TABS -->
<ul class="nav nav-tabs" role="tablist">
<ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="pages-tab" data-bs-toggle="tab" data-bs-target="#pages" role="tab"><?php $L->p('Pages') ?></button>
</li>