repos.mako
148 lines
| 4.1 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | <%inherit file="/base/base.mako"/> | |||
<%def name="title()"> | ||||
${_('Repositories administration')} | ||||
%if c.rhodecode_name: | ||||
· ${h.branding(c.rhodecode_name)} | ||||
%endif | ||||
</%def> | ||||
r3589 | <%def name="breadcrumbs_links()"></%def> | |||
r1282 | ||||
<%def name="menu_bar_nav()"> | ||||
${self.menu_items(active='admin')} | ||||
</%def> | ||||
r3566 | <%def name="menu_bar_subnav()"> | |||
${self.admin_menu(active='repositories')} | ||||
</%def> | ||||
r1282 | <%def name="main()"> | |||
<div class="box"> | ||||
r3589 | ||||
r1282 | <div class="title"> | |||
r3589 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | |||
r4146 | <span id="repo_count"></span> | |||
r3589 | ||||
r1282 | <ul class="links"> | |||
r3589 | %if c.can_create_repo: | |||
<li> | ||||
r5137 | <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success">${_('Add Repository')}</a> | |||
r3589 | </li> | |||
%endif | ||||
r1282 | </ul> | |||
</div> | ||||
<div id="repos_list_wrap"> | ||||
<table id="repo_list_table" class="display"></table> | ||||
</div> | ||||
r4146 | ||||
r1282 | </div> | |||
<script> | ||||
$(document).ready(function() { | ||||
r4146 | var $repoListTable = $('#repo_list_table'); | |||
r1282 | ||||
// repo list | ||||
r4146 | $repoListTable.DataTable({ | |||
processing: true, | ||||
serverSide: true, | ||||
ajax: { | ||||
"url": "${h.route_path('repos_data')}", | ||||
"dataSrc": function (json) { | ||||
var filteredCount = json.recordsFiltered; | ||||
var total = json.recordsTotal; | ||||
var _text = _gettext( | ||||
"{0} of {1} repositories").format( | ||||
filteredCount, total); | ||||
if (total === filteredCount) { | ||||
_text = _gettext("{0} repositories").format(total); | ||||
} | ||||
$('#repo_count').text(_text); | ||||
return json.data; | ||||
}, | ||||
}, | ||||
dom: 'rtp', | ||||
pageLength: ${c.visual.admin_grid_items}, | ||||
order: [[ 0, "asc" ]], | ||||
columns: [ | ||||
{ | ||||
data: { | ||||
"_": "name", | ||||
r4150 | "sort": "name" | |||
r4146 | }, title: "${_('Name')}", className: "td-componentname" | |||
}, | ||||
{ | ||||
data: 'menu', "bSortable": false, className: "quick_repo_menu"}, | ||||
{ | ||||
data: { | ||||
"_": "desc", | ||||
"sort": "desc" | ||||
}, title: "${_('Description')}", className: "td-description" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "last_change", | ||||
r4150 | "sort": "last_change", | |||
r4146 | "type": Number | |||
}, title: "${_('Last Change')}", className: "td-time" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "last_changeset", | ||||
"sort": "last_changeset_raw", | ||||
"type": Number | ||||
}, title: "${_('Commit')}", className: "td-commit", orderable: false | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "owner", | ||||
"sort": "owner" | ||||
}, title: "${_('Owner')}", className: "td-user" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "state", | ||||
"sort": "state" | ||||
}, title: "${_('State')}", className: "td-tags td-state" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "action", | ||||
"sort": "action" | ||||
}, title: "${_('Action')}", className: "td-action", orderable: false | ||||
} | ||||
], | ||||
language: { | ||||
r1282 | paginate: DEFAULT_GRID_PAGINATION, | |||
r4146 | sProcessing: _gettext('loading...'), | |||
emptyTable:_gettext("No repositories present.") | ||||
}, | ||||
"initComplete": function( settings, json ) { | ||||
quick_repo_menu(); | ||||
} | ||||
r1282 | }); | |||
r4146 | $repoListTable.on('xhr.dt', function(e, settings, json, xhr){ | |||
$repoListTable.css('opacity', 1); | ||||
}); | ||||
$repoListTable.on('preXhr.dt', function(e, settings, data){ | ||||
$repoListTable.css('opacity', 0.3); | ||||
r1282 | }); | |||
r4146 | $('#q_filter').on('keyup', | |||
$.debounce(250, function() { | ||||
$repoListTable.DataTable().search( | ||||
$('#q_filter').val() | ||||
).draw(); | ||||
}) | ||||
); | ||||
r1282 | ||||
}); | ||||
</script> | ||||
</%def> | ||||