From e19643bf18c31aad3f5516f78c42b1f735b52465 Mon Sep 17 00:00:00 2001
From: sagarg
Date: Tue, 10 Sep 2019 14:22:09 +0545
Subject: [PATCH] [opendk][s]: consolidate data format - duplicate removed,
colored format & groups and organisations alphabetically Sorted
---
themes/opendk/views/collections-home.html | 2 +-
.../views/partials/data-search-results.njk | 25 ++++++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/themes/opendk/views/collections-home.html b/themes/opendk/views/collections-home.html
index 50be48e5..3a9862cd 100644
--- a/themes/opendk/views/collections-home.html
+++ b/themes/opendk/views/collections-home.html
@@ -26,7 +26,7 @@ {{ title }}
- {% for collection in collections %}
+ {% for collection in collections | sort(attribute='title') %}
-
diff --git a/themes/opendk/views/partials/data-search-results.njk b/themes/opendk/views/partials/data-search-results.njk
index 7f21719b..0c13d81e 100644
--- a/themes/opendk/views/partials/data-search-results.njk
+++ b/themes/opendk/views/partials/data-search-results.njk
@@ -30,12 +30,31 @@
+ {% set formats = [] %}{% set colors = {
+ CSV: '#ffca00',
+ XLSX:'#3CBC8D',
+ XLS:'#3CBC8D',
+ JSON:'blue',
+ GeoJSON:'#2CAAF9',
+ WFS:'#08389c',
+ PDF:'#ff1010',
+ SHP:'violet',
+ HTML:'#333',
+ KML:'gray',
+ ODS:'gray'
+ } %}
+
{% for resource in package.resources %}
- {% if resource.format %}
+ {% if resource.format not in formats %}
+ {{formats.push(resource.format)}}
+ {% endif %}
+ {% endfor %}
+ {% for format in formats %}
+ {%if format %}
-
- {{ resource.format }}
+ {{ format }}
- {% endif %}
+ {% endif %}
{% endfor %}