2023-03-16 17:39:28 +00:00
|
|
|
{% extends theme('base.html') %}
|
2023-03-28 18:37:16 +00:00
|
|
|
{% import 'macro/form.html' as fui %}
|
2023-03-16 17:39:28 +00:00
|
|
|
|
2023-03-16 18:30:30 +00:00
|
|
|
{%- block title -%}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% if not edited_user %}
|
2023-03-16 18:30:30 +00:00
|
|
|
{%- trans %}User creation{% endtrans -%}
|
2023-02-05 17:57:18 +00:00
|
|
|
{% elif user.user_name == edited_user.user_name %}
|
2023-03-16 18:30:30 +00:00
|
|
|
{%- trans %}My profile{% endtrans -%}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% else %}
|
2023-03-16 18:30:30 +00:00
|
|
|
{%- trans %}User profile edition{% endtrans -%}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
2023-03-16 18:30:30 +00:00
|
|
|
{%- endblock -%}
|
2023-03-16 17:39:28 +00:00
|
|
|
|
|
|
|
{% block script %}
|
|
|
|
<script src="/static/js/confirm.js"></script>
|
|
|
|
<script src="/static/js/profile.js"></script>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block submenu %}
|
|
|
|
<nav class="ui bottom attached two item borderless menu">
|
2023-02-05 17:57:18 +00:00
|
|
|
<a class="active item" href="{{ url_for('account.profile_edition', username=edited_user.user_name[0]) }}">
|
2023-03-16 17:39:28 +00:00
|
|
|
<i class="id card icon"></i>
|
|
|
|
{% trans %}Personal information{% endtrans %}
|
|
|
|
</a>
|
2023-02-05 17:57:18 +00:00
|
|
|
<a class="item" href="{{ url_for('account.profile_settings', username=edited_user.user_name[0]) }}">
|
2023-03-16 17:39:28 +00:00
|
|
|
<i class="tools icon"></i>
|
|
|
|
{% trans %}Account information{% endtrans %}
|
|
|
|
</a>
|
|
|
|
</nav>
|
|
|
|
{% endblock %}
|
|
|
|
|
2023-06-19 16:10:14 +00:00
|
|
|
{% macro render_input(field, noindicator=false) %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% set lock_indicator = field.render_kw and ("readonly" in field.render_kw or "disabled" in field.render_kw) %}
|
|
|
|
{% if not edited_user %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ fui.render_input(field, **kwargs) }}
|
2023-02-05 17:57:18 +00:00
|
|
|
{% elif edited_user.user_name == user.user_name or lock_indicator or noindicator %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ fui.render_input(field, **kwargs) }}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% elif field.name in edited_user.write %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ fui.render_input(field, **kwargs) }}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% elif field.name in edited_user.read %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ fui.render_input(field, indicator_icon="eye", indicator_text=_("This user cannot edit this field"), **kwargs) }}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% else %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ fui.render_input(field, indicator_icon="eye slash", indicator_text=_("This user cannot see this field"), **kwargs) }}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="ui clearing segment">
|
|
|
|
<h2 class="ui center aligned header">
|
|
|
|
<div class="content">
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if user.user_name == edited_user.user_name %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% trans %}My profile{% endtrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans %}User profile edition{% endtrans %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="sub header">
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if user.user_name == edited_user.user_name %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% trans %}Edit your personal information{% endtrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans %}Edit information about a user{% endtrans %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</h2>
|
|
|
|
|
2023-03-28 21:12:54 +00:00
|
|
|
{% call fui.render_form(form) %}
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "photo" in form %}
|
2023-03-16 17:39:28 +00:00
|
|
|
<div class="ui grid">
|
|
|
|
<div class="three wide column">
|
|
|
|
{% block photo_field scoped %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{{ render_input(form.photo, display=false, class="photo-field") }}
|
|
|
|
{{ render_input(form.photo_delete, display=false, class="photo-delete-button") }}
|
2023-02-05 17:57:18 +00:00
|
|
|
{% set photo = edited_user.photo and edited_user.photo[0] %}
|
2023-03-16 17:39:28 +00:00
|
|
|
<label
|
|
|
|
class="ui small bordered image photo-content"
|
2023-02-05 17:57:18 +00:00
|
|
|
for="{{ form.photo.id }}"
|
2023-03-16 17:39:28 +00:00
|
|
|
title="{{ _("Click to upload a photo") }}"
|
|
|
|
{% if not photo %}style="display: none;"{% endif %}>
|
|
|
|
|
|
|
|
<a class="ui right corner label photo-delete-icon" title="{{ _("Delete the photo") }}">
|
|
|
|
<i class="times icon"></i>
|
|
|
|
</a>
|
2023-02-05 17:57:18 +00:00
|
|
|
<img src="{% if photo %}{{ url_for("account.photo", user_name=edited_user.user_name[0], field="photo") }}{% endif %}" alt="User photo">
|
2023-03-16 17:39:28 +00:00
|
|
|
</label>
|
|
|
|
<label
|
|
|
|
class="ui centered photo-placeholder"
|
2023-02-05 17:57:18 +00:00
|
|
|
for="{{ form.photo.id }}"
|
2023-03-16 17:39:28 +00:00
|
|
|
title="{{ _("Click to upload a photo") }}"
|
|
|
|
{% if photo %}style="display: none;"{% endif %}>
|
|
|
|
<i class="massive centered portrait icon"></i>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
<div class="thirteen wide column">
|
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "given_name" in form or "family_name" in form %}
|
2023-03-16 17:39:28 +00:00
|
|
|
<div class="equal width fields">
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "given_name" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block given_name_field scoped %}{{ render_input(form.given_name) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "family_name" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block sn_field scoped %}{{ render_input(form.family_name) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "display_name" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block display_name_field scoped %}{{ render_input(form.display_name) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "photo" in form %}</div></div>{% endif %}
|
2023-03-16 17:39:28 +00:00
|
|
|
|
2023-06-22 13:14:07 +00:00
|
|
|
{% if "emails" in form %}
|
|
|
|
{% block emails_field scoped %}{{ render_input(form.emails) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "phone_number" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block phone_number_field scoped %}{{ render_input(form.phone_number) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "formatted_address" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block formatted_address_field scoped %}{{ render_input(form.formatted_address) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if "street" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block street_field scoped %}{{ render_input(form.street) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="equal width fields">
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "postal_code" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block postal_code_field scoped %}{{ render_input(form.postal_code) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "locality" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block locality_field scoped %}{{ render_input(form.locality) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "region" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block region_field scoped %}{{ render_input(form.region) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="equal width fields">
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "department" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block department_number_field scoped %}{{ render_input(form.department) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "employee_number" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block employee_number_field scoped %}{{ render_input(form.employee_number) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
2023-03-17 16:35:05 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="equal width fields">
|
2023-03-16 17:39:28 +00:00
|
|
|
|
|
|
|
{% if "title" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block title_field scoped %}{{ render_input(form.title) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "organization" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block organization_field scoped %}{{ render_input(form.organization) }}{% endblock %}
|
2023-03-17 16:35:05 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-03-16 17:39:28 +00:00
|
|
|
</div>
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "profile_url" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block profile_url_field scoped %}{{ render_input(form.profile_url) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2023-02-05 17:57:18 +00:00
|
|
|
{% if "preferred_language" in form %}
|
2023-06-19 16:10:14 +00:00
|
|
|
{% block preferred_language_field scoped %}{{ render_input(form.preferred_language) }}{% endblock %}
|
2023-03-16 17:39:28 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="ui right aligned container">
|
|
|
|
<div class="ui stackable buttons">
|
|
|
|
<button type="submit" class="ui right floated primary button" name="action" value="edit" id="edit">
|
2023-04-27 17:26:01 +00:00
|
|
|
{{ _("Edit") }}
|
2023-03-16 17:39:28 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-03-28 21:12:54 +00:00
|
|
|
{% endcall %}
|
2023-03-16 17:39:28 +00:00
|
|
|
</div>
|
|
|
|
{% endblock %}
|