Skip to content
Snippets Groups Projects
Commit 348bd130 authored by André Noack's avatar André Noack
Browse files

Resolve "MessageBox sollte als Statusmeldung ausgezeichnet werden"

Closes #4042

Merge request studip/studip!2896
parent 4fe996bb
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ class MessageBox implements LayoutMessage
public $details;
public $close_details;
protected $hide_close = false;
public static $counter = 0;
/**
* This function returns an exception message box. Use it only for system errors
......@@ -147,12 +148,21 @@ class MessageBox implements LayoutMessage
*/
public function __toString()
{
$label = [
'exception' => _('Systemfehler'),
'error' => _('Fehler'),
'warning' => _('Warnung'),
'info' => _('Hinweis'),
'success' => _('Erfolg'),
];
return $GLOBALS['template_factory']->render('shared/message_box', [
'class' => $this->class,
'message' => $this->message,
'details' => is_array($this->details) ? $this->details : [],
'close_details' => $this->close_details,
'hide_close' => $this->hide_close,
'label' => $label[$this->class],
'counter' => self::$counter++,
]);
}
}
......@@ -43,9 +43,11 @@ $password_tooltip_text = (string)Config::get()->PASSWORD_TOOLTIP_TEXT;
name="password"
autocomplete="current-password"
size="20"
required>
required
<?= $loginerror ? 'aria-describedby="messagebox-0"' : ''?>
>
<i id="password-toggle" tabindex="0" aria-role="button" class="enter-accessible">
<i id="password-toggle" tabindex="0" role="button" class="enter-accessible">
<?= Icon::create('visibility-checked')->asImg(20, [
'id ' => 'visible-password',
'title' => _('Passwort anzeigen'),
......
<div class="messagebox messagebox_<?= $class ?> <? if (count($details) > 0 && $close_details): ?>details_hidden<? endif; ?>">
<div role="region" aria-label="<?= $label ?>" aria-describedby="messagebox-<?= $counter ?>" class="messagebox messagebox_<?= $class ?> <? if (count($details) > 0 && $close_details): ?>details_hidden<? endif; ?>">
<div class="messagebox_buttons">
<? if (count($details) > 0 && $close_details) : ?>
<a class="details" href="#" title="<?=_('Detailanzeige umschalten')?>">
......@@ -6,19 +6,21 @@
</a>
<? endif ?>
<? if (!$hide_close): ?>
<a class="close" href="#" title="<?= _('Nachrichtenbox schließen') ?>">
<a class="close" role="button" href="#" title="<?= _('Nachrichtenbox schließen') ?>">
<span><?= _('Nachrichtenbox schließen') ?></span>
</a>
<? endif; ?>
</div>
<div role="status" id="messagebox-<?= $counter ?>">
<?= $message ?>
<? if (count($details) > 0) : ?>
<div class="messagebox_details">
<ul>
<? foreach ($details as $li) : ?>
<li><?= $li ?></li>
<? endforeach ?>
</ul>
<? if (count($details) > 0) : ?>
<div class="messagebox_details">
<ul>
<? foreach ($details as $li) : ?>
<li><?= $li ?></li>
<? endforeach ?>
</ul>
</div>
<? endif ?>
</div>
<? endif ?>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment