Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 5, 2021
1 parent d7a8680 commit 337427a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
6 changes: 4 additions & 2 deletions demos/_includes/DemoActionsUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Atk4\Ui\Demos;

use Atk4\Data\Model\UserAction;

class DemoActionsUtil
{
public static function setupDemoActions(CountryLock $country): void
Expand Down Expand Up @@ -82,8 +84,8 @@ public static function setupDemoActions(CountryLock $country): void
'edit_iso',
[
'caption' => 'Edit ISO3',
'description' => function () {
return 'Edit ISO3 for country:';
'description' => function (UserAction $action) {
return 'Edit ISO3 for country: ' . $action->getEntity()->getTitle();
},
'fields' => [$country->fieldName()->iso3],
'callback' => function () {
Expand Down
1 change: 0 additions & 1 deletion demos/data-action/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
require_once __DIR__ . '/../init-app.php';

$files = new FileLock($app->db);
//$files = $files->createEntity(); // TODO remove before #1623 merge, it is wrong

// Actions can be added easily to the model via the Model::addUserAction($name, $properties) method.
$action = $files->addUserAction(
Expand Down
3 changes: 1 addition & 2 deletions demos/data-action/jsactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Atk4\Ui\Demos;

use Atk4\Data\Model\UserAction;
use Atk4\Ui\Button;
use Atk4\Ui\Form\Control\Line;
use Atk4\Ui\UserAction\JsCallbackExecutor;

Expand Down Expand Up @@ -78,4 +77,4 @@
$s->addFields($entity = $country->loadAny(), [$country->fieldName()->name, $country->fieldName()->iso]);

// Pass the model action to the Card::addClickAction() method.
$card->addClickAction($sendEmailAction,null, ['id' => $entity->getId()]);
$card->addClickAction($sendEmailAction, null, ['id' => $entity->getId()]);
4 changes: 1 addition & 3 deletions demos/init-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ public function validate($intent = null): array
}

// look if name is unique
$c = $this->getModel();
$c = $c->tryLoadBy($this->fieldName()->name, $this->name);
$c = $this->getModel()->tryLoadBy($this->fieldName()->name, $this->name);
if ($c->loaded() && $c->getId() !== $this->getId()) {
$errors[$this->fieldName()->name] = 'Country name must be unique';
}
Expand Down Expand Up @@ -264,7 +263,6 @@ protected function init(): void
$this->addField($this->fieldName()->type, ['caption' => 'MIME Type']);
$this->addField($this->fieldName()->is_folder, ['type' => 'boolean']);

$t = $this->fieldName()->SubFolder;
$this->hasMany($this->fieldName()->SubFolder, [
'model' => [self::class],
'their_field' => self::hinting()->fieldName()->parent_folder_id,
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ parameters:
- '~^Call to an undefined method Atk4\\Ui\\Panel\\Loadable::onOpen\(\)\.$~'
- '~^Call to an undefined method Atk4\\Ui\\Panel\\Loadable::addConfirmation\(\)\.$~'
# for src/Card.php
- '~^Call to an undefined method Atk4\\Ui\\AbstractView::addFields\(\)\.$~'
- '~^Call to an undefined method Atk4\\Ui\\View::addDescription\(\)\.$~'
# for src/CardDeck.php
- '~^Access to an undefined property Atk4\\Ui\\AbstractView::\$reload\.$~'
Expand Down Expand Up @@ -187,7 +186,6 @@ parameters:
- '~^Property Atk4\\Ui\\Card::\$section \(Atk4\\Ui\\CardSection\|null\) does not accept Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::getSection\(\) should return Atk4\\Ui\\View\|null but returns Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::addContent\(\) should return Atk4\\Ui\\View\|null but returns Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::addSection\(\) should return Atk4\\Ui\\View but returns Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::addExtraContent\(\) should return Atk4\\Ui\\View but returns Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::addImage\(\) should return Atk4\\Ui\\View\|null but returns Atk4\\Ui\\AbstractView\.$~'
- '~^Method Atk4\\Ui\\Card::addButton\(\) should return Atk4\\Ui\\View\|null but returns Atk4\\Ui\\AbstractView\.$~'
Expand Down
2 changes: 1 addition & 1 deletion src/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function addModelActions(Model $model)
*/
public function addSection(string $title = null, Model $model = null, array $fields = null, bool $useTable = false, bool $useLabel = false)
{
$section = CardSection::addTo($this, ['card' => $this], ['Section']);
$section = CardSection::addToWithCl($this, [$this->cardSection, 'card' => $this], ['Section']);
if ($title) {
View::addTo($section, [$title, ['class' => 'header']]);
}
Expand Down
1 change: 0 additions & 1 deletion src/UserAction/FormExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Atk4\Ui\UserAction;

use Atk4\Data\Model;
use Atk4\Ui\Exception;
use Atk4\Ui\Form;

class FormExecutor extends BasicExecutor
Expand Down

0 comments on commit 337427a

Please sign in to comment.