mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
ajout d'un templatetag tick pour afficher les booléens
This commit is contained in:
parent
66dc72d1a0
commit
130ce55378
3 changed files with 68 additions and 11 deletions
19
preferences/templates/preferences/display_preferences.html
Normal file → Executable file
19
preferences/templates/preferences/display_preferences.html
Normal file → Executable file
|
@ -25,11 +25,12 @@ 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 %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalUser' %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
Editer
|
Editer
|
||||||
|
@ -40,25 +41,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>
|
<th>Auto inscription</th>
|
||||||
<td>{{ useroptions.self_adhesion }}</td>
|
<td>{{ useroptions.self_adhesion|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<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>
|
<th>Shell par défaut des utilisateurs</th>
|
||||||
<td>{{ useroptions.shell_default }}</td>
|
<td>{{ useroptions.shell_default }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>Champ gpg fingerprint</th>
|
|
||||||
<td>{{ useroptions.gpg_fingerprint }}</td>
|
|
||||||
</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>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -66,7 +63,7 @@ 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>Gestion des comptes mails</th>
|
<th>Gestion des comptes mails</th>
|
||||||
<td>{{ useroptions.mail_accounts }}</td>
|
<td>{{ useroptions.mail_accounts|tick }}</td>
|
||||||
<th>Extension mail interne</th>
|
<th>Extension mail interne</th>
|
||||||
<td>{{ useroptions.mail_extension }}</td>
|
<td>{{ useroptions.mail_extension }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
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