Commit 130ce553 authored by Grizzly's avatar Grizzly

ajout d'un templatetag tick pour afficher les booléens

parent 66dc72d1
......@@ -25,11 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %}
{% load acl %}
{% load design %}
{% block title %}Création et modification des préférences{% endblock %}
{% block content %}
<h4>Préférences utilisateur</h4>
<h4>Préférences utilisateur</h4>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalUser' %}">
<i class="fa fa-edit"></i>
Editer
......@@ -40,25 +41,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<tr>
<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 }}</td>
<td>{{ useroptions.self_adhesion|tick }}</td>
</tr>
<tr>
<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>
<th>Champ gpg fingerprint</th>
<td>{{ useroptions.gpg_fingerprint }}</td>
</tr>
<tr>
<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>
<td>{{ useroptions.all_can_create_club }}</td>
<td>{{ useroptions.all_can_create_club|tick }}</td>
</tr>
</table>
......@@ -66,7 +63,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<tr>
<th>Gestion des comptes mails</th>
<td>{{ useroptions.mail_accounts }}</td>
<td>{{ useroptions.mail_accounts|tick }}</td>
<th>Extension mail interne</th>
<td>{{ useroptions.mail_extension }}</td>
</tr>
......
#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.
#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)
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