read file directly in because of some weird cross domain issue

This commit is contained in:
Kyle Drake 2013-06-04 15:22:43 -07:00
parent 06597748ea
commit 0bf3cf409e
2 changed files with 7 additions and 11 deletions

2
app.rb
View file

@ -149,7 +149,7 @@ post '/site_files/delete' do
end
get '/site_files/text_editor/:filename' do |filename|
@file_url = "http://#{current_site.username}.neocities.org/#{filename}"
@file_data = File.read File.join(site_base_path(current_site.username), filename)
slim :'site_files/text_editor'
end

View file

@ -50,7 +50,7 @@ css:
.row
.span12
div id="editor" style="width: 100%; height: 1000px; position: relative;"
p Loading, please wait..
#{@file_data}
.row.text-center style="margin-top: 10px"
.span4
@ -111,13 +111,9 @@ javascript:
var editor = {};
$(document).ready(function() {
$.get("#{@file_url}", function (response) {
$("#editor").text(response);
editor = ace.edit("editor");
setTheme();
editor.getSession().setMode("ace/mode/html");
editor.setFontSize(14);
editor.setShowPrintMargin(false);
});
editor = ace.edit("editor");
setTheme();
editor.getSession().setMode("ace/mode/html");
editor.setFontSize(14);
editor.setShowPrintMargin(false);
});