From d6d992e26037b84d18d0dc8dcb55f4779ef417f5 Mon Sep 17 00:00:00 2001
From: Carlos Vega <carlos.vega@uni.lu>
Date: Wed, 24 Oct 2018 10:22:11 +0200
Subject: [PATCH] use the whole study object instead of the properties

---
 smash/web/templates/sidebar.html | 6 +++---
 smash/web/views/__init__.py      | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/smash/web/templates/sidebar.html b/smash/web/templates/sidebar.html
index dd25553c..f4b3c857 100644
--- a/smash/web/templates/sidebar.html
+++ b/smash/web/templates/sidebar.html
@@ -66,7 +66,7 @@
         </a>
     </li>
 
-    {% if has_vouchers %}
+    {% if study.has_vouchers %}
     <li data-desc="vouchers">
         <a href="{% url 'web.views.vouchers' %}">
             <i class="fa fa-user-md"></i>
@@ -85,10 +85,10 @@
         <ul class="treeview-menu">
             <li><a href="{% url 'web.views.configuration' %}">General</a></li>
             <li><a href="{% url 'web.views.languages' %}">Languages</a></li>
-            {% if has_voucher_types %}
+            {% if study.has_voucher_types %}
             <li><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li>
             {% endif %}
-            {% if has_vouchers %}
+            {% if study.has_vouchers %}
             <li><a href="{% url 'web.views.workers' 'VOUCHER_PARTNER' %}">Voucher partners</a></li>
             {% endif %}
             <li><a href="{% url 'web.views.workers' 'HEALTH_PARTNER' %}">Health partners</a></li>
diff --git a/smash/web/views/__init__.py b/smash/web/views/__init__.py
index 13dcbeb5..fa58ba75 100644
--- a/smash/web/views/__init__.py
+++ b/smash/web/views/__init__.py
@@ -60,8 +60,7 @@ def extend_context(params, request):
         'role': role,
         'notifications': notifications,
         'study_id': GLOBAL_STUDY_ID,
-        'has_vouchers' : study.has_vouchers,
-        'has_voucher_types' : study.has_voucher_types
+        'study' : study
     })
     return final_params
 
-- 
GitLab