add remove page
This commit is contained in:
parent
20fe525375
commit
a27cefec3f
1 changed files with 21 additions and 7 deletions
|
@ -8,6 +8,21 @@
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Functions for the view
|
// Functions for the view
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
function deletePage(key) {
|
||||||
|
var args = {
|
||||||
|
key: key
|
||||||
|
};
|
||||||
|
api.deletePage(args).then(function(response) {
|
||||||
|
if (response.status == 0) {
|
||||||
|
logs('Page deleted. Key: ' + response.data.key);
|
||||||
|
showAlertInfo("<?php $L->p('Page deleted') ?>");
|
||||||
|
$('#pagekey-'+response.data.key).addClass('disabled');
|
||||||
|
} else {
|
||||||
|
logs('An error occurred while trying to delete the page.');
|
||||||
|
showAlertError(response.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Events for the view
|
// Events for the view
|
||||||
|
@ -21,18 +36,18 @@
|
||||||
message: '<?php $L->p('Are you sure you want to delete this page') ?>',
|
message: '<?php $L->p('Are you sure you want to delete this page') ?>',
|
||||||
buttons: {
|
buttons: {
|
||||||
cancel: {
|
cancel: {
|
||||||
label: '<i class="fa fa-times"></i><?php $L->p('Cancel') ?>',
|
label: '<i class="bi bi-x"></i><?php $L->p('Cancel') ?>',
|
||||||
className: 'btn-sm btn-secondary'
|
className: 'btn-sm btn-secondary'
|
||||||
},
|
},
|
||||||
confirm: {
|
confirm: {
|
||||||
label: '<i class="fa fa-check"></i><?php $L->p('Confirm') ?>',
|
label: '<i class="bi bi-check"></i><?php $L->p('Confirm') ?>',
|
||||||
className: 'btn-sm btn-primary'
|
className: 'btn-sm btn-primary'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeButton: false,
|
closeButton: false,
|
||||||
callback: function(result) {
|
callback: function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
// delete page
|
deletePage(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -59,7 +74,6 @@
|
||||||
|
|
||||||
function table($type)
|
function table($type)
|
||||||
{
|
{
|
||||||
global $url;
|
|
||||||
global $L;
|
global $L;
|
||||||
global $published;
|
global $published;
|
||||||
global $drafts;
|
global $drafts;
|
||||||
|
@ -116,7 +130,7 @@ function table($type)
|
||||||
try {
|
try {
|
||||||
$page = new Page($pageKey);
|
$page = new Page($pageKey);
|
||||||
if (!$page->isChild()) {
|
if (!$page->isChild()) {
|
||||||
echo '<tr>';
|
echo '<tr id="pagekey-'.$pageKey.'">';
|
||||||
|
|
||||||
echo '<td class="pt-4 pb-4">
|
echo '<td class="pt-4 pb-4">
|
||||||
<div>
|
<div>
|
||||||
|
@ -142,7 +156,7 @@ function table($type)
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
foreach ($page->children() as $child) {
|
foreach ($page->children() as $child) {
|
||||||
echo '<tr>';
|
echo '<tr id="pagekey-'.$pageKey.'">';
|
||||||
|
|
||||||
echo '<td class="ps-3 pt-4 pb-4">
|
echo '<td class="ps-3 pt-4 pb-4">
|
||||||
<div>
|
<div>
|
||||||
|
@ -170,7 +184,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 id="pagekey-'.$pageKey.'">';
|
||||||
|
|
||||||
echo '<td class="pt-4 pb-4">
|
echo '<td class="pt-4 pb-4">
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue