diff options
| author | Murtaza Sultani <sultani@data-quest.de> | 2025-09-05 15:47:50 +0200 |
|---|---|---|
| committer | Murtaza Sultani <sultani@data-quest.de> | 2025-09-05 15:47:50 +0200 |
| commit | 9bb68bf5d075ff0e127b9fe5309889f366ccf127 (patch) | |
| tree | 992cce643bf95fc3e6985920aea86cf54335cbec /app | |
| parent | 8a6831f7d910f3ff7791d27fdf3988028982caa5 (diff) | |
Resolve "Forum: Discussion-Type Index auf Vue umsetzen"
Closes #5782
Merge request studip/studip!4406
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/course/forum/discussion_types.php | 24 | ||||
| -rw-r--r-- | app/controllers/course/forum/discussions.php | 2 | ||||
| -rw-r--r-- | app/controllers/course/forum/search.php | 2 | ||||
| -rw-r--r-- | app/views/course/forum/discussion_types/index.php | 79 |
4 files changed, 11 insertions, 96 deletions
diff --git a/app/controllers/course/forum/discussion_types.php b/app/controllers/course/forum/discussion_types.php index 68005a5..71a4766 100644 --- a/app/controllers/course/forum/discussion_types.php +++ b/app/controllers/course/forum/discussion_types.php @@ -19,14 +19,16 @@ class Course_Forum_DiscussionTypesController extends AuthenticatedController _('Neuen Diskussionstyp anlegen'), $this->url_for('course/forum/discussion_types/edit'), Icon::create('add', Icon::ROLE_CLICKABLE, ['title' => _('Neuen Diskussionstyp anlegen')]) - )->asDialog('width=700'); + )->asDialog('width=700;height=650'); Sidebar::Get()->addWidget($actions); } public function index_action() { - $this->discussion_types = DiscussionType::findBySQL("TRUE ORDER BY mkdate DESC"); + $this->render_vue_app( + Studip\VueApp::create('forum/discussions_types/Index') + ); } public function edit_action(DiscussionType $discussion_type = null) @@ -51,10 +53,11 @@ class Course_Forum_DiscussionTypesController extends AuthenticatedController } $this->render_vue_app( - Studip\VueApp::create('forum/discussions_types/Edit')->withProps([ - 'icons' => array_unique($icons), - 'discussion_type' => $discussion_type->toRawArray() - ]) + Studip\VueApp::create('forum/discussions_types/Edit') + ->withProps([ + 'icons' => array_unique($icons), + 'discussionType' => $discussion_type->transformData() + ]) ); } @@ -71,13 +74,4 @@ class Course_Forum_DiscussionTypesController extends AuthenticatedController $this->relocate('course/forum/discussion_types/index'); } - - public function delete_action(DiscussionType $discussion_type) - { - $discussion_type->delete(); - - PageLayout::postSuccess(_('Der Diskussionstyp wurde gelöscht.')); - - $this->relocate('course/forum/discussion_types/index'); - } } diff --git a/app/controllers/course/forum/discussions.php b/app/controllers/course/forum/discussions.php index e6cec64..4a71519 100644 --- a/app/controllers/course/forum/discussions.php +++ b/app/controllers/course/forum/discussions.php @@ -136,7 +136,7 @@ class Course_Forum_DiscussionsController extends Forum\BaseController $all_tags = array_map(fn(TagDTO $tag) => $tag->toRawArray(), TagDTO::getForumTags()); $discussion_tags = array_map(fn(TagDTO $tag) => $tag->toRawArray(), $discussion->tags); - $discussion_types = array_map(fn(DiscussionType $discussion_type) => $discussion_type->toRawArray(), DiscussionType::getForumDiscussionType()); + $discussion_types = array_map(fn(DiscussionType $discussion_type) => $discussion_type->toRawArray(), DiscussionType::getAll()); $this->render_vue_app( Studip\VueApp::create('forum/discussions/Edit') diff --git a/app/controllers/course/forum/search.php b/app/controllers/course/forum/search.php index 706674c..988ca87 100644 --- a/app/controllers/course/forum/search.php +++ b/app/controllers/course/forum/search.php @@ -36,7 +36,7 @@ class Course_Forum_SearchController extends Forum\BaseController } $tags = array_map(fn(TagDTO $tag) => $tag->toRawArray(), TagDTO::getForumTags()); - $discussion_types = array_map(fn(DiscussionType $discussion_type) => $discussion_type->toRawArray(), DiscussionType::getForumDiscussionType()); + $discussion_types = array_map(fn(DiscussionType $discussion_type) => $discussion_type->toRawArray(), DiscussionType::getAll()); $this->render_vue_app( Studip\VueApp::create('forum/search/Index') diff --git a/app/views/course/forum/discussion_types/index.php b/app/views/course/forum/discussion_types/index.php deleted file mode 100644 index f6eb534..0000000 --- a/app/views/course/forum/discussion_types/index.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -use Forum\DiscussionType; - -/** - * @var Course_Forum_DiscussionTypesController $controller - * @var DiscussionType[] $discussion_types - */ -?> - -<div class="forum"> - <table class="default sortable-table"> - <caption> - <?= _('Diskussiontypen') ?> - <span class="actions"> - <a href="<?= $controller->url_for('course/forum/discussion_types/edit') ?>" data-dialog="width=700"> - <?= Icon::create('add', 'clickable', ['title' => _('Neuen Diskussionstyp anlegen')]) ?> - </a> - </span> - </caption> - - <colgroup> - <col style="width: 10%"> - <col> - <col style="width: 24px"> - </colgroup> - - <thead> - <tr> - <th><?= _('Icon') ?></th> - <th data-sort="text"><?= _('Name') ?></th> - <th class="actions"><?= _('Aktionen') ?></th> - </tr> - </thead> - <tbody> - <?php foreach ($discussion_types as $type) : ?> - <tr> - <td> - <?php if ($type->icon) : ?> - <?= Icon::create($type->icon, ['title' => htmlReady($type->icon)])->asSvg(24) ?> - <?php endif; ?> - </td> - <td> - <a href="<?= $controller->url_for('course/forum/discussion_types/edit/'.$type->type_id) ?>" data-dialog="width=700"> - <?= htmlReady($type->name) ?> - </a> - </td> - - <td class="actions"> - <?= ActionMenu::get() - ->addLink( - $controller->url_for('course/forum/discussion_types/edit', $type), - _('Bearbeiten'), - Icon::create('edit', 'clickable', ['title' => _('Diskussionstyp bearbeiten')]), - ['data-dialog' => 'width=700'] - ) - ->addLink( - $controller->url_for('course/forum/discussion_types/delete', $type), - _('Löschen'), - Icon::create('trash', 'clickable',['title' => _('Diskussionstyp löschen')]), - ['data-confirm' => sprintf( - _('Wollen Sie "%s" löschen?'), - $type->name - )] - ); - ?> - </td> - </tr> - <?php endforeach ?> - - <?php if (count($discussion_types) === 0) : ?> - <tr> - <td colspan="3" class="text-center"> - <?= _('Es sind noch keine Diskussionstypen vorhanden.') ?> - </td> - </tr> - <?php endif ?> - </tbody> - </table> -</div> |
