Skip to content

Commit 47fc64d

Browse files
committed
Fixed how multiple temporal granularities are displayed
1 parent 76e9ae4 commit 47fc64d

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/base/templatetags/split_filter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django import template
2+
3+
register = template.Library()
4+
5+
6+
@register.filter(name="split")
7+
def split(value, separator=","):
8+
"""
9+
Custom template filter to split a string by a given separator.
10+
Defaults to splitting by comma if no separator is provided.
11+
"""
12+
if isinstance(value, str):
13+
return value.split(separator)
14+
return []

src/templates/indicatorsets/indicatorSetsTable.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{% load crispy_forms_tags %}
33
{% load static %}
44
{% load dict_get %}
5+
{% load split_filter %}
56
<!-- Data Table -->
67
<link rel="stylesheet"
78
href="https://cdn.datatables.net/v/dt/dt-2.1.8/b-3.2.0/b-colvis-3.2.0/cr-2.0.4/fc-5.0.4/fh-4.0.1/kt-2.12.1/r-3.0.3/rg-1.5.1/rr-1.5.0/sc-2.4.3/sp-2.3.3/sl-2.1.0/datatables.min.css">
@@ -283,7 +284,9 @@
283284
<td>{{ indicator_set.temporal_scope_start }}</td>
284285
<td>{{ indicator_set.temporal_scope_end }}</td>
285286
<td>
286-
<span class="badge rounded-pill bg-dark">{{ indicator_set.temporal_granularity }}</span>
287+
{% for item in indicator_set.temporal_granularity|split:"," %}
288+
<span class="badge rounded-pill bg-dark">{{ item }}</span>
289+
{% endfor %}
287290
</td>
288291
<td>{{ indicator_set.reporting_cadence }}</td>
289292
<td>{{ indicator_set.reporting_lag }}</td>
@@ -318,7 +321,16 @@
318321
</div>
319322
<!-- Loader Overlay -->
320323
<div class="loader-overlay" id="loaderOverlay">
321-
<div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
324+
<div class="lds-roller">
325+
<div></div>
326+
<div></div>
327+
<div></div>
328+
<div></div>
329+
<div></div>
330+
<div></div>
331+
<div></div>
332+
<div></div>
333+
</div>
322334
</div>
323335
<div class="float" id="showSelectedIndicatorsButton" style="display:none;">
324336
<a type="button"

0 commit comments

Comments
 (0)