From 9ed826486d6fe2f880c998abd75b5316a6a6a886 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Mon, 10 Jun 2013 11:50:32 -0700 Subject: [PATCH] Download files --- app.rb | 4 ++++ views/dashboard.slim | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index de69ad22..d8079886 100644 --- a/app.rb +++ b/app.rb @@ -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' diff --git a/views/dashboard.slim b/views/dashboard.slim index 111152a8..f6d2906b 100644 --- a/views/dashboard.slim +++ b/views/dashboard.slim @@ -34,7 +34,10 @@ javascript: a href="/site_files/text_editor/#{file.filename}" Edit with text editor
span i class="icon-edit"    - span Edit with visual editor (not implemented yet.. coming soon)
+ span Edit with visual editor (coming soon)
+ span + i class="icon-edit"    + span: a href="/site_files/download/#{file.filename}" Download
span i class="icon-trash"    a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete