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 ...@@ -112,7 +112,6 @@ class ActionMenu
'icon' => $url->icon, 'icon' => $url->icon,
'label' => $url->label, 'label' => $url->label,
'attributes' => $url->attributes, 'attributes' => $url->attributes,
'index' => $index
]; ];
} else { } else {
$action = [ $action = [
...@@ -121,10 +120,9 @@ class ActionMenu ...@@ -121,10 +120,9 @@ class ActionMenu
'icon' => $icon, 'icon' => $icon,
'label' => $label, 'label' => $label,
'attributes' => $attributes, '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; $action['index'] = $index;
//now insert it possibly at the desired position: //now insert it possibly at the desired position:
$before_key = null; $before_key = null;
......
...@@ -48,8 +48,8 @@ $action-menu-shadow: 1px 1px 1px $dark-gray-color-60; ...@@ -48,8 +48,8 @@ $action-menu-shadow: 1px 1px 1px $dark-gray-color-60;
cursor: pointer; cursor: pointer;
display: block; display: block;
padding: 0; padding: 0;
width: 20px; width: $action-menu-icon-size;
height: 20px; height: $action-menu-icon-size;
// Create animated icon that changes to close icon on activation/hover // Create animated icon that changes to close icon on activation/hover
span { span {
......
<?php
/**
* @var array<array{
* type: string,
* label: string,
* link?: string,
* name?: string,
* object?: MultiPersonSearch,
* icon: Icon,
* attributes: array
* }> $actions
*/
?>
<? foreach ($actions as $action): ?> <? foreach ($actions as $action): ?>
<? if ($action['type'] === 'link'): ?> <? if ($action['type'] === 'link'): ?>
<a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes'] + ['title' => $action['label']]) ?>> <a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes'] + ['title' => $action['label']]) ?>>
<? if ($action['icon']): ?> <? if ($action['icon']): ?>
<?= $action['icon'] ?> <?= $action['icon']->asImg(false) ?>
<? else: ?> <? else: ?>
<?= htmlReady($action['label']) ?> <?= htmlReady($action['label']) ?>
<? endif ?> <? endif ?>
</a> </a>
<? elseif ($action['type'] === 'button'): ?> <? elseif ($action['type'] === 'button'): ?>
<? if ($action['icon']): ?> <? 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: ?> <? else: ?>
<button name="<?= htmlReady($action['name']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>> <button name="<?= htmlReady($action['name']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<?= htmlReady($action['label']) ?> <?= 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 ?> <? // class "action-menu" will be set from API ?>
<nav <?= arrayToHtmlAttributes($attributes) ?> aria-role="presentation"> <nav <?= arrayToHtmlAttributes($attributes) ?> aria-role="presentation">
<button class="action-menu-icon" aria-role="button" aria-expanded="false" title="<?= htmlReady($action_menu_title) ?>"> <button class="action-menu-icon" aria-role="button" aria-expanded="false" title="<?= htmlReady($action_menu_title) ?>">
...@@ -15,7 +28,7 @@ ...@@ -15,7 +28,7 @@
<? if ($action['type'] === 'link'): ?> <? if ($action['type'] === 'link'): ?>
<a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>> <a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<? if ($action['icon']): ?> <? if ($action['icon']): ?>
<?= $action['icon'] ?> <?= $action['icon']->asImg(false) ?>
<? else: ?> <? else: ?>
<span class="action-menu-no-icon"></span> <span class="action-menu-no-icon"></span>
<? endif ?> <? endif ?>
...@@ -24,7 +37,7 @@ ...@@ -24,7 +37,7 @@
<? elseif ($action['type'] === 'button'): ?> <? elseif ($action['type'] === 'button'): ?>
<? if ($action['icon']): ?> <? if ($action['icon']): ?>
<label class="undecorated"> <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']) ?> <?= htmlReady($action['label']) ?>
</label> </label>
<? else: ?> <? else: ?>
......
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