Skip to content
Snippets Groups Projects
Commit 97fe2c82 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

set size of icon in action menus only via css, fixes #1953

Closes #1953

Merge request studip/studip!1295
parent 176a3a78
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,6 @@ class ActionMenu
'icon' => $url->icon,
'label' => $url->label,
'attributes' => $url->attributes,
'index' => $index
];
} else {
$action = [
......@@ -121,10 +120,9 @@ class ActionMenu
'icon' => $icon,
'label' => $label,
'attributes' => $attributes,
'index' => $index
];
}
$index = $index ?: md5($action['link'].json_encode($action['attributes']));
$index = $index ?: md5($action['link'] . json_encode($action['attributes']));
$action['index'] = $index;
//now insert it possibly at the desired position:
$before_key = null;
......
......@@ -48,8 +48,8 @@ $action-menu-shadow: 1px 1px 1px $dark-gray-color-60;
cursor: pointer;
display: block;
padding: 0;
width: 20px;
height: 20px;
width: $action-menu-icon-size;
height: $action-menu-icon-size;
// Create animated icon that changes to close icon on activation/hover
span {
......
<?php
/**
* @var array<array{
* type: string,
* label: string,
* link?: string,
* name?: string,
* object?: MultiPersonSearch,
* icon: Icon,
* attributes: array
* }> $actions
*/
?>
<? foreach ($actions as $action): ?>
<? if ($action['type'] === 'link'): ?>
<a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes'] + ['title' => $action['label']]) ?>>
<? if ($action['icon']): ?>
<?= $action['icon'] ?>
<?= $action['icon']->asImg(false) ?>
<? else: ?>
<?= htmlReady($action['label']) ?>
<? endif ?>
</a>
<? elseif ($action['type'] === 'button'): ?>
<? if ($action['icon']): ?>
<?= $action['icon']->asInput($action['attributes'] + ['name' => $action['name'], 'title' => $action['label']]) ?>
<?= $action['icon']->asInput(false, $action['attributes'] + ['name' => $action['name'], 'title' => $action['label']]) ?>
<? else: ?>
<button name="<?= htmlReady($action['name']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<?= htmlReady($action['label']) ?>
......
<?php
/**
* @var array<array{
* type: string,
* label: string,
* link?: string,
* name?: string,
* object?: MultiPersonSearch,
* icon: Icon,
* attributes: array
* }> $actions
*/
?>
<? // class "action-menu" will be set from API ?>
<nav <?= arrayToHtmlAttributes($attributes) ?> aria-role="presentation">
<button class="action-menu-icon" aria-role="button" aria-expanded="false" title="<?= htmlReady($action_menu_title) ?>">
......@@ -15,7 +28,7 @@
<? if ($action['type'] === 'link'): ?>
<a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<? if ($action['icon']): ?>
<?= $action['icon'] ?>
<?= $action['icon']->asImg(false) ?>
<? else: ?>
<span class="action-menu-no-icon"></span>
<? endif ?>
......@@ -24,7 +37,7 @@
<? elseif ($action['type'] === 'button'): ?>
<? if ($action['icon']): ?>
<label class="undecorated">
<?= $action['icon']->asInput($action['attributes'] + ['name' => $action['name'], 'title' => $action['label']]) ?>
<?= $action['icon']->asInput(false, $action['attributes'] + ['name' => $action['name'], 'title' => $action['label']]) ?>
<?= htmlReady($action['label']) ?>
</label>
<? else: ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment