mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 15:33:45 +00:00
Printer app really is optionnal
This commit is contained in:
parent
918721a78c
commit
2912f9dcf8
2 changed files with 19 additions and 2 deletions
|
@ -30,6 +30,7 @@ from django.http import HttpRequest
|
|||
from preferences.models import GeneralOption, OptionalMachine
|
||||
from django.utils.translation import get_language
|
||||
|
||||
from re2o.settings import INSTALLED_APPS
|
||||
|
||||
def context_user(request):
|
||||
"""Fonction de context lorsqu'un user est logué (ou non),
|
||||
|
@ -57,7 +58,6 @@ def context_user(request):
|
|||
'ipv6_enabled': OptionalMachine.get_cached_value('ipv6'),
|
||||
}
|
||||
|
||||
|
||||
def date_now(request):
|
||||
"""Add the current date in the context for quick informations and
|
||||
comparisons"""
|
||||
|
@ -65,3 +65,12 @@ def date_now(request):
|
|||
'now_aware': datetime.datetime.now(datetime.timezone.utc),
|
||||
'now_naive': datetime.datetime.now()
|
||||
}
|
||||
|
||||
def context_printer(request):
|
||||
"""
|
||||
Useful to know whether the printer app is activated or not
|
||||
"""
|
||||
printer = 'printer' in INSTALLED_APPS
|
||||
return {
|
||||
'printer': printer,
|
||||
}
|
||||
|
|
|
@ -101,6 +101,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-area-chart"></i> {% trans "Statistics" %}</a></li>
|
||||
{% acl_end %}
|
||||
|
@ -121,7 +129,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</ul>
|
||||
</li>
|
||||
{% if not request.user.is_authenticated %}
|
||||
{% if var_sa %}
|
||||
{% if var_sa %}
|
||||
<li>
|
||||
<a href="{% url 'users:new-user' %}">
|
||||
<i class="fa fa-user-plus"></i> {% trans "Sign up" %}
|
||||
|
|
Loading…
Reference in a new issue