Skip to content

Commit

Permalink
[fix] - Demo Tutorial (#1600)
Browse files Browse the repository at this point in the history
* [fix] - Demo Tutorial

fix - Intro Exception in Business model step;
fix - Make delete action enable property with predictable callback in order to prevent exception.

* Update demos/tutorial/actions.php

Co-authored-by: Michael Voříšek <[email protected]>

* Update demos/tutorial/actions.php

Co-authored-by: Michael Voříšek <[email protected]>

* fix cs

Co-authored-by: Michael Voříšek <[email protected]>
  • Loading branch information
ibelar and mvorisek authored Feb 3, 2021
1 parent cc52259 commit eaa1dbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions demos/_includes/DemoInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ protected function init(): void
function ($v) {
return ($v instanceof \DateTime) ? date_format($v, $this->dateFormat) : $v;
},
function ($v) {
return $v;
},
],
]);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/tutorial/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ functionality and more. Next example shows how you can disable user action (add)
$page->add(new Demo())->setCodeAndCall(function (View $owner) {
$country = new \Atk4\Ui\Demos\CountryLock($owner->getApp()->db);
$country->getUserAction('add')->enabled = false;
$country->getUserAction('delete')->enabled = function () { return random_int(1, 2) > 1; };
$country->getUserAction('delete')->enabled = function (Country $m) { return $m->id % 2 === 0; };
$country->addUserAction('mail', [
'appliesTo' => \Atk4\Data\Model\UserAction::APPLIES_TO_SINGLE_RECORD,
'preview' => function (CountryLock $country) { return 'here is email preview for ' . $country->name; },
Expand Down

0 comments on commit eaa1dbd

Please sign in to comment.