show exporting and saving animation

merge-requests/1/head
Julien Veyssier 2017-01-27 23:57:26 -03:00
parent 5b79cdcced
commit 4fb6e9be3b
3 changed files with 32 additions and 3 deletions

View File

@ -227,7 +227,7 @@ h3 {
margin-left:20px; margin-left:20px;
list-style-type:circle; list-style-type:circle;
} }
#saved, #failed, #loading { #saved, #failed, #loading, #exporting, #saving {
/*width: 330px;*/ /*width: 330px;*/
padding-left: 5px; padding-left: 5px;
/*height: 35px;*/ /*height: 35px;*/
@ -250,11 +250,11 @@ h3 {
#failed{ #failed{
background-color: red; background-color: red;
} }
#saved .fa, #failed .fa, #loading .fa { #saved .fa, #failed .fa, #loading .fa, #exporting .fa, #saving .fa {
font-size: 22px; font-size: 22px;
} }
#saved p, #failed p, #loading p{ #saved p, #failed p, #loading p, #exporting p, #saving p{
padding: 6px 6px 6px 6px; padding: 6px 6px 6px 6px;
} }
.clear { .clear {

View File

@ -862,6 +862,23 @@ function hideLoadingAnimation(){
$('#loading').hide(); $('#loading').hide();
} }
function showExportingAnimation(){
$('#exporting').show();
}
function hideExportingAnimation(){
$('#exporting').hide();
}
function showSavingAnimation(){
$('#saving').show();
}
function hideSavingAnimation(){
$('#saving').hide();
}
function loadAction(file){ function loadAction(file){
if (!endsWith(file, '.gpx') && if (!endsWith(file, '.gpx') &&
@ -1101,14 +1118,18 @@ function addExtraSymbols(){
} }
function saveAction(targetPath){ function saveAction(targetPath){
showExportingAnimation();
var saveFilePath = targetPath+'/'+$('input#saveName').val(); var saveFilePath = targetPath+'/'+$('input#saveName').val();
var gpxText = generateGpx(); var gpxText = generateGpx();
hideExportingAnimation();
showSavingAnimation();
var req = { var req = {
path: saveFilePath, path: saveFilePath,
content: gpxText content: gpxText
} }
var url = OC.generateUrl('/apps/gpxedit/savegpx'); var url = OC.generateUrl('/apps/gpxedit/savegpx');
$.post(url, req).done(function (response) { $.post(url, req).done(function (response) {
hideSavingAnimation();
if (response.status === 'fiw'){ if (response.status === 'fiw'){
showSaveFailAnimation(saveFilePath, t('gpxedit', 'Impossible to write file')+' : '+t('gpxedit', 'write access denied')); showSaveFailAnimation(saveFilePath, t('gpxedit', 'Impossible to write file')+' : '+t('gpxedit', 'write access denied'));
} }

View File

@ -51,6 +51,14 @@ p($_['gpxedit_version']);
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('loading file')); ?>&nbsp;</p> <?php p($l->t('loading file')); ?>&nbsp;</p>
</div> </div>
<div id="exporting"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('exporting file to gpx')); ?>&nbsp;</p>
</div>
<div id="saving"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('saving file')); ?>&nbsp;</p>
</div>
<?php <?php
echo '<p id="username" style="display:none">'; echo '<p id="username" style="display:none">';