-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/Virtual Page Action Executor #1649
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6bed38f
update factory
ibelar 119a935
create redirect utils
ibelar e883987
improve loader
ibelar 70f9b67
vp executor init
ibelar 08eed64
clean up
ibelar c8418e0
js fix
ibelar 8589246
phpstan fix
ibelar a01e5c9
add return type
ibelar f5a5937
phpstan fix
ibelar 4143798
more stan fix
ibelar 8447b0c
remove error in dist file
ibelar 77f5eaa
add behat
ibelar ee00e00
split demo file
ibelar f3bb365
test and cs fix
ibelar 7ee174d
fix
ibelar 705e56f
set vp access to protected
ibelar 61c2738
minor fix
ibelar 26357d6
fix return type
ibelar 6b69cf4
phpstan
ibelar cfe4f65
php stan fix
ibelar c4969a2
remove error ignore
ibelar 619ca46
Merge branch 'develop' into pr/1649
ibelar 3b342dd
remove app stickyGet
ibelar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Atk4\Ui\Demos; | ||
|
||
// Demo for Model action | ||
|
||
use Atk4\Ui\App; | ||
use Atk4\Ui\Message; | ||
|
||
/** @var App $app */ | ||
$country = new CountryLock($app->db); | ||
$entity = $country->tryLoadAny(); | ||
$countryId = $entity->getId(); | ||
|
||
// Model actions for this file are setup in DemoActionUtil. | ||
DemoActionsUtil::setupDemoActions($country); | ||
|
||
\Atk4\Ui\Header::addTo($app, ['Assign Model action to button event', 'subHeader' => 'Execute model action on this country record by clicking on the appropriate button on the right.']); | ||
|
||
$msg = Message::addTo($app, ['Notes', 'type' => 'info']); | ||
$msg->text->addParagraph('When passing an action to a button event, Ui will determine what executor is required base on the action properties.'); | ||
$msg->text->addParagraph('If action require arguments, fields and/or preview, then a ModalExecutor will be use.'); | ||
|
||
\Atk4\Ui\View::addTo($app, ['ui' => 'ui clearing divider']); | ||
|
||
$gl = \Atk4\Ui\GridLayout::addTo($app, ['rows' => 1, 'columns' => 2]); | ||
$c = \Atk4\Ui\Card::addTo($gl, ['useLabel' => true], ['r1c1']); | ||
$c->addContent(new \Atk4\Ui\Header(['Using country: '])); | ||
$c->setModel($entity, [$country->fieldName()->iso, $country->fieldName()->iso3, $country->fieldName()->phonecode]); | ||
|
||
$buttons = \Atk4\Ui\View::addTo($gl, ['ui' => 'vertical basic buttons'], ['r1c2']); | ||
|
||
// Create a button for every action in Country model. | ||
foreach ($country->getUserActions() as $action) { | ||
$b = \Atk4\Ui\Button::addTo($buttons, [$action->getCaption()]); | ||
// Assign action to button using current model id as url arguments. | ||
$b->on('click', $action, ['args' => ['id' => $countryId]]); | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Atk4\Ui\Demos; | ||
|
||
use Atk4\Ui\UserAction\VpExecutor; | ||
|
||
/** @var \Atk4\Ui\App $app */ | ||
require_once __DIR__ . '/../init-app.php'; | ||
|
||
$factory = $app->getExecutorFactory(); | ||
$factory->registerTypeExecutor($factory::STEP_EXECUTOR, [VpExecutor::class]); | ||
|
||
require_once 'action-setup.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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if removed, does Behat testing fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no behat test for Card deck with either VpExecutor or new PanelExecutor. This is because the default executor register in ExecutorFactory is ModalExecutor. I can added tests but we need a way to be able to switch executor types dynamically. Any idea? Should we switch base on GET argument in init-app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant if sticky args in Card Deck are tested.
I belive this does not need extra cross testing