mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 18:03:37 +02:00
Show attachment name and filename when hovering over an table picture.
This commit is contained in:
parent
53dd0c4228
commit
19e132c746
2 changed files with 17 additions and 4 deletions
|
@ -83,12 +83,19 @@ final class AttachmentDataTable implements DataTableTypeInterface
|
|||
if ($context->isPicture()
|
||||
&& ! $context->isExternal()
|
||||
&& $this->attachmentHelper->isFileExisting($context)) {
|
||||
|
||||
$title = htmlspecialchars($context->getName());
|
||||
if ($context->getFilename()) {
|
||||
$title .= ' (' . htmlspecialchars($context->getFilename()) . ')';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s">',
|
||||
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s" data-title="%s">',
|
||||
'Part image',
|
||||
$this->attachmentURLGenerator->getThumbnailURL($context),
|
||||
$this->attachmentURLGenerator->getThumbnailURL($context, 'thumbnail_md'),
|
||||
'img-fluid hoverpic'
|
||||
'img-fluid hoverpic',
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,12 +161,18 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
return '';
|
||||
}
|
||||
|
||||
$title = htmlspecialchars($preview_attachment->getName());
|
||||
if ($preview_attachment->getFilename()) {
|
||||
$title .= ' (' . htmlspecialchars($preview_attachment->getFilename()) . ')';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s">',
|
||||
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s" data-title="%s">',
|
||||
'Part image',
|
||||
$this->attachmentURLGenerator->getThumbnailURL($preview_attachment),
|
||||
$this->attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_md'),
|
||||
'img-fluid hoverpic'
|
||||
'img-fluid hoverpic',
|
||||
$title
|
||||
);
|
||||
},
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue