8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Printer app really is optionnal

This commit is contained in:
Maxime Bombar 2018-07-02 12:56:49 +02:00
parent 74a584e3f5
commit 088d056c1b
2 changed files with 12 additions and 0 deletions

View file

@ -27,6 +27,7 @@ from django.contrib import messages
from preferences.models import GeneralOption, OptionalMachine
from re2o.settings import INSTALLED_APPS
def context_user(request):
"""Fonction de context lorsqu'un user est logué (ou non),
@ -47,3 +48,12 @@ def context_user(request):
'name_website': GeneralOption.get_cached_value('site_name'),
'ipv6_enabled': OptionalMachine.get_cached_value('ipv6'),
}
def context_printer(request):
"""
Useful to know whether the printer app is activated or not
"""
printer = 'printer' in INSTALLED_APPS
return {
'printer': printer,
}

View file

@ -112,12 +112,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</ul>
</li>
{% acl_end %}
{% if printer %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="glyphicon glyphicon-print"></i> Printer<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url "printer:new-job" %}"><i class="fa fa-print"></i> {% trans "Print" %}</a></li>
</ul>
</li>
{% endif %}
{% can_view_app logs %}
<li><a href="{% url "logs:index" %}"><i class="fa fa-chart-area"></i> {% trans "Statistics" %}</a></li>
{% acl_end %}