From 130ce5537847b44a8baf98e3be7ce0e36855cf4c Mon Sep 17 00:00:00 2001 From: Grizzly Date: Thu, 19 Jul 2018 12:33:20 +0000 Subject: [PATCH] =?UTF-8?q?ajout=20d'un=20templatetag=20tick=20pour=20affi?= =?UTF-8?q?cher=20les=20bool=C3=A9ens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preferences/display_preferences.html | 19 ++++----- preferences/templatetags/__init__.py | 19 +++++++++ preferences/templatetags/design.py | 41 +++++++++++++++++++ 3 files changed, 68 insertions(+), 11 deletions(-) mode change 100644 => 100755 preferences/templates/preferences/display_preferences.html create mode 100644 preferences/templatetags/__init__.py create mode 100644 preferences/templatetags/design.py diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html old mode 100644 new mode 100755 index 3eb76af9..1623f1cc --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -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 %} -

Préférences utilisateur

+

Préférences utilisateur

Editer @@ -40,25 +41,21 @@ with this program; if not, write to the Free Software Foundation, Inc., - + - + - + - - - - - + - +
Téléphone obligatoirement requis{{ useroptions.is_tel_mandatory }}{{ useroptions.is_tel_mandatory|tick }} Auto inscription{{ useroptions.self_adhesion }}{{ useroptions.self_adhesion|tick }}
Champ gpg fingerprint{{ useroptions.gpg_fingerprint }}{{ useroptions.gpg_fingerprint|tick }} Shell par défaut des utilisateurs {{ useroptions.shell_default }}
Champ gpg fingerprint{{ useroptions.gpg_fingerprint }}
Creations d'adhérents par tous{{ useroptions.all_can_create_adherent }}{{ useroptions.all_can_create_adherent|tick }} Creations de clubs par tous{{ useroptions.all_can_create_club }}{{ useroptions.all_can_create_club|tick }}
@@ -66,7 +63,7 @@ with this program; if not, write to the Free Software Foundation, Inc., - + diff --git a/preferences/templatetags/__init__.py b/preferences/templatetags/__init__.py new file mode 100644 index 00000000..86d112b2 --- /dev/null +++ b/preferences/templatetags/__init__.py @@ -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. diff --git a/preferences/templatetags/design.py b/preferences/templatetags/design.py new file mode 100644 index 00000000..5e18572f --- /dev/null +++ b/preferences/templatetags/design.py @@ -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 = '' + else: + result = '' + + return mark_safe(result)
Gestion des comptes mails{{ useroptions.mail_accounts }}{{ useroptions.mail_accounts|tick }} Extension mail interne {{ useroptions.mail_extension }}