From 0bf3cf409ed1d99b033ff88fa33b24bd8863e640 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 4 Jun 2013 15:22:43 -0700 Subject: [PATCH] read file directly in because of some weird cross domain issue --- app.rb | 2 +- views/site_files/text_editor.slim | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app.rb b/app.rb index 03359a2f..de69ad22 100644 --- a/app.rb +++ b/app.rb @@ -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 diff --git a/views/site_files/text_editor.slim b/views/site_files/text_editor.slim index 03e0e1ec..641a088b 100644 --- a/views/site_files/text_editor.slim +++ b/views/site_files/text_editor.slim @@ -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); });