-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect frontend with view button classes
- Loading branch information
1 parent
60fd7b9
commit 6b169fb
Showing
30 changed files
with
244 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use Kirby\Cms\App; | ||
use Kirby\Cms\User; | ||
use Kirby\Panel\Ui\Buttons\ViewButton; | ||
|
||
return [ | ||
'user.theme' => function (App $kirby, User $user) { | ||
if ($kirby->user()->is($user) === true) { | ||
return new ViewButton(component: 'k-view-theme-button'); | ||
} | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use Kirby\Cms\File; | ||
use Kirby\Panel\Ui\Buttons\PreviewButton; | ||
use Kirby\Panel\Ui\Buttons\SettingsButton; | ||
|
||
return [ | ||
'file.preview' => function (File $file) { | ||
return new PreviewButton(link: $file->previewUrl()); | ||
}, | ||
'file.settings' => function (File $file) { | ||
return new SettingsButton(model: $file); | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use Kirby\Cms\Language; | ||
use Kirby\Panel\Ui\Buttons\PreviewButton; | ||
use Kirby\Panel\Ui\Buttons\ViewButton; | ||
use Kirby\Toolkit\I18n; | ||
|
||
return [ | ||
'languages.add' => function () { | ||
return new ViewButton( | ||
dialog: 'languages/create', | ||
icon: 'add', | ||
text: I18n::translate('language.create'), | ||
); | ||
}, | ||
'language.preview' => function (Language $language) { | ||
return new PreviewButton(link: $language->url()); | ||
}, | ||
'language.settings' => function (Language $language) { | ||
return new ViewButton( | ||
dialog: 'languages/' . $language->id() . '/update', | ||
icon: 'cog', | ||
title: I18n::translate('settings'), | ||
); | ||
}, | ||
'language.remove' => function (Language $language) { | ||
if ($language->isDeletable() === true) { | ||
return new ViewButton( | ||
dialog: 'languages/' . $language->id() . '/delete', | ||
icon: 'trash', | ||
title: I18n::translate('delete'), | ||
); | ||
} | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Kirby\Cms\Page; | ||
use Kirby\Cms\Site; | ||
use Kirby\Panel\Ui\Buttons\LanguagesButton; | ||
use Kirby\Panel\Ui\Buttons\PageStatusButton; | ||
use Kirby\Panel\Ui\Buttons\PreviewButton; | ||
use Kirby\Panel\Ui\Buttons\SettingsButton; | ||
|
||
return [ | ||
'site.preview' => function (Site $site) { | ||
return new PreviewButton(link: $site->url()); | ||
}, | ||
'page.preview' => function (Page $page) { | ||
if ($page->permissions()->can('preview') === true) { | ||
return new PreviewButton(link: $page->previewUrl()); | ||
} | ||
}, | ||
'page.settings' => function (Page $page) { | ||
return new SettingsButton(model: $page); | ||
}, | ||
'page.status' => function (Page $page) { | ||
return new PageStatusButton($page); | ||
}, | ||
// `languages` button needs to be in site area, as languages area itself | ||
// is only loaded when in multilang setup | ||
'languages' => function () { | ||
return new LanguagesButton(); | ||
}, | ||
|
||
// file buttons | ||
...require __DIR__ . '/../files/buttons.php' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
use Kirby\Cms\User; | ||
use Kirby\Panel\Ui\Buttons\SettingsButton; | ||
use Kirby\Panel\Ui\Buttons\ViewButton; | ||
use Kirby\Toolkit\I18n; | ||
|
||
return [ | ||
'users.add' => function (User $user, string|null $role = null) { | ||
return new ViewButton( | ||
dialog: 'users/create?role=' . $role, | ||
disabled: $user->role()->permissions()->for('users', 'create') !== true, | ||
icon: 'add', | ||
text: I18n::translate('user.create'), | ||
); | ||
}, | ||
'user.settings' => function (User $user) { | ||
return new SettingsButton(model: $user); | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.