## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>

<%block name="title">
    ${_('Repositories Administration')}
</%block>

<%def name="breadcrumbs_links()">
    <span id="repo_count">0</span> ${_('Repositories')}
</%def>
<%block name="header_menu">
    ${self.menu('admin')}
</%block>
<%def name="main()">
<div class="panel panel-primary">

    <div class="panel-heading clearfix">
        <div class="pull-left">
            ${self.breadcrumbs()}
        </div>
        <div class="pull-right">
         %if h.HasPermissionAny('hg.admin','hg.create.repository')():
            <a href="${h.url('new_repo')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Add Repository')}</a>
         %endif
        </div>
    </div>
    <div class="panel-body">
        <table class="table" id="datatable_list_wrap" width="100%"></table>
    </div>

</div>
<script>'use strict';
  var data = ${h.js(c.data)};
  $("#datatable_list_wrap").DataTable({
        data: data.records,
        columns: [
            {data: "raw_name", visible: false, searchable: false},
            {data: "name", orderData: 1, title: ${h.jshtml(_('Name'))}},
            {data: "desc", title: ${h.jshtml(_('Description'))}, searchable: false},
            {data: "last_rev_raw", visible: false, searchable: false},
            {data: "last_changeset", orderData: 4, title: ${h.jshtml(_('Tip'))}, searchable: false},
            {data: "owner", title: ${h.jshtml(_('Owner'))}, searchable: false},
            {data: "state", title: ${h.jshtml(_('State'))}, searchable: false},
            {data: "action", title: ${h.jshtml(_('Action'))}, sortable: false, searchable: false}
        ],
        drawCallback: updateRowCountCallback($("#repo_count")),
        dom: '<"dataTables_left"f><"dataTables_right"ip>t',
        pageLength: 100
    });
</script>

</%def>
