diff --git a/app/t_roles/route.py b/app/t_roles/route.py index bf0a315..8a0c69c 100644 --- a/app/t_roles/route.py +++ b/app/t_roles/route.py @@ -8,6 +8,7 @@ flash, current_app, ) +import re from pypnusershub import routes as fnauth from pypnusershub.db.models import check_and_encrypt_password @@ -291,6 +292,9 @@ def buildUserFullName(user): fullname.append(user["prenom_role"].title()) return " ".join(fullname) +@route.app_template_filter() +def pretty_json_key(key): + return re.sub("([a-z])([A-Z])","\g<1> \g<2>",key) def pops(form, with_group=True): """ diff --git a/app/templates/info_user.html b/app/templates/info_user.html index eb1f317..aa5dfa9 100644 --- a/app/templates/info_user.html +++ b/app/templates/info_user.html @@ -6,6 +6,7 @@ {%set is_organisme = organisme is not none and organisme['nom_organisme'] != '' %} {%set is_desc = user['desc_role'] is not none and user['desc_role'] != '' %} {%set is_remarques = user['remarques'] is not none and user['remarques'] != '' %} +{%set is_champs_addi = user['champs_addi'] is not none and user['champs_addi'] != '' %} {%set is_mail = user['email'] is not none and user['email'] != '' %} {%set is_group = groups|length > 0 %} {%set is_list = lists|length > 0 %} @@ -32,6 +33,31 @@

Utilisateur "{{user['fullname']}}"

{% if is_remarques %}
Remarques : {{user['remarques']}} {% endif %} + {% if is_champs_addi %} +
+ {% for key, value in user.champs_addi.items() %} +
{{ key|pretty_json_key|capitalize }} :
+
+ {% if value is iterable and (value is not string and value is not mapping) %} + + {% elif value is mapping %} +
+ {% for key, value in value.items() %} +
{{ key|e|capitalize }} :
+
{{ value }}
+ {% endfor %} +
+ {% else %} + {{ value }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} diff --git a/app/templates/librairies.html b/app/templates/librairies.html index 0d186bb..b928e35 100644 --- a/app/templates/librairies.html +++ b/app/templates/librairies.html @@ -3,8 +3,20 @@ {% block title %}UsersHub V2{% endblock %} {% block styles %} - +