mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
ajout d'un templatetag tick pour afficher les booléens
This commit is contained in:
parent
a84e8b5575
commit
b8c50385fc
3 changed files with 88 additions and 6 deletions
32
preferences/templates/preferences/display_preferences.html
Normal file → Executable file
32
preferences/templates/preferences/display_preferences.html
Normal file → Executable file
|
@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load design %}
|
||||||
|
|
||||||
{% block title %}Création et modification des préférences{% endblock %}
|
{% block title %}Création et modification des préférences{% endblock %}
|
||||||
|
|
||||||
|
@ -39,15 +40,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Téléphone obligatoirement requis</th>
|
<th>Téléphone obligatoirement requis</th>
|
||||||
<td>{{ useroptions.is_tel_mandatory }}</td>
|
<td>{{ useroptions.is_tel_mandatory|tick }}</td>
|
||||||
|
<th>Auto inscription</th>
|
||||||
|
<td>{{ useroptions.self_adhesion|tick }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<th>Champ gpg fingerprint</th>
|
<th>Champ gpg fingerprint</th>
|
||||||
<td>{{ useroptions.gpg_fingerprint }}</td>
|
<td>{{ useroptions.gpg_fingerprint|tick }}</td>
|
||||||
|
<th>Shell par défaut des utilisateurs</th>
|
||||||
|
<td>{{ useroptions.shell_default }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Creations d'adhérents par tous</th>
|
<th>Creations d'adhérents par tous</th>
|
||||||
<td>{{ useroptions.all_can_create_adherent }}</td>
|
<td>{{ useroptions.all_can_create_adherent|tick }}</td>
|
||||||
<th>Creations de clubs par tous</th>
|
<th>Creations de clubs par tous</th>
|
||||||
<td>{{ useroptions.all_can_create_club }}</td>
|
<td>{{ useroptions.all_can_create_club|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Auto inscription</th>
|
<th>Auto inscription</th>
|
||||||
|
@ -56,6 +63,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ useroptions.shell_default }}</td>
|
<td>{{ useroptions.shell_default }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<h5>{% if useroptions.mail_accounts %}<span class="label label-success">Comptes mails{% else %}<span class="label label-danger">Comptes mails{% endif%}</span></h5>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tr>
|
||||||
|
<th>Gestion des comptes mails</th>
|
||||||
|
<td>{{ useroptions.mail_accounts|tick }}</td>
|
||||||
|
<th>Extension mail interne</th>
|
||||||
|
<td>{{ useroptions.mail_extension }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Nombre d'alias maximum</th>
|
||||||
|
<td>{{ useroption.max_mail_alias }}<td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<h4>Préférences machines</h4>
|
<h4>Préférences machines</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
|
|
19
preferences/templatetags/__init__.py
Normal file
19
preferences/templatetags/__init__.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
||||||
|
# se veut agnostique au réseau considéré, de manière à être installable en
|
||||||
|
# quelques clics.
|
||||||
|
#
|
||||||
|
# Copyright © 2017 Maël Kervella
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
41
preferences/templatetags/design.py
Normal file
41
preferences/templatetags/design.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
||||||
|
# se veut agnostique au réseau considéré, de manière à être installable en
|
||||||
|
# quelques clics.
|
||||||
|
#
|
||||||
|
# Copyright © 2017 Maël Kervella
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
from django.utils.html import conditional_escape
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(needs_autoescape=False)
|
||||||
|
def tick(valeur, autoescape=False):
|
||||||
|
|
||||||
|
if autoescape:
|
||||||
|
esc = conditional_escape
|
||||||
|
else:
|
||||||
|
esc = lambda x: x
|
||||||
|
|
||||||
|
if valeur == True:
|
||||||
|
result = '<i style="color: #1ECA18;" class="fas fa-check"></i>'
|
||||||
|
else:
|
||||||
|
result = '<i style="color: #D10115;" class="fas fa-times"></i>'
|
||||||
|
|
||||||
|
return mark_safe(result)
|
Loading…
Reference in a new issue