bookmarks.mako
119 lines
| 3.6 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | <%inherit file="/base/base.mako"/> | |||
r4977 | <%namespace name="components" file="/summary/components.mako"/> | |||
r1282 | ||||
<%def name="title()"> | ||||
r4977 | ${_('{} Bookmarks').format(c.repo_name)} | |||
r1282 | %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='repositories')} | ||||
</%def> | ||||
<%def name="menu_bar_subnav()"> | ||||
${self.repo_menu(active='summary')} | ||||
</%def> | ||||
<%def name="main()"> | ||||
r4977 | <div id="repo-summary" class="summary"> | |||
${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)} | ||||
</div> | ||||
r1282 | <div class="box"> | |||
<div class="title"> | ||||
r3568 | ||||
r1282 | %if c.has_references: | |||
<ul class="links"> | ||||
<li> | ||||
<input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Bookmarks')}"> | ||||
</li> | ||||
</ul> | ||||
%endif | ||||
%if c.has_references: | ||||
r4511 | <div class="grid-quick-filter"> | |||
<ul class="grid-filter-box"> | ||||
<li class="grid-filter-box-icon"> | ||||
<i class="icon-search"></i> | ||||
</li> | ||||
<li class="grid-filter-box-input"> | ||||
<input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | ||||
</li> | ||||
</ul> | ||||
</div> | ||||
<div id="obj_count">0</div> | ||||
r1282 | %endif | |||
</div> | ||||
r4511 | ||||
<table id="obj_list_table" class="rctable table-bordered"></table> | ||||
r1282 | </div> | |||
<script type="text/javascript"> | ||||
$(document).ready(function() { | ||||
var get_datatable_count = function(){ | ||||
var api = $('#obj_list_table').dataTable().api(); | ||||
r4511 | var total = api.page.info().recordsDisplay | |||
var _text = _ngettext('{0} bookmark', '{0} bookmarks', total).format(total); | ||||
$('#obj_count').text(_text); | ||||
r1282 | }; | |||
r5039 | var bookmarks_data = ${c.data|n}; | |||
r1282 | // object list | |||
$('#obj_list_table').DataTable({ | ||||
r5039 | data: bookmarks_data, | |||
r1282 | dom: 'rtp', | |||
pageLength: ${c.visual.dashboard_items}, | ||||
order: [[ 0, "asc" ]], | ||||
columns: [ | ||||
{ data: {"_": "name", | ||||
"sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" }, | ||||
{ data: {"_": "date", | ||||
"sort": "date_raw"}, title: "${_('Date')}", className: "td-time" }, | ||||
{ data: {"_": "author", | ||||
"sort": "author"}, title: "${_('Author')}", className: "td-user" }, | ||||
{ data: {"_": "commit", | ||||
"sort": "commit_raw", | ||||
"type": Number}, title: "${_('Commit')}", className: "td-hash" }, | ||||
{ data: {"_": "compare", | ||||
"sort": "compare"}, title: "${_('Compare')}", className: "td-compare" } | ||||
], | ||||
language: { | ||||
paginate: DEFAULT_GRID_PAGINATION, | ||||
emptyTable: _gettext("No bookmarks available yet.") | ||||
}, | ||||
"initComplete": function(settings, json) { | ||||
get_datatable_count(); | ||||
timeagoActivate(); | ||||
r4026 | tooltipActivate(); | |||
r1282 | compare_radio_buttons("${c.repo_name}", 'book'); | |||
} | ||||
}); | ||||
// update when things change | ||||
$('#obj_list_table').on('draw.dt', function() { | ||||
get_datatable_count(); | ||||
timeagoActivate(); | ||||
r4026 | tooltipActivate(); | |||
r1282 | }); | |||
// filter, filter both grids | ||||
$('#q_filter').on('keyup', function() { | ||||
var obj_api = $('#obj_list_table').dataTable().api(); | ||||
obj_api | ||||
.columns(0) | ||||
.search(this.value) | ||||
.draw(); | ||||
}); | ||||
// refilter table if page load via back button | ||||
$("#q_filter").trigger('keyup'); | ||||
}); | ||||
</script> | ||||
</%def> | ||||