index_base.mako
231 lines
| 7.5 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | <%inherit file="/base/base.mako"/> | |||
r3442 | ||||
<%def name="menu_bar_subnav()"> | ||||
% if c.repo_group: | ||||
${self.repo_group_menu(active='home')} | ||||
% endif | ||||
</%def> | ||||
r1282 | <%def name="main()"> | |||
<div class="box"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
</div> | ||||
r4185 | ||||
r1282 | <!-- end box / title --> | |||
r4148 | <div id="no_grid_data" class="table" style="display: none"> | |||
r4185 | <h2> | |||
r2447 | ${_('No repositories or repositories groups exists here.')} | |||
</h2> | ||||
</div> | ||||
r4148 | ||||
r4185 | <div id="grid_data_loading" class="table" style="display: none"> | |||
<i class="icon-spin animate-spin"></i> | ||||
${_('loading...')} | ||||
</div> | ||||
r4148 | <div class="table"> | |||
r4185 | <div id="groups_list_wrap" style="min-height: 200px;display: none"> | |||
r4148 | <table id="group_list_table" class="display" style="width: 100%;"></table> | |||
</div> | ||||
</div> | ||||
<div class="table"> | ||||
r4185 | <div id="repos_list_wrap" style="min-height: 200px;display: none"> | |||
r4148 | <table id="repo_list_table" class="display" style="width: 100%;"></table> | |||
</div> | ||||
</div> | ||||
r2447 | ||||
r1282 | </div> | |||
r4185 | ||||
r1282 | <script> | |||
r4148 | $(document).ready(function () { | |||
r4185 | var noRepoData = null; | |||
var noGroupData = null; | ||||
var $gridDataLoading = $('#grid_data_loading'); | ||||
r1282 | ||||
r4185 | // global show loading of hidden grids | |||
$(document).on('preInit.dt', function (e, settings) { | ||||
$gridDataLoading.show(); | ||||
}); | ||||
## repo group list | ||||
r4148 | var $groupListTable = $('#group_list_table'); | |||
r4185 | $groupListTable.on('xhr.dt', function (e, settings, json, xhr) { | |||
$gridDataLoading.hide(); | ||||
}); | ||||
r4148 | $groupListTable.DataTable({ | |||
processing: true, | ||||
serverSide: true, | ||||
ajax: { | ||||
"url": "${h.route_path('main_page_repo_groups_data')}", | ||||
"data": function (d) { | ||||
% if c.repo_group: | ||||
d.repo_group_id = ${c.repo_group.group_id} | ||||
% endif | ||||
} | ||||
}, | ||||
dom: 'rtp', | ||||
pageLength: ${c.visual.dashboard_items}, | ||||
order: [[0, "asc"]], | ||||
columns: [ | ||||
{ | ||||
data: { | ||||
"_": "name", | ||||
r4150 | "sort": "name" | |||
r4148 | }, title: "${_('Name')}", className: "truncate-wrap td-grid-name" | |||
}, | ||||
r4150 | { | |||
data: 'menu', "bSortable": false, className: "quick_repo_menu" | ||||
}, | ||||
r4148 | { | |||
data: { | ||||
"_": "desc", | ||||
"sort": "desc" | ||||
}, title: "${_('Description')}", className: "td-description" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "last_change", | ||||
r4150 | "sort": "last_change", | |||
r4148 | "type": Number | |||
}, title: "${_('Last Change')}", className: "td-time" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "last_changeset", | ||||
"sort": "last_changeset_raw", | ||||
"type": Number | ||||
r4150 | }, title: "", className: "td-hash", orderable: false | |||
r4148 | }, | |||
{ | ||||
data: { | ||||
"_": "owner", | ||||
"sort": "owner" | ||||
}, title: "${_('Owner')}", className: "td-user" | ||||
} | ||||
], | ||||
language: { | ||||
paginate: DEFAULT_GRID_PAGINATION, | ||||
sProcessing: _gettext('loading...'), | ||||
emptyTable: _gettext("No repository groups present.") | ||||
}, | ||||
"drawCallback": function (settings, json) { | ||||
r4185 | ||||
r4148 | // hide grid if it's empty | |||
if (settings.fnRecordsDisplay() === 0) { | ||||
r4185 | noGroupData = true; | |||
r4148 | // both hidden, show no-data | |||
r4185 | if (noRepoData === true) { | |||
r4148 | $('#no_grid_data').show(); | |||
} | ||||
} else { | ||||
$('#groups_list_wrap').show(); | ||||
} | ||||
timeagoActivate(); | ||||
tooltipActivate(); | ||||
quick_repo_menu(); | ||||
// hide pagination for single page | ||||
if (settings._iDisplayLength >= settings.fnRecordsDisplay()) { | ||||
$(settings.nTableWrapper).find('.dataTables_paginate').hide(); | ||||
} | ||||
}, | ||||
r1282 | }); | |||
r4148 | ||||
r4185 | ## repo list | |||
r4148 | var $repoListTable = $('#repo_list_table'); | |||
r4185 | $repoListTable.on('xhr.dt', function (e, settings, json, xhr) { | |||
$gridDataLoading.hide(); | ||||
}); | ||||
r4148 | $repoListTable.DataTable({ | |||
processing: true, | ||||
serverSide: true, | ||||
ajax: { | ||||
"url": "${h.route_path('main_page_repos_data')}", | ||||
"data": function (d) { | ||||
% if c.repo_group: | ||||
d.repo_group_id = ${c.repo_group.group_id} | ||||
% endif | ||||
} | ||||
}, | ||||
order: [[0, "asc"]], | ||||
dom: 'rtp', | ||||
pageLength: ${c.visual.dashboard_items}, | ||||
columns: [ | ||||
{ | ||||
data: { | ||||
"_": "name", | ||||
r4150 | "sort": "name" | |||
r4148 | }, title: "${_('Name')}", className: "truncate-wrap td-grid-name" | |||
}, | ||||
{ | ||||
data: 'menu', "bSortable": false, className: "quick_repo_menu" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "desc", | ||||
"sort": "desc" | ||||
}, title: "${_('Description')}", className: "td-description" | ||||
}, | ||||
{ | ||||
data: { | ||||
"_": "last_change", | ||||
r4150 | "sort": "last_change", | |||
r4148 | "type": Number | |||
r4150 | }, title: "${_('Last Change')}", className: "td-time" | |||
r4148 | }, | |||
{ | ||||
data: { | ||||
"_": "last_changeset", | ||||
"sort": "last_changeset_raw", | ||||
"type": Number | ||||
r4150 | }, title: "${_('Commit')}", className: "td-hash", orderable: false | |||
r4148 | }, | |||
{ | ||||
data: { | ||||
"_": "owner", | ||||
"sort": "owner" | ||||
}, title: "${_('Owner')}", className: "td-user" | ||||
} | ||||
], | ||||
language: { | ||||
paginate: DEFAULT_GRID_PAGINATION, | ||||
sProcessing: _gettext('loading...'), | ||||
emptyTable: _gettext("No repositories present.") | ||||
}, | ||||
"drawCallback": function (settings, json) { | ||||
r4185 | ||||
r4148 | // hide grid if it's empty | |||
if (settings.fnRecordsDisplay() == 0) { | ||||
r4185 | noRepoData = true; | |||
r4148 | // both hidden, show no-data | |||
r4185 | if (noGroupData === true) { | |||
r4148 | $('#no_grid_data').show() | |||
} | ||||
} else { | ||||
$('#repos_list_wrap').show() | ||||
} | ||||
timeagoActivate(); | ||||
tooltipActivate(); | ||||
quick_repo_menu(); | ||||
// hide pagination for single page | ||||
if (settings._iDisplayLength >= settings.fnRecordsDisplay()) { | ||||
$(settings.nTableWrapper).find('.dataTables_paginate').hide(); | ||||
} | ||||
}, | ||||
r1282 | }); | |||
r4148 | ||||
}); | ||||
r1282 | </script> | |||
</%def> | ||||