Skip to content

Commit

Permalink
Merge pull request #6795 from getkirby/v5/changes/develop
Browse files Browse the repository at this point in the history
Changes
  • Loading branch information
bastianallgeier authored Nov 20, 2024
2 parents ee93089 + a4c6d28 commit a13ae75
Show file tree
Hide file tree
Showing 146 changed files with 5,634 additions and 4,533 deletions.
2 changes: 1 addition & 1 deletion config/api/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
return function ($kirby) {
$routes = [
...include __DIR__ . '/routes/auth.php',
...include __DIR__ . '/routes/changes.php',
...include __DIR__ . '/routes/pages.php',
...include __DIR__ . '/routes/roles.php',
...include __DIR__ . '/routes/site.php',
...include __DIR__ . '/routes/users.php',
...include __DIR__ . '/routes/files.php',
...include __DIR__ . '/routes/lock.php',
...include __DIR__ . '/routes/system.php',
...include __DIR__ . '/routes/translations.php'
];
Expand Down
37 changes: 37 additions & 0 deletions config/api/routes/changes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Kirby\Api\Controller\Changes;
use Kirby\Cms\App;
use Kirby\Cms\Find;

return [
[
'pattern' => '(:all)/changes/discard',
'method' => 'POST',
'action' => function (string $path) {
return Changes::discard(
model: Find::parent($path),
);
}
],
[
'pattern' => '(:all)/changes/publish',
'method' => 'POST',
'action' => function (string $path) {
return Changes::publish(
model: Find::parent($path),
input: App::instance()->request()->get()
);
}
],
[
'pattern' => '(:all)/changes/save',
'method' => 'POST',
'action' => function (string $path) {
return Changes::save(
model: Find::parent($path),
input: App::instance()->request()->get()
);
}
],
];
56 changes: 0 additions & 56 deletions config/api/routes/lock.php

This file was deleted.

1 change: 0 additions & 1 deletion config/areas/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'dialogs' => require __DIR__ . '/account/dialogs.php',
'drawers' => require __DIR__ . '/account/drawers.php',
'dropdowns' => require __DIR__ . '/account/dropdowns.php',
'requests' => require __DIR__ . '/account/requests.php',
'views' => require __DIR__ . '/account/views.php'
];
};
41 changes: 0 additions & 41 deletions config/areas/account/requests.php

This file was deleted.

9 changes: 1 addition & 8 deletions config/areas/files/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@
$oldUrl = $file->panel()->url(true);
$newUrl = $renamed->panel()->url(true);
$response = [
'event' => 'file.changeName',
'dispatch' => [
'content/move' => [
$oldUrl,
$newUrl
]
],
'event' => 'file.changeName'
];

// check for a necessary redirect after the filename has changed
Expand Down Expand Up @@ -163,7 +157,6 @@

return [
'event' => 'file.delete',
'dispatch' => ['content/remove' => [$url]],
'redirect' => $redirect
];
}
Expand Down
49 changes: 0 additions & 49 deletions config/areas/files/requests.php

This file was deleted.

14 changes: 11 additions & 3 deletions config/areas/site/buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
use Kirby\Cms\Site;
use Kirby\Panel\Ui\Buttons\LanguagesDropdown;
use Kirby\Panel\Ui\Buttons\PageStatusButton;
use Kirby\Panel\Ui\Buttons\PreviewButton;
use Kirby\Panel\Ui\Buttons\PreviewDropdownButton;
use Kirby\Panel\Ui\Buttons\SettingsButton;

return [
'site.preview' => function (Site $site) {
return new PreviewButton(link: $site->url());
return new PreviewDropdownButton(
open: $site->url(),
preview: $site->panel()->url(true) . '/preview/compare',
copy: $site->url(),
);
},
'page.preview' => function (Page $page) {
if ($page->permissions()->can('preview') === true) {
return new PreviewButton(link: $page->previewUrl());
return new PreviewDropdownButton(
open: $page->previewUrl(),
preview: $page->panel()->url(true) . '/preview/compare',
copy: $page->previewUrl(),
);
}
},
'page.settings' => function (Page $page) {
Expand Down
28 changes: 6 additions & 22 deletions config/areas/site/dialogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,11 @@

// the slug changed
if ($page->slug() !== $slug) {
$newPage = $page->changeSlug($slug);
$response['event'][] = 'page.changeSlug';
$response['dispatch'] = [
'content/move' => [
$oldUrl = $page->panel()->url(true),
$newUrl = $newPage->panel()->url(true)
]
];

$newPage = $page->changeSlug($slug);
$oldUrl = $page->panel()->url(true);
$newUrl = $newPage->panel()->url(true);

// check for a necessary redirect after the slug has changed
if (Panel::referrer() === $oldUrl && $oldUrl !== $newUrl) {
Expand Down Expand Up @@ -383,7 +380,6 @@

return [
'event' => 'page.delete',
'dispatch' => ['content/remove' => [$url]],
'redirect' => $redirect
];
}
Expand Down Expand Up @@ -554,13 +550,7 @@

return [
'event' => 'page.move',
'redirect' => $newPage->panel()->url(true),
'dispatch' => [
'content/move' => [
$oldPage->panel()->url(true),
$newPage->panel()->url(true)
]
],
'redirect' => $newPage->panel()->url(true)
];
}
],
Expand Down Expand Up @@ -641,13 +631,7 @@
'changes' => [
'pattern' => 'changes',
'load' => function () {
$dialog = new ChangesDialog();
return $dialog->load();
return (new ChangesDialog())->load();
},
'submit' => function () {
$dialog = new ChangesDialog();
$ids = App::instance()->request()->get('ids');
return $dialog->submit($ids);
}
],
];
Loading

0 comments on commit a13ae75

Please sign in to comment.