{# -*- coding: utf-8 -*-

  This file is part of Invenio.
  Copyright (C) 2015-2018 CERN.

  Invenio is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.USERPROFILES_SETTINGS_TEMPLATE %}

{% from "invenio_userprofiles/settings/_macros.html" import render_field, form_errors %}

{% set panel_title = _("Profile") %}
{% set panel_icon = "fa fa-user" %}

{%- block settings_form %}
{%- if security.confirmable and not current_user.confirmed_at %}
<form method="POST" role="form">
{{ verification_form.csrf_token }}
<div class="alert alert-warning">
  {{ _("You have not yet verified your email address.") }} {{ verification_form.send_verification_email(class_="btn btn-default btn-xs") }}
</div>
<input type="hidden" name="submit" value="verification" />
</form>
{%- endif %}
{%- set form = profile_form %}
<form method="POST" name="profile_form">
{%- for field in form %}
{%- if field.widget.input_type == 'hidden' %}
{{ field() }}
{%- else %}
{{ render_field(field, autofocus=True, placeholder=field.label.text) }}
{%- endif %}
{%- endfor %}
<div class="form-actions">
  <a href="." class="btn btn-default"><i class="fa fa-times"></i> {{ _('Cancel') }}</a>
  <button type="submit" name="submit" value="profile" class="btn btn-primary"><i class="fa fa-check"></i> {{ _('Update profile') }}</button>
</div>
</form>
{%- endblock settings_form %}
