Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cds/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,21 @@ def _parse_env_bool(var_name, default=None):
"language": {
"terms": {"field": "language.untouched"},
},
"collections": {
"terms": {
"field": "collections",
"size": 50,
"order": {"_key": "asc"},
# Include if the collection term contains '::'.
**(
{"include": r".*::.*"}
),
# Exclude if the collection term contains two '::' (3-level paths like A::B::C).
**(
{"exclude": r".*::.*::.*"}
),
},
},
"years": {
"date_histogram": {
"field": "date",
Expand All @@ -826,6 +841,7 @@ def _parse_env_bool(var_name, default=None):
"category": terms_filter("category.untouched"),
"type": terms_filter("type.untouched"),
"language": terms_filter("language"),
"collections": terms_filter("collections"),
"years": range_filter("date", format="yyyy", end_date_math="/y"),
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ <h2 class="text-capitalize f8 mt-5"><b>{{ key }}</b></h2>
class="cds-facets-item-link"
ng-class="{'cds-facets-item-link-checked': values.indexOf(item.key) > -1}"
ng-click="handleClick(key, item.key)">
{{ (key === 'language') ? (item.key | isoToLanguage) : item.key }}
{{
(key === 'language') ? (item.key | isoToLanguage) :
(key === 'collections') ? (item.key | collectionLabel) :
item.key
}}
<span class="cds-facets-item-link-counter pull-right fw-b">
<span ng-show="values.indexOf(item.key) > -1">
<i class="fa fa-remove"></i>
Expand Down
9 changes: 9 additions & 0 deletions cds/modules/theme/assets/bootstrap3/js/cds/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,15 @@ app.filter("isoToLanguage", [
},
]);

// Filter to translate collection keys to display labels
app.filter("collectionLabel", function () {
return function (key) {
if (!key) return key;
const strKey = String(key);
return strKey.includes("::") ? strKey.split("::").pop() : strKey;
};
});

app.filter("format_relation_resource_type", function () {
return function (input) {
if (!input) return "";
Expand Down
Loading