From 21a9e665414b4befccf40222c5c0e02f19b055fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Noack?= <noack@data-quest.de>
Date: Thu, 7 Mar 2024 11:24:10 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20"Login=20FAQ=20ist=20nicht=20=C3=BCbe?=
 =?UTF-8?q?rsetzbar"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #3780

Merge request studip/studip!2653
---
 app/controllers/admin/login_style.php    |  4 ++--
 app/views/admin/login_style/edit_faq.php | 26 +++++++++++++-----------
 lib/models/LoginFaq.class.php            |  3 ++-
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/app/controllers/admin/login_style.php b/app/controllers/admin/login_style.php
index 615e777f7a7..35cd7d820ff 100644
--- a/app/controllers/admin/login_style.php
+++ b/app/controllers/admin/login_style.php
@@ -177,8 +177,8 @@ class Admin_LoginStyleController extends AuthenticatedController
         CSRFProtection::verifyRequest();
 
         $entry->setData([
-            'title' => trim(Request::get('title')),
-            'description' => trim(Request::get('description')),
+            'title' => Request::i18n('title'),
+            'description' => Request::i18n('description'),
         ]);
 
         if ($entry->store()) {
diff --git a/app/views/admin/login_style/edit_faq.php b/app/views/admin/login_style/edit_faq.php
index 066991a6b2b..2c35afd12fb 100644
--- a/app/views/admin/login_style/edit_faq.php
+++ b/app/views/admin/login_style/edit_faq.php
@@ -9,23 +9,25 @@
       enctype="multipart/form-data"
       class="default">
     <?= CSRFProtection::tokenTag() ?>
-
-    <label class="studiprequired">
-        <?= _('Titel') ?>
-        <span title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true" class="asterisk">*</span>
-        <input type="text" name="title" value="<?= htmlReady($entry->title) ?>" required>
+    <label>
+        <span class="required">
+            <?= _('Titel') ?>
+        </span>
+        <?= I18N::input('title', $entry->title, ['required' => true]) ?>
     </label>
-
     <label>
-        <span class="studiprequired">
+        <span class="required">
             <?= _('Text') ?>
-            <span title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true" class="asterisk">*</span>
         </span>
-        <textarea name="description"
-                  class="add_toolbar wysiwyg" data-editor="toolbar=minimal"><?= htmlReady($entry->description)?></textarea>
+        <?= I18N::textarea('description',
+            $entry->description,
+            [
+                'class'       => 'wysiwyg',
+                'required'    => true,
+                'data-editor' => 'toolbar=small'
+            ]
+        ) ?>
     </label>
-
-
     <div data-dialog-button>
         <?= \Studip\Button::create(_('Speichern')) ?>
     </div>
diff --git a/lib/models/LoginFaq.class.php b/lib/models/LoginFaq.class.php
index 036f0f73178..d6cad4077f2 100644
--- a/lib/models/LoginFaq.class.php
+++ b/lib/models/LoginFaq.class.php
@@ -25,7 +25,8 @@ class LoginFaq extends SimpleORMap
     {
         $config['db_table'] = 'login_faq';
 
-    $config['i18n'] = ['title', 'description'];
+        $config['i18n_fields']['title'] = true;
+        $config['i18n_fields']['description'] = true;
 
         parent::configure($config);
     }
-- 
GitLab