diff --git a/templates/list_default_organisationen.html.twig b/templates/list_default_organisationen.html.twig new file mode 100644 index 0000000..c799534 --- /dev/null +++ b/templates/list_default_organisationen.html.twig @@ -0,0 +1,258 @@ +{% extends '@Contao/block_searchable.html.twig' %} + +{% set wrapperAttributes = attrs() + .addClass(['ce_table', 'listing']) + .mergeWith(wrapperAttributes|default) +%} + +{% block content %} + + {% set legacyTagLabels = { + '10': 'Sport', + '11': 'Kultur', + '12': 'Politik', + '13': 'Soziales', + '14': 'Freizeit', + '15': 'Bildung', + '16': 'Religion', + '17': 'Natur', + '18': 'Gesellschaft' + } %} + + {% if searchable %} + + {% endif %} + + {% if per_page %} +
+
+
+ + + + +
+ + +
+
+ +
+
+
+
+ {% endif %} + + {% if searchable and for and not tbody|default %} + {{ no_results }} + {% else %} + {% set tagOptions = {} %} + + {% for row in tbody|default([]) %} + {% set tagsRaw = row.tag_labels.content|default(row.tags.content|default(''))|striptags %} + {% set tagsPrepared = tagsRaw|replace({' ': '', ' ': '', ' ': '', ';': ',', '|': ',', '/': ',', ', ': ',', ' ,': ','}) %} + {% set tagParts = tagsPrepared is not empty ? tagsPrepared|split(',') : [] %} + + {% for part in tagParts %} + {% set tagValue = part|striptags|replace({' ': '', ' ': '', ' ': ''})|trim %} + + {% if legacyTagLabels[tagValue] is defined %} + {% set tagLabel = legacyTagLabels[tagValue] %} + {% elseif tagValue matches '/^\\d+$/' %} + {% set tagLabel = '' %} + {% elseif tagValue matches '/^[\\p{L}\\p{N}\\s._,&+\\-\\/]+$/u' %} + {% set tagLabel = tagValue %} + {% else %} + {% set tagLabel = '' %} + {% endif %} + + {% if tagLabel is not empty %} + {% set tagSlug = tagLabel|lower|replace({'ä': 'ae', 'ö': 'oe', 'ü': 'ue', 'ß': 'ss', ' ': '-', '/': '-', '&': '-', '+': '-', '.': '', ',': '', '(': '', ')': '', '"': '', "'": ''}) %} + + {% if tagSlug is not empty and tagOptions[tagSlug] is not defined %} + {% set tagOptions = tagOptions|merge({ (tagSlug): tagLabel }) %} + {% endif %} + {% endif %} + {% endfor %} + {% endfor %} + + + +
+ + + +
+ +
+
+ {% for row in tbody|default([]) %} + {% set tagSlugsRaw = row.tag_slugs.content|default('')|trim %} + {% set tagsRaw = row.tag_labels.content|default(row.tags.content|default(''))|striptags %} + {% set tagsPrepared = tagsRaw|replace({' ': '', ' ': '', ' ': '', ';': ',', '|': ',', '/': ',', ', ': ',', ' ,': ','}) %} + {% set tagParts = tagsPrepared is not empty ? tagsPrepared|split(',') : [] %} + + {% set tagClasses = [] %} + {% set tagSlugs = [] %} + + {% if tagSlugsRaw is not empty %} + {% for slug in tagSlugsRaw|split(',') %} + {% set cleanedSlug = slug|trim %} + + {% if cleanedSlug is not empty %} + {% set tagSlugs = tagSlugs|merge([cleanedSlug]) %} + {% set tagClasses = tagClasses|merge(['tag-' ~ cleanedSlug]) %} + {% endif %} + {% endfor %} + {% endif %} + + {% for part in tagParts if tagSlugsRaw is empty %} + {% set tagValue = part|striptags|replace({' ': '', ' ': '', ' ': ''})|trim %} + + {% if legacyTagLabels[tagValue] is defined %} + {% set tagLabel = legacyTagLabels[tagValue] %} + {% elseif tagValue matches '/^\\d+$/' %} + {% set tagLabel = '' %} + {% elseif tagValue matches '/^[\\p{L}\\p{N}\\s._,&+\\-\\/]+$/u' %} + {% set tagLabel = tagValue %} + {% else %} + {% set tagLabel = '' %} + {% endif %} + + {% if tagLabel is not empty %} + {% set tagSlug = tagLabel|lower|replace({'ä': 'ae', 'ö': 'oe', 'ü': 'ue', 'ß': 'ss', ' ': '-', '/': '-', '&': '-', '+': '-', '.': '', ',': '', '(': '', ')': '', '"': '', "'": ''}) %} + + {% if tagSlug is not empty %} + {% set tagClasses = tagClasses|merge(['tag-' ~ tagSlug]) %} + {% set tagSlugs = tagSlugs|merge([tagSlug]) %} + {% endif %} + {% endif %} + {% endfor %} + + {% set title = row.title.content|default('') %} + {% set logoUuid = row.logo_uuid.content|default('')|trim %} + {% set lastCol = row|last %} + +
+
+ {% if logoUuid is not empty %} + + {% endif %} + + {% if title is not empty %} +
{{ title|sanitize_html }}
+ {% endif %} + + {% if details and lastCol and lastCol.url|default %} + + {% endif %} +
+
+ {% endfor %} +
+
+ {% endif %} + + {% if pagination is defined %} + {{ pagination|raw }} + {% endif %} + + + + +{% endblock %}