Blob Blame History Raw
{% extends "master.html" %}
{% from "_formhelper.html" import render_field_in_cell %}

{% block title %}{{ user.user }}'s settings{% endblock %}
{%block tag %}users{% endblock %}

{% block header %}
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"
  rel="stylesheet">
{% endblock %}

{% macro render_email(email, form) %}
<td>
  {{ email.email }}
  <form class="icon del_icon" method="POST"
    action="{{ url_for('remove_user_email') }}">
    <input type="hidden" value="{{ email.email }}" name="email" />
    {{ form.csrf_token }}
    <button
      onclick="return confirm('Do you really want to remove the email: {{ email.email }}?');"
      title="Remove email">
      <span class="icon icon-trash blue"></span>
    </button>
  </form>
</td>
{% endmacro %}


{% block content %}
<section class="user_settings">
    <header>
        <h2>{{ user.user }}'s settings</h2>
    </header>
    <table>
      <tr>
        <th>Full name</th>
        <td> {{ user.fullname }} </td>
      </tr>
      <tr>
        <th>Emails</th>
        {% for email in user.emails %}
          {{ render_email(email, form) }}
      </tr>
      <tr>
        <td></td>
        {% endfor %}
      </tr>
      <tr>
        <th>Emails pending</th>
        {% for email in user.emails_pending %}
          <td>{{ email.email }}</td>
      </tr>
      <tr>
        <td></td>
        {% endfor %}
      </tr>
    </table>

    <form action="{{ url_for('user_settings') }}" method="post">
    <table>
      <tr>
          {{ render_field_in_cell(form.ssh_key) }}
      </tr>
    </table>
    </table>
    <p class="buttons indent">
      <input type="submit" class="submit positive button" value="Update">
      <input type="button" value="Cancel" class="button" onclick="history.back();">
      {{ form.csrf_token }}
    </p>
    </form>

    <aside>
        <div id="profile_button">
            <a href="{{ url_for('view_user', username=user.user) }}">Public profile page</a>
        </div>
    </aside>

</section>
{% endblock %}