68 lines
2.3 KiB
Plaintext
68 lines
2.3 KiB
Plaintext
// Store DMSF controls
|
|
var dmsfButtons = $('#dmsf_buttons')[0].outerHTML;
|
|
var browserInfo = $('#browser_info').text();
|
|
var dmsfTag;
|
|
|
|
if(($('#dmsf_tag') != null) && $('#dmsf_tag')[0] != null) {
|
|
|
|
dmsfTag = $('#dmsf_tag')[0].outerHTML
|
|
}
|
|
|
|
// Destroy the original dataTable
|
|
$("#browser").dataTable().fnDestroy();
|
|
|
|
// Add rows
|
|
$('#<%= params[:row_id] %>').after('<%= escape_javascript(render(:partial => 'dmsf/dmsf_rows')) %>');
|
|
|
|
// Reinitialize the dataTable
|
|
<% title = DmsfFolder.get_column_position('title') %>
|
|
<% position = DmsfFolder.get_column_position('position') %>
|
|
<% commands = DmsfFolder.get_column_position('commands') %>
|
|
<% position = DmsfFolder.get_column_position('position') %>
|
|
<% version = DmsfFolder.get_column_position('version') %>
|
|
<% size_calculated = DmsfFolder.get_column_position('size_calculated') %>
|
|
<% modified_calculated = DmsfFolder.get_column_position('modified_calculated') %>
|
|
<% version_calculated = DmsfFolder.get_column_position('version_calculated') %>
|
|
<% size = DmsfFolder.get_column_position('size') %>
|
|
<% modified = DmsfFolder.get_column_position('modified') %>
|
|
|
|
$('#browser').dataTable({
|
|
'bJQueryUI': true,
|
|
'oLanguage': {
|
|
'sUrl': "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>"
|
|
},
|
|
'bAutoWidth': false,
|
|
'bPaginate': false,
|
|
<% if title %>
|
|
'aaSorting': [[<%= title %>, 'asc']],
|
|
<% end %>
|
|
'aaSortingFixed': [[ <%= position %>, 'asc']],
|
|
'aoColumnDefs': [
|
|
{ 'bSearchable': false, 'aTargets': [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
|
|
{ 'bSortable': false, 'aTargets': [0, <%= commands %>] }
|
|
<% if size %>
|
|
,{ 'iDataSort': <%= size_calculated %>, 'aTargets': [ <%= size %> ] }
|
|
<% end %>
|
|
<% if modified %>
|
|
,{ 'iDataSort': <%= modified_calculated %>, 'aTargets': [ <%= modified %> ] }
|
|
<% end %>
|
|
<% if version %>
|
|
,{ 'iDataSort': <%= version_calculated %>, 'aTargets': [ <%= version %> ] }
|
|
<% end %>
|
|
],
|
|
'fnInitComplete': function() {
|
|
$(dmsfButtons).prependTo($('#browser_wrapper div.fg-toolbar')[0]);
|
|
|
|
if($(dmsfTag) != null) {
|
|
|
|
$(dmsfTag).prependTo($('#browser_wrapper div.fg-toolbar')[0]);
|
|
}
|
|
},
|
|
'fnInfoCallback': function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
|
|
return browserInfo;
|
|
}
|
|
});
|
|
|
|
// Hot fix
|
|
$('#browser').attr('style', 'width: 100%');
|