aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMurtaza Sultani <sultani@data-quest.de>2025-09-05 13:33:23 +0200
committerMurtaza Sultani <sultani@data-quest.de>2025-09-05 13:33:23 +0200
commit8a6831f7d910f3ff7791d27fdf3988028982caa5 (patch)
treee15071ce7dfe7d697aebce95764826312b164d90 /app
parenta50e6c1b47c568345c911c6fa500aa6fb519f523 (diff)
Resolve "Forum: Konfiguration auf Vue umsetzen"
Closes #5784 Merge request studip/studip!4410
Diffstat (limited to 'app')
-rw-r--r--app/controllers/course/forum/configs.php18
-rw-r--r--app/views/course/forum/configs/edit.php53
2 files changed, 14 insertions, 57 deletions
diff --git a/app/controllers/course/forum/configs.php b/app/controllers/course/forum/configs.php
index c99f718..a065a6a 100644
--- a/app/controllers/course/forum/configs.php
+++ b/app/controllers/course/forum/configs.php
@@ -17,18 +17,28 @@ class Course_Forum_ConfigsController extends Forum\BaseController
public function edit_action()
{
- $this->config = Context::get()->getConfiguration();
+ $config = Context::get()->getConfiguration();
+
+ $this->render_vue_app(
+ Studip\VueApp::create('forum/configs/Edit')
+ ->withProps([
+ 'config' => [
+ 'moderator' => $config->FORUM_MODERATION_PERMISSION,
+ 'categories_navigation' => $config->FORUM_HIDE_CATEGORIES_NAVIGATION
+ ]
+ ])
+ );
}
public function save_action()
{
CSRFProtection::verifyUnsafeRequest();
- $this->config = Context::get()->getConfiguration();
+ $config = Context::get()->getConfiguration();
- $this->config->store('FORUM_MODERATION_PERMISSION', trim(Request::option('forum_moderation_permission')));
+ $config->store('FORUM_MODERATION_PERMISSION', trim(Request::option('moderator')));
- $this->config->store('FORUM_HIDE_CATEGORIES_NAVIGATION', Request::bool('forum_hide_categories_navigation'));
+ $config->store('FORUM_HIDE_CATEGORIES_NAVIGATION', Request::bool('categories_navigation'));
PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));
diff --git a/app/views/course/forum/configs/edit.php b/app/views/course/forum/configs/edit.php
deleted file mode 100644
index ceb23d8..0000000
--- a/app/views/course/forum/configs/edit.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * @var Course_Forum_ConfigsController $controller
- * @var CourseConfig $config
- */
-?>
-
-<form class="default" method="post" action="<?= $controller->url_for('course/forum/configs/save') ?>">
- <?= CSRFProtection::tokenTag() ?>
-
- <label>
- <?= _('Wer darf das Forum moderieren?') ?>
- <select name="forum_moderation_permission">
- <option
- value="all"
- <?php if ($config->FORUM_MODERATION_PERMISSION === 'all') echo 'selected'; ?>
- >
- <?= _('Alle Teilnehmenden der Veranstaltung') ?>
- </option>
-
- <option
- value="tutor"
- <?php if ($config->FORUM_MODERATION_PERMISSION === 'tutor') echo 'selected'; ?>
- >
- <?= _('Tutor/-innen und Lehrende') ?>
- </option>
-
- <option
- value="dozent"
- <?php if ($config->FORUM_MODERATION_PERMISSION === 'dozent') echo 'selected'; ?>
- >
- <?= _('Nur Lehrende') ?>
- </option>
- </select>
- </label>
-
- <label>
- <input
- type="checkbox"
- aria-label="<?= _('Kategorien ausblenden') ?>"
- name="forum_hide_categories_navigation"
- <?= $config->FORUM_HIDE_CATEGORIES_NAVIGATION ? 'checked' : '' ?>
- value="1"
- />
- <span>
- <?= _('Kategorien ausblenden') ?>
- </span>
- </label>
-
- <div data-dialog-button>
- <?= \Studip\Button::create(_('Übernehmen')) ?>
- </div>
-</form>