fix(dashboard): Use the widget icon URL when it was provided

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/46448/head
Joas Schilling 2024-07-11 13:22:46 +07:00 committed by Andy Scherzinger
parent 6acecb6f68
commit 5368b93539
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
4 changed files with 27 additions and 5 deletions

@ -15,6 +15,7 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
use OCP\EventDispatcher\IEventDispatcher;
@ -54,6 +55,7 @@ class DashboardController extends Controller {
'id' => $widget->getId(),
'title' => $widget->getTitle(),
'iconClass' => $widget->getIconClass(),
'iconUrl' => $widget instanceof IIconWidget ? $widget->getIconUrl() : '',
'url' => $widget->getUrl()
];
}, $this->dashboardManager->getWidgets());

@ -24,7 +24,12 @@
class="panel">
<div class="panel--header">
<h2>
<span :aria-labelledby="`panel-${panels[panelId].id}--header--icon--description`"
<img v-if="apiWidgets[panels[panelId].id].icon_url"
:alt="apiWidgets[panels[panelId].id].title + ' icon'"
:src="apiWidgets[panels[panelId].id].icon_url"
aria-hidden="true">
<span v-else
:aria-labelledby="`panel-${panels[panelId].id}--header--icon--description`"
aria-hidden="true"
:class="apiWidgets[panels[panelId].id].icon_class"
role="img" />
@ -97,7 +102,11 @@
:checked="isActive(panel)"
@input="updateCheckbox(panel, $event.target.checked)">
<label :for="'panel-checkbox-' + panel.id" :class="{ draggable: isActive(panel) }">
<span :class="panel.iconClass" aria-hidden="true" />
<img v-if="panel.iconUrl"
:alt="panel.title + ' icon'"
:src="panel.iconUrl"
aria-hidden="true">
<span v-else :class="panel.iconClass" aria-hidden="true" />
{{ panel.title }}
</label>
</li>
@ -554,6 +563,8 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
cursor: grab;
img,
span {
background-size: 32px;
width: 32px;
@ -564,6 +575,10 @@ export default {
margin-top: -6px;
margin-left: 6px;
}
img {
filter: var(--background-invert-if-dark);
}
}
}
@ -651,6 +666,7 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
img,
span {
position: absolute;
top: 16px;
@ -659,6 +675,10 @@ export default {
background-size: 24px;
}
img {
filter: var(--background-invert-if-dark);
}
&:hover {
border-color: var(--color-primary-element);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long