diff options
| author | Rasmus Fuhse <fuhse@data-quest.de> | 2025-10-17 07:17:02 +0000 |
|---|---|---|
| committer | Rasmus Fuhse <fuhse@data-quest.de> | 2025-10-17 07:17:02 +0000 |
| commit | 4ebbfba18b0f57a3ac38d809bc2c40fe138484b0 (patch) | |
| tree | b98ced9adf7054f84048a31cc580c1ab1e223e36 /app | |
| parent | 9990e5558141ef0df808c94ce04f128a4675e467 (diff) | |
Resolve "Wiki: Kein Aktionsmenü in Tabellenansichten"
Closes #1459
Merge request studip/studip!4505
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/course/wiki.php | 76 | ||||
| -rw-r--r-- | app/views/course/wiki/allpages.php | 11 | ||||
| -rw-r--r-- | app/views/course/wiki/newpages.php | 4 |
3 files changed, 56 insertions, 35 deletions
diff --git a/app/controllers/course/wiki.php b/app/controllers/course/wiki.php index cd73b99..4ac2f84 100644 --- a/app/controllers/course/wiki.php +++ b/app/controllers/course/wiki.php @@ -152,44 +152,50 @@ class Course_WikiController extends AuthenticatedController $author, date('d.m.Y H:i:s', $this->page['chdate']) ); - $action_menu = ActionMenu::get(); - if ($this->page->isEditable()) { - $action_menu->addLink( - $this->editURL($this->page), - _('Seite bearbeiten'), - Icon::create('edit') - ); - $action_menu->addLink( - $this->pagesettingsURL($this->page->id), - _('Seiteneinstellungen bearbeiten'), - Icon::create('settings'), - ['data-dialog' => 'width=700'] - ); - if ($this->page->isDeletable()) { - if (count($this->page->versions) > 0) { - $action_menu->addLink( - $this->ask_deletingURL($this->page), - _('Seite / Version löschen'), - Icon::create('trash'), - ['data-dialog' => 'size=auto'] - ); - } else { - $action_menu->addButton( - 'delete', - _('Seite löschen'), - Icon::create('trash'), - ['data-confirm' => _('Wollen Sie wirklich die komplette Seite löschen?'), 'form' => 'delete_page'] - ); - } - } - } + $action_menu = $this->getActionMenu($this->page); $contentbarSlots['menu'] = $action_menu->render(); } $this->contentBarVueApp = \Studip\VueApp::create('ContentBar')->withProps($contentbarProps)->withSlots($contentbarSlots); } - public function pagesettings_action(WikiPage $page) + public function getActionMenu(WikiPage $page, string $fromURL = '') + { + $action_menu = ActionMenu::get(); + if ($page->isEditable()) { + $action_menu->addLink( + $this->editURL($page), + _('Seite bearbeiten'), + Icon::create('edit') + ); + $action_menu->addLink( + $this->pagesettingsURL($page, $fromURL), + _('Seiteneinstellungen bearbeiten'), + Icon::create('settings'), + ['data-dialog' => 'width=700'] + ); + if ($page->isDeletable()) { + if (count($page->versions) > 0) { + $action_menu->addLink( + $this->ask_deletingURL($page), + _('Seite / Version löschen'), + Icon::create('trash'), + ['data-dialog' => 'size=auto'] + ); + } else { + $action_menu->addButton( + 'delete', + _('Seite löschen'), + Icon::create('trash'), + ['data-confirm' => _('Wollen Sie wirklich die komplette Seite löschen?'), 'form' => 'delete_page'] + ); + } + } + } + return $action_menu; + } + + public function pagesettings_action(WikiPage $page, string $fromURL = '') { $this->validateWikiPage($page, $this->range, true); PageLayout::setTitle(_('Seiteneinstellungen bearbeiten')); @@ -266,7 +272,7 @@ class Course_WikiController extends AuthenticatedController ] ] ], - $this->pagesettingsURL($page->id) + $this->pagesettingsURL($page, $fromURL) )->addStoreCallback(function ($form, $values) use ($oldname) { if ($values['name'] === $oldname) { return; @@ -298,8 +304,10 @@ class Course_WikiController extends AuthenticatedController if (Request::isPost()) { $this->form->store(); PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.')); - if ($page->isReadable()) { + if ($page->isReadable() && empty($fromURL)) { $this->redirect($this->pageURL($page->id)); + } elseif (!empty($fromURL)) { + $this->redirect(URLHelper::getURL('dispatch.php/course/wiki/' . $fromURL)); } else { $this->redirect($this->allpagesURL()); } diff --git a/app/views/course/wiki/allpages.php b/app/views/course/wiki/allpages.php index 74a10eb..e60feee 100644 --- a/app/views/course/wiki/allpages.php +++ b/app/views/course/wiki/allpages.php @@ -25,10 +25,16 @@ <th data-sort="digit"><?= _('Änderungen') ?></th> <th data-sort="htmldata"><?= _('Letzte Änderung') ?></th> <th data-sort="text"><?= _('Zuletzt bearbeitet von') ?></th> + <th class="actions"><?= _('Aktionen') ?></th> </tr> </thead> <tbody> <? foreach ($pages as $page) : ?> + <? if ($page->isEditable()) : ?> + <form action="<?= $controller->delete($page) ?>" method="post" id="delete_page"> + <?= CSRFProtection::tokenTag() ?> + </form> + <? endif ?> <tr> <td> <input @@ -52,12 +58,15 @@ <?= Avatar::getAvatar($page->user_id)->getImageTag(Avatar::SMALL) ?> <?= htmlReady($page->user ? $page->user->getFullName() : _('unbekannt')) ?> </td> + <td class="actions"> + <?= $controller->getActionMenu($page, 'allpages') ?> + </td> </tr> <? endforeach ?> </tbody> <tfoot> <tr> - <td colspan="5"> + <td colspan="6"> <select name="action" id="bulk_action" aria-label="<?= _('Aktion auswählen') ?>" required> <option value="">- <?= _('Aktion auswählen') ?></option> <option value="page_setting"><?= _('Seiteneinstellungen') ?></option> diff --git a/app/views/course/wiki/newpages.php b/app/views/course/wiki/newpages.php index bfc1232..838eef9 100644 --- a/app/views/course/wiki/newpages.php +++ b/app/views/course/wiki/newpages.php @@ -35,6 +35,7 @@ <?= _('Datum') ?> </a> </th> + <th class="actions"><?= _('Aktionen') ?></th> </tr> </thead> <tbody> @@ -115,6 +116,9 @@ </ul> </td> <td><?= strftime('%x %X', $page->chdate) ?></td> + <td class="actions"> + <?= $controller->getActionMenu($page, 'newpages') ?> + </td> </tr> <? endforeach ?> </tbody> |
