From 87b281813e17a0171155018cff03d7ef2dcabbef Mon Sep 17 00:00:00 2001 From: Nils Haagen Date: Wed, 27 Sep 2023 16:54:40 +0200 Subject: [PATCH] TA: QuestionList, use ui dropdown instead of actionList --- .../class.ilTestQuestionNavigationGUI.php | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php b/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php index 46e5ee2af25b..f6077d2a820a 100644 --- a/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php +++ b/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php @@ -368,14 +368,10 @@ public function setAnythingRendered() $this->anythingRendered = true; } - // fau: testNav - generate question actions menu - /** - * Get the HTML of an actions menu below the title - * @return string - */ public function getActionsHTML(): string { $tpl = $this->getTemplate('actions'); + $actions = []; if ($this->getQuestionMarkLinkTarget()) { $this->renderActionsIcon( @@ -384,38 +380,38 @@ public function getActionsHTML(): string $this->getQuestionMarkIconLabel(), 'ilTestMarkQuestionIcon' ); - } - - $actions = [ - $this->ui_factory->button()->shy( + $actions[] = $this->ui_factory->button()->shy( $this->getQuestionMarkActionLabel(), $this->getQuestionMarkLinkTarget() - )->withUnavailableAction(!$this->getQuestionMarkLinkTarget()), + ); + } - $this->ui_factory->divider()->horizontal(), + if ($this->getSkipQuestionLinkTarget()) { + $actions[] = $this->ui_factory->button()->shy( + $this->lng->txt('postpone_question'), + $this->getSkipQuestionLinkTarget() + ); + } - $this->ui_factory->button()->shy( - $this->lng->txt('tst_revert_changes'), - $this->getRevertChangesLinkTarget() - )->withUnavailableAction(!$this->getRevertChangesLinkTarget()), + if ($actions !== []) { + $actions[] = $this->ui_factory->divider()->horizontal(); + } - $this->ui_factory->button()->shy( - $this->lng->txt('discard_answer'), - '#' - )->withUnavailableAction(!$this->isDiscardSolutionButtonEnabled()), + $actions[] = $this->ui_factory->button()->shy( + $this->lng->txt('tst_revert_changes'), + $this->getRevertChangesLinkTarget() + )->withUnavailableAction(!$this->getRevertChangesLinkTarget()); - $this->ui_factory->button()->shy( - $this->lng->txt('postpone_question'), - $this->getSkipQuestionLinkTarget() - )->withUnavailableAction(!$this->getSkipQuestionLinkTarget()) - ]; + $actions[] = $this->ui_factory->button()->shy( + $this->lng->txt('discard_answer'), + '#' + )->withUnavailableAction(!$this->isDiscardSolutionButtonEnabled()); $list = $this->ui_factory->dropdown()->standard($actions)->withLabel($this->lng->txt("actions")); $tpl->setVariable('ACTION_MENU', $this->ui_renderer->render($list)); return $tpl->get(); } - // fau. /**