From 16d49c4b3eb0e7a9a04c643af713858a29d7fc72 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 23 Oct 2017 19:34:53 +0200 Subject: [PATCH] Fix selector bugs --- .../AccountGroupSelector/BaseView.php | 4 +- .../AccountGroupSelector/PopupView.php | 48 +++++++++++++++++++ .../AccountGroupSelector/base.tpl.php | 14 +++--- .../AccountGroupSelector/popup.tpl.php | 13 ++--- 4 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 Theme/Backend/Components/AccountGroupSelector/PopupView.php diff --git a/Theme/Backend/Components/AccountGroupSelector/BaseView.php b/Theme/Backend/Components/AccountGroupSelector/BaseView.php index f8b8975..5d8df64 100644 --- a/Theme/Backend/Components/AccountGroupSelector/BaseView.php +++ b/Theme/Backend/Components/AccountGroupSelector/BaseView.php @@ -30,8 +30,7 @@ class BaseView extends View parent::__construct($app, $request, $response); $this->setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/base'); - $view = new View($app, $request, $response); - $view->setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/popup'); + $view = new PopupView($app, $request, $response); $this->addData('popup', $view); } @@ -49,6 +48,7 @@ class BaseView extends View { $this->id = $data[0]; $this->required = $data[1] ?? false; + $this->getData('popup')->setId($this->id); return parent::render(); } } \ No newline at end of file diff --git a/Theme/Backend/Components/AccountGroupSelector/PopupView.php b/Theme/Backend/Components/AccountGroupSelector/PopupView.php new file mode 100644 index 0000000..e34d45e --- /dev/null +++ b/Theme/Backend/Components/AccountGroupSelector/PopupView.php @@ -0,0 +1,48 @@ +setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/popup'); + } + + public function setId(string $id) + { + $this->id = $id; + } + + public function getId() : string + { + return $this->id; + } + + public function render(...$data) : string + { + $this->id = $data[0] ?? $this->id; + return parent::render(); + } +} \ No newline at end of file diff --git a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php index 79b990d..1cdd972 100644 --- a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php +++ b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php @@ -2,7 +2,7 @@ @@ -88,7 +89,7 @@