{% extends "sysadmin/base.html" %}
{% load seahub_tags i18n staticfiles %}

{% block cur_repo %}tab-cur{% endblock %}

{% block extra_style %}
<link rel="stylesheet" type="text/css" href="{% static "css/select2-3.5.2.css" %}" />
<link rel="stylesheet" type="text/css" href="{% static "css/select2.custom.css" %}" />
{% endblock %}

{% block right_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" src="{% static "scripts/lib/select2-3.5.2.js" %}"></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 %}
