set mode correctly for ace editor [#93:closed]

This commit is contained in:
Kyle Drake 2015-02-25 21:10:46 -08:00
parent fe9b051c87
commit 781e85f908
2 changed files with 18 additions and 5 deletions

View file

@ -110,6 +110,17 @@ end
get %r{\/site_files\/text_editor\/(.+)} do
require_login
@filename = params[:captures].first
extname = File.extname @filename
@ace_mode = case extname
when /htm|html/ then 'html'
when /js/ then 'javascript'
when /md/ then 'markdown'
when /css/ then 'css'
else
nil
end
begin
@file_data = current_site.get_file @filename
rescue Errno::ENOENT
@ -148,4 +159,4 @@ end
get '/site_files/mount_info' do
erb :'site_files/mount_info'
end
end