Skip to content

Commit df168f6

Browse files
committed
update filtering system
1 parent 9a25303 commit df168f6

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

collection.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ <h5 class="border-bottom pb-1">${title}</h5>
734734
// Categories for filtering
735735
const filterCategories = [
736736
{ key: 'responsible', label: 'Responsible Persons' },
737+
{ key: 'dataLang', label: 'Language of Data Entry' },
737738
{ key: 'repository', label: 'Repositories' },
738739
{ key: 'authors', label: 'Content Authors' },
739740
{ key: 'languages', label: 'Text Languages' },
@@ -745,6 +746,7 @@ <h5 class="border-bottom pb-1">${title}</h5>
745746
// Store available filter options as Maps
746747
let filterOptions = {
747748
responsible: new Map(), // key=externalID or name, value={label, uri}
749+
dataLang: new Map(),
748750
repository: new Map(),
749751
authors: new Map(),
750752
languages: new Map(),
@@ -776,6 +778,9 @@ <h5 class="border-bottom pb-1">${title}</h5>
776778
})
777779
.join(';');
778780

781+
//Data Entry Language
782+
row.dataset.dataLang = (entry.xmlLang || '').toLowerCase();
783+
779784
//Repository (label + URI)
780785
row.dataset.repository = combo(entry.repository);
781786

@@ -822,6 +827,15 @@ <h5 class="border-bottom pb-1">${title}</h5>
822827
}
823828
}
824829

830+
// Map xml:lang codes to human-readable names
831+
const langLabels = {
832+
de: "German",
833+
en: "English",
834+
it: "Italian",
835+
fr: "French",
836+
es: "Spanish"
837+
};
838+
825839
// After loading all entries, collect all unique filter values
826840
function buildFilterOptions(entries) {
827841
entries.forEach(entry => {
@@ -832,6 +846,12 @@ <h5 class="border-bottom pb-1">${title}</h5>
832846
addFilterOption(filterOptions.responsible, label, ref);
833847
});
834848

849+
//Data entry languge
850+
if (entry.xmlLang) {
851+
const label = langLabels[entry.xmlLang.toLowerCase()] || entry.xmlLang;
852+
addFilterOption(filterOptions.dataLang, label, entry.xmlLang.toLowerCase());
853+
}
854+
835855
//Repository
836856
if (entry.repository?.value) addFilterOption(filterOptions.repository, entry.repository.value, entry.repository.uri);
837857
else if (typeof entry.repository === 'object' && entry.repository.value)
@@ -876,9 +896,10 @@ <h5 class="border-bottom pb-1">${title}</h5>
876896

877897
values.forEach(item => {
878898
const safeVal = (item.uri ? item.uri.toLowerCase() : item.label.toLowerCase()).replace(/"/g, '&quot;');
879-
const linkIcon = item.uri
880-
? `<a href="${item.uri}" target="_blank" class="ms-1 text-muted" data-bs-toggle="tooltip" title="Open link"><i class="fas fa-link"></i></a>`
881-
: '';
899+
const linkIcon =
900+
(cat.key !== 'dataLang' && item.uri)
901+
? `<a href="${item.uri}" target="_blank" class="ms-1 text-muted" data-bs-toggle="tooltip" title="Open link"><i class="fas fa-link"></i></a>`
902+
: '';
882903

883904
section.innerHTML += `
884905
<div class="form-check">

0 commit comments

Comments
 (0)