{% extends "preferences/_base.html" %}

{% from "macros/box.html" import m_box_content %}
{% from "macros/form.html" import m_field %}

{% block content %}
  {% call m_box_content(title) %}

  <form id="user-preferences" method="post" action="{{ url_for("preferences.user") }}" role="form" enctype="multipart/form-data">
    {{ csrf.field() }}
    {% for field in form %}
      {{ m_field(field) }}
    {% endfor %}

    <button type="submit" class="btn btn-primary" name="_action" value="add">
      {{ _("Save") }}
    </button>
    <button type="submit" class="btn cancel" name="_action" value="cancel">
      {{ _("Cancel") }}
    </button>
  </form>

{%- deferJS %}
  <script type="text/javascript">
   Abilian.fn.onAppInit(function() {
     $('#user-preferences input[type="password"]').preventEnterKey();
   });
  </script>
{%- enddeferJS %}

  {% endcall %}
{% endblock %}
