mirror of
https://github.com/neocities/neocities.git
synced 2025-04-28 11:12:30 +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|
|
get '/site_files/text_editor/:filename' do |filename|
|
||||||
@file_url = "http://#{current_site.username}.neocities.org/#{filename}"
|
@file_url = "http://#{current_site.username}.neocities.org/#{filename}"
|
||||||
|
|
||||||
slim :'site_files/text_editor'
|
slim :'site_files/text_editor'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@ javascript:
|
||||||
a href="http://#{current_site.username}.neocities.org/#{file.filename}" target="_blank" View <br>
|
a href="http://#{current_site.username}.neocities.org/#{file.filename}" target="_blank" View <br>
|
||||||
span
|
span
|
||||||
i class="icon-edit"
|
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
|
span
|
||||||
i class="icon-edit"
|
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
|
span
|
||||||
i class="icon-trash"
|
i class="icon-trash"
|
||||||
a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete
|
a href="#" onclick="confirmFileDelete('#{file.filename}')" Delete
|
||||||
|
|
|
@ -7,11 +7,6 @@ css:
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row
|
|
||||||
.span6.offset3
|
|
||||||
div id="editorUpdates" class="alert alert-success hidden"
|
|
||||||
button type="button" class="close" onclick="$('#editorUpdates').addClass('hidden');" ×
|
|
||||||
span
|
|
||||||
.row
|
.row
|
||||||
.span6
|
.span6
|
||||||
font style="font-size: 27pt" Editing #{params[:filename]}
|
font style="font-size: 27pt" Editing #{params[:filename]}
|
||||||
|
@ -59,12 +54,16 @@ css:
|
||||||
|
|
||||||
.row.text-center style="margin-top: 10px"
|
.row.text-center style="margin-top: 10px"
|
||||||
.span4
|
.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
|
.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
|
.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"
|
script src="http://rawgithub.com/ajaxorg/ace-builds/master/src-noconflict/ace.js" type="text/javascript" charset="utf-8"
|
||||||
javascript:
|
javascript:
|
||||||
|
@ -73,7 +72,7 @@ javascript:
|
||||||
editor.setTheme($('#theme').val());
|
editor.setTheme($('#theme').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveTextFile() {
|
function saveTextFile(quit) {
|
||||||
/*
|
/*
|
||||||
$.post('/site_files/save/#{params[:filename]}', editor.getValue(), function(resp) {
|
$.post('/site_files/save/#{params[:filename]}', editor.getValue(), function(resp) {
|
||||||
if(resp == 'ok') {
|
if(resp == 'ok') {
|
||||||
|
@ -91,11 +90,20 @@ javascript:
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function(response){
|
success: function(response){
|
||||||
if(response == 'ok') {
|
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 {
|
} else {
|
||||||
$('#editorUpdates span').text(response);
|
$('#editorUpdates span').text(response);
|
||||||
}
|
}
|
||||||
|
$('#editorUpdates').fadeIn();
|
||||||
$('#editorUpdates').removeClass('hidden');
|
$('#editorUpdates').removeClass('hidden');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue