69 lines
2.3 KiB
Plaintext
69 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')) %>');
|
|
hideOnLoad();
|
|
|
|
// 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({
|
|
responsive: {
|
|
details: false
|
|
},
|
|
language: {
|
|
url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>"
|
|
},
|
|
autoWidth: false,
|
|
paginate: false,
|
|
<% if title %>
|
|
order: [[<%= title %>, "asc"]],
|
|
<% end %>
|
|
sortingFixed: [[ <%= position %>, "asc"]],
|
|
columnDefs: [
|
|
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
|
|
{ sortable: false, targets: [0, <%= commands %>] }
|
|
<% if size %>
|
|
,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] }
|
|
<% end %>
|
|
<% if modified %>
|
|
,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] }
|
|
<% end %>
|
|
<% if version %>
|
|
,{ iDataSort: <%= version_calculated %>, targets: [ <%= 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%');
|