Blob Blame Raw
{% extends "repo_master.html" %}
{% from "_formhelper.html" import render_field_in_row %}

{% block title %}Add user - {{ repo.name }}{% endblock %}
{%block tag %}home{% endblock %}


{% block repo %}

<h2>Add user</h2>

<section class="new_user">
    <form action="{{ url_for('.add_user',
                     username=username, repo=repo.name) }}" method="post">

    <table>
      {{ render_field_in_row(form.user) }}
    </table>
    <p class="buttons indent">
      <input type="submit" class="submit positive button" value="Add">
      <input type="button" value="Cancel" class="button" onclick="history.back();">
      {{ form.csrf_token }}
    </p>
  </form>
</section>

{% endblock %}

{% block jscripts %}
{{ super() }}
<script type="text/javascript">
  $(function() {
    $('#user').autocomplete({
        source: function( request, response ) {
            $.getJSON(
              "{{ url_for('api_ns.api_users') }}", {
                pattern: request.term
              },
              function( data ) {
                response( data.users );
              }
            );
        },
        minLength: 2,
        delay: 500,
    });
  });
</script>
{% endblock %}