{% extends "admin_base.html" %}
{% load seahub_tags i18n %}

{% block main_panel %}
<h3>{% trans "Search Library"%}</h3>

<form id="search-repo-form" method="get" action=".">
    <p class="tip">{% trans "Tip: you can search by keyword in name or owner or both." %}</p>
    <label>{% trans "Name" %}</label><input type="text" name="name" class="input" value="{{name}}"/><br />
    <label>{% trans "Owner" %}</label><input type="text" name="owner" class="input" value="{{owner}}"/><br />
    <input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>

<h3>{% trans "Result"%}</h3>
{% if repos %}
{% include "sysadmin/repoadmin_table.html" %}
{% else %}
<p>{% trans "No result" %}</p>
{% endif %}

{% include "sysadmin/repo_transfer_form.html" %}
{% endblock %}

{% block extra_script %}
<script type="text/javascript">
$('#search-repo-form').submit(function() {
    var form = $(this),
        name = $.trim($('[name="name"]', form).val()),
        owner = $.trim($('[name="owner"]', form).val());

    if (!name && !owner) {
        return false;
    }
});
{% include "sysadmin/repoadmin_js.html" %}
</script>
{% endblock %}
