repos.html
135 lines
| 4.0 KiB
| text/html
|
HtmlLexer
r547 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
r619 | ${_('Repositories administration')} - ${c.rhodecode_name} | |||
r547 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
r2664 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> ${h.link_to(_('Admin'),h.url('admin_home'))} » <span id="repo_count">0</span> ${_('repositories')} | |||
r547 | </%def> | |||
<%def name="page_nav()"> | ||||
${self.menu('admin')} | ||||
</%def> | ||||
<%def name="main()"> | ||||
<div class="box"> | ||||
r1779 | ||||
r547 | <div class="title"> | |||
${self.breadcrumbs()} | ||||
<ul class="links"> | ||||
<li> | ||||
r1770 | <span>${h.link_to(_(u'ADD REPOSITORY'),h.url('new_repo'))}</span> | |||
r1888 | </li> | |||
</ul> | ||||
r547 | </div> | |||
r2664 | <div class="table yui-skin-sam" id="repos_list_wrap"></div> | |||
<div id="user-paginator" style="padding: 0px 0px 0px 20px"></div> | ||||
r1888 | ||||
</div> | ||||
r1779 | <script> | |||
r2664 | var url = "${h.url('formatted_users', format='json')}"; | |||
var data = ${c.data|n}; | ||||
var myDataSource = new YAHOO.util.DataSource(data); | ||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | ||||
myDataSource.responseSchema = { | ||||
resultsList: "records", | ||||
fields: [ | ||||
{key:"menu"}, | ||||
{key:"raw_name"}, | ||||
{key:"name"}, | ||||
{key:"desc"}, | ||||
{key:"owner"}, | ||||
{key:"action"}, | ||||
] | ||||
}; | ||||
myDataSource.doBeforeCallback = function(req,raw,res,cb) { | ||||
// This is the filter function | ||||
var data = res.results || [], | ||||
filtered = [], | ||||
i,l; | ||||
if (req) { | ||||
req = req.toLowerCase(); | ||||
for (i = 0; i<data.length; i++) { | ||||
var pos = data[i].raw_name.toLowerCase().indexOf(req) | ||||
if (pos != -1) { | ||||
filtered.push(data[i]); | ||||
} | ||||
} | ||||
res.results = filtered; | ||||
} | ||||
YUD.get('repo_count').innerHTML = res.results.length; | ||||
return res; | ||||
} | ||||
r1888 | ||||
r1779 | // main table sorting | |||
var myColumnDefs = [ | ||||
{key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | ||||
{key:"name",label:"${_('Name')}",sortable:true, | ||||
r2664 | sortOptions: { sortFunction: nameSort }}, | |||
r1779 | {key:"desc",label:"${_('Description')}",sortable:true}, | |||
{key:"owner",label:"${_('Owner')}",sortable:true}, | ||||
{key:"action",label:"${_('Action')}",sortable:false}, | ||||
]; | ||||
r2664 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ | |||
sortedBy:{key:"name",dir:"asc"}, | ||||
paginator: new YAHOO.widget.Paginator({ | ||||
rowsPerPage: 15, | ||||
alwaysVisible: false, | ||||
template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", | ||||
pageLinks: 5, | ||||
containerClass: 'pagination-wh', | ||||
currentPageClass: 'pager_curpage', | ||||
pageLinkClass: 'pager_link', | ||||
nextPageLinkLabel: '>', | ||||
previousPageLinkLabel: '<', | ||||
firstPageLinkLabel: '<<', | ||||
lastPageLinkLabel: '>>', | ||||
containers:['user-paginator'] | ||||
}), | ||||
r1888 | ||||
r2664 | MSG_SORTASC:"${_('Click to sort ascending')}", | |||
MSG_SORTDESC:"${_('Click to sort descending')}", | ||||
MSG_EMPTY:"${_('No records found.')}", | ||||
MSG_ERROR:"${_('Data error.')}", | ||||
MSG_LOADING:"${_('Loading...')}", | ||||
} | ||||
r1779 | ); | |||
myDataTable.subscribe('postRenderEvent',function(oArgs) { | ||||
tooltip_activate(); | ||||
quick_repo_menu(); | ||||
r1888 | }); | |||
r2664 | ||||
var filterTimeout = null; | ||||
updateFilter = function () { | ||||
// Reset timeout | ||||
filterTimeout = null; | ||||
// Reset sort | ||||
var state = myDataTable.getState(); | ||||
state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | ||||
// Get filtered data | ||||
myDataSource.sendRequest(YUD.get('q_filter').value,{ | ||||
success : myDataTable.onDataReturnInitializeTable, | ||||
failure : myDataTable.onDataReturnInitializeTable, | ||||
scope : myDataTable, | ||||
argument: state | ||||
}); | ||||
}; | ||||
YUE.on('q_filter','click',function(){ | ||||
YUD.get('q_filter').value = ''; | ||||
}); | ||||
YUE.on('q_filter','keyup',function (e) { | ||||
clearTimeout(filterTimeout); | ||||
filterTimeout = setTimeout(updateFilter,600); | ||||
}); | ||||
r1888 | </script> | |||
r2664 | ||||
r1888 | </%def> | |||