Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b62e72382 | |||
| 97e4f639a0 | |||
| b714bbeb1b |
@@ -96,8 +96,8 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2/dist/css/tom-select.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tom-select@2/dist/js/tom-select.complete.min.js"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const filters = document.getElementById('eventfilters');
|
const filters = document.getElementById('eventfilters');
|
||||||
@@ -135,6 +135,8 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let shouldBlurOnChange = false;
|
||||||
|
|
||||||
return new window.TomSelect(selectElement, {
|
return new window.TomSelect(selectElement, {
|
||||||
create: false,
|
create: false,
|
||||||
sortField: {
|
sortField: {
|
||||||
@@ -149,6 +151,30 @@
|
|||||||
return '<div class="no-more-results" role="option" aria-disabled="true">Keine weiteren Ergebnisse</div>';
|
return '<div class="no-more-results" role="option" aria-disabled="true">Keine weiteren Ergebnisse</div>';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
onInitialize() {
|
||||||
|
const markPointerInteraction = () => {
|
||||||
|
shouldBlurOnChange = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const markKeyboardInteraction = () => {
|
||||||
|
shouldBlurOnChange = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.control.addEventListener('pointerdown', markPointerInteraction);
|
||||||
|
this.control.addEventListener('touchstart', markPointerInteraction, { passive: true });
|
||||||
|
this.control.addEventListener('keydown', markKeyboardInteraction);
|
||||||
|
this.dropdown.addEventListener('pointerdown', markPointerInteraction);
|
||||||
|
this.dropdown.addEventListener('touchstart', markPointerInteraction, { passive: true });
|
||||||
|
this.dropdown.addEventListener('keydown', markKeyboardInteraction);
|
||||||
|
},
|
||||||
|
onChange() {
|
||||||
|
if (!shouldBlurOnChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.blur();
|
||||||
|
shouldBlurOnChange = false;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class OrganizationListingTemplateDataListener
|
|||||||
|
|
||||||
$organizationIds = array_values(array_unique(array_values($rowToOrganizationIdMap)));
|
$organizationIds = array_values(array_unique(array_values($rowToOrganizationIdMap)));
|
||||||
$organizationTagMap = $this->fetchOrganizationTagMap($organizationIds);
|
$organizationTagMap = $this->fetchOrganizationTagMap($organizationIds);
|
||||||
$organizationLogoUuidMap = $this->fetchOrganizationLogoUuidMap($organizationIds);
|
$organizationLogoMap = $this->fetchOrganizationLogoMap($organizationIds);
|
||||||
|
|
||||||
$organizationTagLabelMap = [];
|
$organizationTagLabelMap = [];
|
||||||
$rowTagIdsList = [];
|
$rowTagIdsList = [];
|
||||||
@@ -74,7 +74,9 @@ class OrganizationListingTemplateDataListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tagData = $organizationTagMap[$organizationId] ?? ['ids' => [], 'labels' => []];
|
$tagData = $organizationTagMap[$organizationId] ?? ['ids' => [], 'labels' => []];
|
||||||
$logoUuid = $organizationLogoUuidMap[$organizationId] ?? '';
|
$logoData = $organizationLogoMap[$organizationId] ?? ['uuid' => '', 'isSvg' => false];
|
||||||
|
$logoUuid = (string) ($logoData['uuid'] ?? '');
|
||||||
|
$logoIsSvg = (bool) ($logoData['isSvg'] ?? false);
|
||||||
$tagIdsCsv = implode(',', $tagData['ids']);
|
$tagIdsCsv = implode(',', $tagData['ids']);
|
||||||
$tagLabelsCsv = implode(', ', $tagData['labels']);
|
$tagLabelsCsv = implode(', ', $tagData['labels']);
|
||||||
|
|
||||||
@@ -84,6 +86,7 @@ class OrganizationListingTemplateDataListener
|
|||||||
|
|
||||||
if ('' !== $logoUuid) {
|
if ('' !== $logoUuid) {
|
||||||
$tbody[$rowIndex]['logo_uuid']['content'] = $logoUuid;
|
$tbody[$rowIndex]['logo_uuid']['content'] = $logoUuid;
|
||||||
|
$tbody[$rowIndex]['logo_is_svg']['content'] = $logoIsSvg ? '1' : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,16 +269,19 @@ class OrganizationListingTemplateDataListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @param list<int> $organizationIds
|
/** @param list<int> $organizationIds
|
||||||
* @return array<int, string>
|
* @return array<int, array{uuid: string, isSvg: bool}>
|
||||||
*/
|
*/
|
||||||
private function fetchOrganizationLogoUuidMap(array $organizationIds): array
|
private function fetchOrganizationLogoMap(array $organizationIds): array
|
||||||
{
|
{
|
||||||
if ([] === $organizationIds) {
|
if ([] === $organizationIds) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $this->connection->executeQuery(
|
$rows = $this->connection->executeQuery(
|
||||||
'SELECT o.id AS organization_id, o.logo AS logo_uuid FROM tl_organization o WHERE o.id IN (?)',
|
'SELECT o.id AS organization_id, o.logo AS logo_uuid, f.extension AS file_extension, f.path AS file_path
|
||||||
|
FROM tl_organization o
|
||||||
|
LEFT JOIN tl_files f ON f.uuid = o.logo
|
||||||
|
WHERE o.id IN (?)',
|
||||||
[$organizationIds],
|
[$organizationIds],
|
||||||
[ArrayParameterType::INTEGER],
|
[ArrayParameterType::INTEGER],
|
||||||
)->fetchAllAssociative();
|
)->fetchAllAssociative();
|
||||||
@@ -285,12 +291,22 @@ class OrganizationListingTemplateDataListener
|
|||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$organizationId = (int) ($row['organization_id'] ?? 0);
|
$organizationId = (int) ($row['organization_id'] ?? 0);
|
||||||
$logoUuid = $this->normalizeUuid($row['logo_uuid'] ?? null);
|
$logoUuid = $this->normalizeUuid($row['logo_uuid'] ?? null);
|
||||||
|
$extension = strtolower(trim((string) ($row['file_extension'] ?? '')));
|
||||||
|
|
||||||
|
if ('' === $extension && isset($row['file_path']) && \is_scalar($row['file_path'])) {
|
||||||
|
$extension = strtolower((string) pathinfo((string) $row['file_path'], PATHINFO_EXTENSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
$isSvg = 'svg' === $extension;
|
||||||
|
|
||||||
if ($organizationId <= 0 || '' === $logoUuid) {
|
if ($organizationId <= 0 || '' === $logoUuid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$map[$organizationId] = $logoUuid;
|
$map[$organizationId] = [
|
||||||
|
'uuid' => $logoUuid,
|
||||||
|
'isSvg' => $isSvg,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map;
|
return $map;
|
||||||
|
|||||||
Reference in New Issue
Block a user