💄 (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') { if ($type=='published') {
$list = $published; $list = $published;
if (empty($list)) { 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 $L->g('There are no pages at this moment.');
echo '</p>'; echo '</p>';
return false; return false;
@ -23,7 +23,7 @@ function table($type) {
} elseif ($type=='draft') { } elseif ($type=='draft') {
$list = $drafts; $list = $drafts;
if (empty($list)) { 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 $L->g('There are no draft pages at this moment.');
echo '</p>'; echo '</p>';
return false; return false;
@ -31,7 +31,7 @@ function table($type) {
} elseif ($type=='scheduled') { } elseif ($type=='scheduled') {
$list = $scheduled; $list = $scheduled;
if (empty($list)) { 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 $L->g('There are no scheduled pages at this moment.');
echo '</p>'; echo '</p>';
return false; return false;
@ -39,7 +39,7 @@ function table($type) {
} elseif ($type=='static') { } elseif ($type=='static') {
$list = $static; $list = $static;
if (empty($list)) { 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 $L->g('There are no static pages at this moment.');
echo '</p>'; echo '</p>';
return false; return false;
@ -47,7 +47,7 @@ function table($type) {
} elseif ($type=='sticky') { } elseif ($type=='sticky') {
$list = $sticky; $list = $sticky;
if (empty($list)) { 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 $L->g('There are no sticky pages at this moment.');
echo '</p>'; echo '</p>';
return false; return false;
@ -57,9 +57,10 @@ function table($type) {
} }
echo ' echo '
<table class="table mt-3"> <div class="card">
<table class="table m-0">
<thead> <thead>
<tr> <tr class="card-header">
<th class="border-0" scope="col">'.$L->g('Title').'</th> <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 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> </tr>
</thead> </thead>
<tbody> <tbody>
@ -78,7 +79,7 @@ function table($type) {
try { try {
$page = new Page($pageKey); $page = new Page($pageKey);
if (!$page->isChild()) { if (!$page->isChild()) {
echo '<tr> echo '<tr class="card-tablebody">
<td> <td>
<div> <div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">' <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="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;
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) { 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>'; echo '</td>';
@ -107,7 +108,7 @@ function table($type) {
foreach ($page->children() as $child) { foreach ($page->children() as $child) {
//if ($child->published()) { //if ($child->published()) {
echo '<tr> echo '<tr class="card-tablebody">
<td class="child"> <td class="child">
<div> <div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">' <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="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') { 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="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 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="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 '</td>';
echo '</tr>'; echo '</tr>';
@ -144,7 +145,7 @@ function table($type) {
foreach ($list as $pageKey) { foreach ($list as $pageKey) {
try { try {
$page = new Page($pageKey); $page = new Page($pageKey);
echo '<tr>'; echo '<tr class="card-tablebody">';
echo '<td class="pt-3"> echo '<td class="pt-3">
<div> <div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">' <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="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') { 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) { 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>'; echo '</td>';
@ -181,13 +182,14 @@ function table($type) {
echo ' echo '
</tbody> </tbody>
</table> </table>
</div>
'; ';
} }
?> ?>
<!-- TABS --> <!-- TABS -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-pills mb-3" role="tablist">
<li class="nav-item" role="presentation"> <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> <button class="nav-link active" id="pages-tab" data-bs-toggle="tab" data-bs-target="#pages" role="tab"><?php $L->p('Pages') ?></button>
</li> </li>