mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Finish integration of text editor
This commit is contained in:
parent
f4ce6c9994
commit
c9d2374425
3 changed files with 21 additions and 14 deletions
1
app.rb
1
app.rb
|
@ -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
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ javascript:
|
|||
a href="http://#{current_site.username}.neocities.org/#{file.filename}" target="_blank" View <br>
|
||||
span
|
||||
i class="icon-edit"
|
||||
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"
|
||||
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"
|
||||
a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete
|
||||
|
|
|
@ -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');" ×
|
||||
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> 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> 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> 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> <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');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue