Finish integration of text editor

This commit is contained in:
Kyle Drake 2013-06-04 15:11:43 -07:00
parent f4ce6c9994
commit c9d2374425
3 changed files with 21 additions and 14 deletions

1
app.rb
View file

@ -150,7 +150,6 @@ end
get '/site_files/text_editor/:filename' do |filename|
@file_url = "http://#{current_site.username}.neocities.org/#{filename}"
slim :'site_files/text_editor'
end

View file

@ -31,10 +31,10 @@ javascript:
a href="http://#{current_site.username}.neocities.org/#{file.filename}" target="_blank" View <br>
span
i class="icon-edit" &nbsp;&nbsp;
a href="#" Edit with visual editor <small>not implemented yet.. ETA one week</small> <br>
a href="/site_files/text_editor/#{file.filename}" Edit with text editor <br>
span
i class="icon-edit" &nbsp;&nbsp;
a href="/site_files/text_editor/#{file.filename}" Edit with text editor <small>not implemented yet.. ETA one day</small><br>
span Edit with visual editor <small>(not implemented yet.. coming soon)</small> <br>
span
i class="icon-trash" &nbsp;&nbsp;
a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete

View file

@ -7,11 +7,6 @@ css:
left: 0;
}
.row
.span6.offset3
div id="editorUpdates" class="alert alert-success hidden"
button type="button" class="close" onclick="$('#editorUpdates').addClass('hidden');" &times;
span
.row
.span6
font style="font-size: 27pt" Editing #{params[:filename]}
@ -59,12 +54,16 @@ css:
.row.text-center style="margin-top: 10px"
.span4
a.btn.btn-large.btn-warning href="" Finish Without Saving
a.btn.btn-large.btn-warning href="/dashboard" <i class="icon-remove"></i>&nbsp;&nbsp;Finish Without Saving
.span4
a.btn.btn-large.btn-success href="#" onclick="saveTextFile()" Save Changes
a.btn.btn-large.btn-success href="#" onclick="saveTextFile(false)" <i class="icon-save"></i>&nbsp;&nbsp;Save Changes
.span4
a.btn.btn-large.btn-info href="" Save and Finish
a.btn.btn-large.btn-info href="#" onclick="saveTextFile(true);" <i class="icon-save"></i>&nbsp;&nbsp;Save and Finish
.row style="margin-top: 20px"
.span6.offset3.text-center
div id="editorUpdates" class="alert alert-success hidden"
span
script src="http://rawgithub.com/ajaxorg/ace-builds/master/src-noconflict/ace.js" type="text/javascript" charset="utf-8"
javascript:
@ -73,8 +72,8 @@ javascript:
editor.setTheme($('#theme').val());
}
function saveTextFile() {
/*
function saveTextFile(quit) {
/*
$.post('/site_files/save/#{params[:filename]}', editor.getValue(), function(resp) {
if(resp == 'ok') {
$('#editorUpdates span').text('Your file has been saved.');
@ -91,11 +90,20 @@ javascript:
type: 'POST',
success: function(response){
if(response == 'ok') {
$('#editorUpdates span').text('Your file has been saved.');
if(quit === true) {
window.location = '/dashboard';
}
$('#editorUpdates span').html('<i class="icon-save icon-2x"></i>&nbsp;&nbsp;<font style="font-size: 14pt">Your file has been saved.</font>');
setTimeout(function() {
$('#editorUpdates').fadeOut(); //.addClass('hidden');
}, 2000);
} else {
$('#editorUpdates span').text(response);
}
$('#editorUpdates').fadeIn();
$('#editorUpdates').removeClass('hidden');
}
});
}