Skip to content

Commit

Permalink
only apply shader if it's available for current area type
Browse files Browse the repository at this point in the history
Also indicate in the UI if it's not available.
  • Loading branch information
struan committed Nov 9, 2023
1 parent 2bc9ed1 commit 44ea84d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hub/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ def data(self, as_dict=False, mp_name=False):
def shader(self):
name = self.request.GET.get("shader")
try:
return DataSet.objects.get(name=name)
return DataSet.objects.get(name=name, areas_available=self.area_type())
except DataSet.DoesNotExist:
return None
2 changes: 1 addition & 1 deletion hub/templates/hub/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h3 class="h6">${ filter.title }</h3>
<h2 class="h5 mt-4 mt-lg-5 mb-3 mb-lg-4 text-primary">Step 3: Shade constituencies (optional)</h2>

<div ref="shaderContainer" hidden>
<div v-if="shader" class="bg-gray-100 border p-3 rounded">
<div v-if="shader" class="border p-3 rounded" :class="{ 'bg-gray-100': shader.areas_available.includes(area_type), 'bg-red-100': !shader.areas_available.includes(area_type) }">
<div class="d-flex">
<h3 class="h6 mb-0 me-auto">${ shader.title }</h3>
<button @click="removeShader(shader.name)" type="button" class="btn-close p-0" aria-label="Remove shader"></button>
Expand Down

0 comments on commit 44ea84d

Please sign in to comment.