Commit 326279fe authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

Conditionally show Service Locations in edumanage menu and home page, if the

institution type permits
parent 89cdc495
......@@ -22,9 +22,11 @@
</li>
{% endif %}
{% if institutiondetails %}
{% if institution_canhaveservicelocs %}
<li {% block servicesactive %}{% endblock %}>
<a href="{% url services %}">{% trans "Locations" %} ({{services_num}})</a>
</li>
{% endif %}
<li {% block serversactive %}{% endblock %}>
<a href="{% url servers %}">{% trans "Servers" %} ({{servers_num}})</a>
</li>
......@@ -56,17 +58,19 @@
<tr class="error"><td>You are not associated with any institution. Please contact your administrator<td></tr>
</table>
{% else %}
<h4>{% trans "Home" %} - {% trans "Service Locations" %} </h4>
<h4>{% trans "Home" %}{% if institution_canhaveservicelocs %} - {% trans "Service Locations" %}{% endif %} </h4>
<hr>
{% if services %}
<div id="map_canvas" data-group="{% static 'img/edugroup.png' %}" data-pin="{% static 'img/edupin.png' %}" data-center-lat="{{MAP_CENTER.0}}" data-center-lng="{{MAP_CENTER.1}}" data-service="{% url get-service-points %}" data-service-edit="{% url edit-services %}" style="width:100%; height:450px;"></div>
{% else %}
<div>
{% if institutiondetails %}
{% if institution_canhaveservicelocs %}
{% trans "No services defined yet"%}!
<a href="{% url edit-services %}" class="btn btn-primary">
{% trans "Add new service" %}
</a>
{% endif %}
{% else %}
Specify your institution details to proceed <a class="btn btn-small btn-primary" href="{% url edit-institution institution.pk %}">{% trans "Edit" %}</a>
{% endif %}
......
......@@ -1398,6 +1398,7 @@ def base_response(request):
contacts = []
institution = False
institution_exists = False
institution_canhaveservicelocs = False
try:
profile = user.get_profile()
institution = profile.institution
......@@ -1422,6 +1423,10 @@ def base_response(request):
instututiondetails = institution.institutiondetails
except:
instututiondetails = False
try:
institution_canhaveservicelocs = institution.ertype in [2, 3]
except:
pass
return {
'inst_num': len(inst),
'servers_num': len(server),
......@@ -1432,6 +1437,7 @@ def base_response(request):
'institution': institution,
'institutiondetails': instututiondetails,
'institution_exists': institution_exists,
'institution_canhaveservicelocs': institution_canhaveservicelocs,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment