{# .. screenshot:: |canaille|/profile/user :context: user :align: right :width: 275px The user profile edition page. The profile edition template. Displays a user profile edition form. :param edited_user: The user that the form will edit. :type edited_user: :class:`~canaille.core.models.User` :param profile_form: The user profile edition form. Dynamically built according to the user :attr:`~canaille.core.configuration.ACLSettings.READ` and :attr:`~canaille.core.configuration.ACLSettings.WRITE` permissions. The available fields are those appearing in *READ* and *WRITE*, those only appearing in *READ* are read-only. :type profile_form: :class:`~flask_wtf.FlaskForm` :param emails_form: An email edition form. Used when the :attr:`~canaille.app.features.Features.has_email_confirmation` feature is enabled. :type emails_form: :class:`~canaille.core.endpoints.forms.EmailConfirmationForm` #} {% extends theme('base.html') %} {% import 'macro/form.html' as fui %} {%- block title -%} {% if not edited_user %} {%- trans %}User creation{% endtrans -%} {% elif user.user_name == edited_user.user_name %} {%- trans %}My profile{% endtrans -%} {% else %} {%- trans %}User profile edition{% endtrans -%} {% endif %} {%- endblock -%} {% block script %} {% endblock %} {% block submenu %} {% trans %}Personal information{% endtrans %} {% trans %}Account settings{% endtrans %} {% trans %}Authentication{% endtrans %} {% endblock %} {% block content %}

{% if user.user_name == edited_user.user_name %} {% trans %}My profile{% endtrans %} {% else %} {% trans %}User profile edition{% endtrans %} {% endif %}
{% if user.user_name == edited_user.user_name %} {% trans %}Edit your personal information{% endtrans %} {% else %} {% trans %}Edit information about a user{% endtrans %} {% endif %}

{% call fui.render_form(profile_form) %} {% if "photo" in profile_form %}
{% block photo_field scoped %} {{ profile_form.photo() }} {{ profile_form.photo_delete() }} {% set photo = edited_user.photo and edited_user.photo %}
{% endblock %}
{% endif %} {% if "given_name" in profile_form or "family_name" in profile_form %}
{% if "given_name" in profile_form %} {% block given_name_field scoped %}{{ profile_form.given_name() }}{% endblock %} {% endif %} {% if "family_name" in profile_form %} {% block sn_field scoped %}{{ profile_form.family_name() }}{% endblock %} {% endif %}
{% endif %} {% if "display_name" in profile_form %} {% block display_name_field scoped %}{{ profile_form.display_name() }}{% endblock %} {% endif %} {% if "photo" in profile_form %}
{% endif %} {% if "emails" in profile_form and not emails_form %} {% block emails_field scoped %}{{ profile_form.emails() }}{% endblock %} {% endif %} {% if "phone_numbers" in profile_form %} {% block phone_numbers_field scoped %}{{ profile_form.phone_numbers() }}{% endblock %} {% endif %} {% if "formatted_address" in profile_form %} {% block formatted_address_field scoped %}{{ profile_form.formatted_address() }}{% endblock %} {% endif %} {% if "street" in profile_form %} {% block street_field scoped %}{{ profile_form.street() }}{% endblock %} {% endif %}
{% if "postal_code" in profile_form %} {% block postal_code_field scoped %}{{ profile_form.postal_code() }}{% endblock %} {% endif %} {% if "locality" in profile_form %} {% block locality_field scoped %}{{ profile_form.locality() }}{% endblock %} {% endif %} {% if "region" in profile_form %} {% block region_field scoped %}{{ profile_form.region() }}{% endblock %} {% endif %}
{% if "department" in profile_form %} {% block department_number_field scoped %}{{ profile_form.department() }}{% endblock %} {% endif %} {% if "employee_number" in profile_form %} {% block employee_number_field scoped %}{{ profile_form.employee_number() }}{% endblock %} {% endif %}
{% if "title" in profile_form %} {% block title_field scoped %}{{ profile_form.title() }}{% endblock %} {% endif %} {% if "organization" in profile_form %} {% block organization_field scoped %}{{ profile_form.organization() }}{% endblock %} {% endif %}
{% if "profile_url" in profile_form %} {% block profile_url_field scoped %}{{ profile_form.profile_url() }}{% endblock %} {% endif %} {% if "preferred_language" in profile_form %} {% block preferred_language_field scoped %}{{ profile_form.preferred_language() }}{% endblock %} {% endif %}
{% call fui.render_button(profile_form.action, "edit-profile", class_="ui right floated primary button", id="edit-profile") %} {{ _("Edit") }} {% endcall %}
{% endcall %} {% if emails_form %}

{% if user.user_name == edited_user.user_name %} {% trans %}My email addresses{% endtrans %} {% else %} {% trans %}Email addresses{% endtrans %} {% endif %}

{% call fui.render_form(emails_form) %}
{{ emails_form.old_emails.label() }} {% for field in emails_form.old_emails %}
{{ field(bare=True, readonly=True) }} {% if field.description %} {% endif %} {% if emails_form.old_emails|len > 1 %} {% call fui.render_button(emails_form.email_remove, field.data, class_="ui teal icon button", title=_("Remove this email address"), formnovalidate=True) %} {% endcall %} {% endif %}
{% endfor %}
{% if emails_form.add_email_button %} {{ emails_form.new_email() }} {% endif %} {% endcall %} {% endif %}
{% endblock %}