* finished Issue 88: D&D download

git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@199 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
vit.jonas@gmail.com 2011-07-08 07:30:53 +00:00
parent 68f606710f
commit f59cd50c4d

View File

@ -104,10 +104,12 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<tr class="file">
<td class="check"><%= check_box_tag("files[]", file.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => "show", :id => file, :download => ""}) %>
<%= link_to(h(file.last_revision.display_title),
{:controller => :dmsf_files, :action => "show", :id => file, :download => ""},
file_download_url,
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
:title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version)) %>
:title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version),
"data-downloadurl" => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(file.display_name) %></div>
</td>
<td class="size"><%= number_to_human_size(file.last_revision.size) %></td>
@ -244,6 +246,17 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>";
}
});
jQuery("[data-downloadurl]").each(function() {
var url = this.getAttribute("data-downloadurl");
if (this.addEventListener) {
this.addEventListener("dragstart", function(e) {
if (e.dataTransfer) {
e.dataTransfer.setData("DownloadURL", url);
}
},false);
}
});
});
</script>
<% end %>