Fix for sub-pages #1380

This commit is contained in:
Diego Najar 2021-11-11 13:37:06 +01:00
parent 2af5d5332f
commit 642d07151e
3 changed files with 12 additions and 6 deletions

View file

@ -165,11 +165,12 @@ function table($type)
echo '</tr>';
foreach ($page->children() as $child) {
echo '<tr id="pagekey-'.$pageKey.'">';
echo '<tr id="pagekey-'.$child->key().'">';
echo '<td class="ps-3 pt-4 pb-4">
echo '<td class="ps-4 pt-4 pb-4">
<div>
<i class="bi bi-file-text"></i><span>' . ($child->title() ? $child->title() : '<span class="text-muted">' . $L->g('Empty title') . '</span> ') . '</span>
<i class="bi bi-file-text"></i><span>' . ($child->title() ? $child->title() : '<span class="text-muted">' . $L->g('Empty title') . '</span> ') . '</span>
<div class="text-muted"><small><i class="bi bi-diagram-2-fill"></i>' . ($page->title() ? $page->title() : $L->g('Empty title')) . '</small></div>
</div>
<div class="mt-1">
<a class="me-2" target="_blank" href="' . $child->permalink() . '">' . $L->g('View') . '</a>

View file

@ -60,8 +60,8 @@
// Save the current page
// This function set the global variable "_pageKey"
function savePage(args = []) {
logs('Saving page.');
console.log(_pageKey);
if (_pageKey == null) {
logs('Error, page not created.');
showAlertError("Error, page not created.");
@ -69,6 +69,7 @@
}
args['pageKey'] = _pageKey;
args['parent'] = $('#parent').val();
api.savePage(args).then(function(response) {
if (response.status == 0) {
logs('Page saved. Old key: ' + _pageKey + ' / New key: ' + response.data.key);
@ -405,7 +406,7 @@
<div class="modal-content">
<div class="modal-body">
<div class="m-0">
<label for="parent" class="fw-bold mb-2"><?php echo $L->g('Page description') ?></label>
<label for="description" class="fw-bold mb-2"><?php echo $L->g('Page description') ?></label>
<textarea id="description" name="description" class="form-control" rows="3"><?php echo ($pageKey ? $page->description() : '') ?></textarea>
<div class="form-text"><?php echo $L->get('this-field-can-help-describe-the-content') ?></div>
</div>
@ -571,6 +572,9 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="m-0">
<label class="fw-bold mb-2"><?php echo $L->g('Parent page') ?></label>
</div>
<div class="col-sm-10">
<select id="parent" name="parent" class="form-select" data-current-value="" data-save="true"></select>
</div>

View file

@ -404,5 +404,6 @@
"week": "week",
"day": "day",
"hour": "hour",
"second": "second"
"second": "second",
"parent-page": "Parent page"
}