Download files

This commit is contained in:
Kyle Drake 2013-06-10 11:50:32 -07:00
parent 8b57348bdd
commit 9ed826486d
2 changed files with 8 additions and 1 deletions

4
app.rb
View file

@ -148,6 +148,10 @@ post '/site_files/delete' do
redirect '/dashboard'
end
get '/site_files/download/:filename' do |filename|
send_file File.join(site_base_path(current_site.username), filename), filename: filename, type: 'Application/octet-stream'
end
get '/site_files/text_editor/:filename' do |filename|
@file_data = File.read File.join(site_base_path(current_site.username), filename)
slim :'site_files/text_editor'

View file

@ -34,7 +34,10 @@ javascript:
a href="/site_files/text_editor/#{file.filename}" Edit with text editor <br>
span
i class="icon-edit" &nbsp;&nbsp;
span Edit with visual editor <small>(not implemented yet.. coming soon)</small> <br>
span Edit with visual editor <small>(coming soon)</small> <br>
span
i class="icon-edit" &nbsp;&nbsp;
span: a href="/site_files/download/#{file.filename}" Download <br>
span
i class="icon-trash" &nbsp;&nbsp;
a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete