Updated saving feedback to use loading.gif
This commit is contained in:
parent
9d918b5ac8
commit
5c9b069fe5
|
@ -22,4 +22,8 @@
|
||||||
#editor_save{
|
#editor_save{
|
||||||
margin-left: 7px;
|
margin-left: 7px;
|
||||||
float: left;
|
float: left;
|
||||||
|
}
|
||||||
|
#saving_icon{
|
||||||
|
padding-top: 3px;
|
||||||
|
float: left;
|
||||||
}
|
}
|
|
@ -55,14 +55,6 @@ function bindControlEvents(){
|
||||||
$('#editor_close').live('click',function() {
|
$('#editor_close').live('click',function() {
|
||||||
hideFileEditor();
|
hideFileEditor();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).keypress(function(event) {
|
|
||||||
if (!(event.which == 115 && (event.ctrlKey || event.metaKey)) && !(event.which == 19)) return true;
|
|
||||||
event.preventDefault();
|
|
||||||
alert("Saved file");
|
|
||||||
doFileSave();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function editorIsShown(){
|
function editorIsShown(){
|
||||||
|
@ -84,7 +76,7 @@ function updateSessionFileHash(path){
|
||||||
|
|
||||||
function doFileSave(){
|
function doFileSave(){
|
||||||
if(editorIsShown()){
|
if(editorIsShown()){
|
||||||
$('#editor_save').val(t('files_texteditor','Saving')+'...');
|
$('#editor_save').after('<img id="saving_icon" src="'+OC.filePath('core','img','loading.gif')+'"></img>');
|
||||||
var filecontents = window.aceEditor.getSession().getValue();
|
var filecontents = window.aceEditor.getSession().getValue();
|
||||||
var dir = $('#editor').attr('data-dir');
|
var dir = $('#editor').attr('data-dir');
|
||||||
var file = $('#editor').attr('data-filename');
|
var file = $('#editor').attr('data-filename');
|
||||||
|
@ -95,7 +87,7 @@ function doFileSave(){
|
||||||
if(answer){
|
if(answer){
|
||||||
$.post(OC.filePath('files_texteditor','ajax','savefile.php'),{ filecontents: filecontents, file: file, dir: dir, force: 'true' },function(jsondata){
|
$.post(OC.filePath('files_texteditor','ajax','savefile.php'),{ filecontents: filecontents, file: file, dir: dir, force: 'true' },function(jsondata){
|
||||||
if(jsondata.status =='success'){
|
if(jsondata.status =='success'){
|
||||||
$('#editor_save').val(t('files_texteditor','Save'));
|
$('#saving_icon').remove();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Save error
|
// Save error
|
||||||
|
@ -105,13 +97,12 @@ function doFileSave(){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Don't save!
|
// Don't save!
|
||||||
$('#editor_save').effect("highlight", {color:'#FF5757'}, 3000);
|
$('#editor_save').effect("highlight", {color:'#FF5757'}, 1000);
|
||||||
$('#editor_save').val(t('files_texteditor','Save'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(jsondata.status == 'success'){
|
else if(jsondata.status == 'success'){
|
||||||
// Success
|
// Success
|
||||||
$('#editor_save').val(t('files_texteditor','Save'));
|
$('#saving_icon').remove();
|
||||||
}
|
}
|
||||||
}, 'json');
|
}, 'json');
|
||||||
giveEditorFocus();
|
giveEditorFocus();
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 847 B |
Loading…
Reference in New Issue