mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Made attachment datatable sortable by internal filename and external url
This commit is contained in:
parent
29f92d9bd3
commit
48be9a8098
2 changed files with 5 additions and 6 deletions
|
@ -6,11 +6,7 @@ namespace DoctrineMigrations;
|
||||||
|
|
||||||
use App\Migration\AbstractMultiPlatformMigration;
|
use App\Migration\AbstractMultiPlatformMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20250220215048 extends AbstractMultiPlatformMigration
|
final class Version20250220215048 extends AbstractMultiPlatformMigration
|
||||||
{
|
{
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
|
|
|
@ -119,6 +119,7 @@ final class AttachmentDataTable implements DataTableTypeInterface
|
||||||
$dataTable->add('internal_link', TextColumn::class, [
|
$dataTable->add('internal_link', TextColumn::class, [
|
||||||
'label' => 'attachment.table.internal_file',
|
'label' => 'attachment.table.internal_file',
|
||||||
'propertyPath' => 'filename',
|
'propertyPath' => 'filename',
|
||||||
|
'orderField' => 'NATSORT(attachment.original_filename)',
|
||||||
'render' => function ($value, Attachment $context) {
|
'render' => function ($value, Attachment $context) {
|
||||||
if ($this->attachmentHelper->isInternalFileExisting($context)) {
|
if ($this->attachmentHelper->isInternalFileExisting($context)) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
@ -135,12 +136,14 @@ final class AttachmentDataTable implements DataTableTypeInterface
|
||||||
$dataTable->add('external_link', TextColumn::class, [
|
$dataTable->add('external_link', TextColumn::class, [
|
||||||
'label' => 'attachment.table.external_link',
|
'label' => 'attachment.table.external_link',
|
||||||
'propertyPath' => 'host',
|
'propertyPath' => 'host',
|
||||||
|
'orderField' => 'attachment.external_path',
|
||||||
'render' => function ($value, Attachment $context) {
|
'render' => function ($value, Attachment $context) {
|
||||||
if ($context->hasExternal()) {
|
if ($context->hasExternal()) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<a href="%s" class="link-external">%s</a>',
|
'<a href="%s" class="link-external" title="%s" target="_blank" rel="noopener">%s</a>',
|
||||||
htmlspecialchars((string) $context->getExternalPath()),
|
htmlspecialchars((string) $context->getExternalPath()),
|
||||||
htmlspecialchars($value)
|
htmlspecialchars((string) $context->getExternalPath()),
|
||||||
|
htmlspecialchars($value),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue