From 4fb6e9be3bcac7a52eb5fbd385cb32b9f7955bcb Mon Sep 17 00:00:00 2001
From: Julien Veyssier
Date: Fri, 27 Jan 2017 23:57:26 -0300
Subject: [PATCH] show exporting and saving animation
---
css/gpxedit.css | 6 +++---
js/gpxedit.js | 21 +++++++++++++++++++++
templates/gpxcontent.php | 8 ++++++++
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/css/gpxedit.css b/css/gpxedit.css
index 83cd875..75eefda 100644
--- a/css/gpxedit.css
+++ b/css/gpxedit.css
@@ -227,7 +227,7 @@ h3 {
margin-left:20px;
list-style-type:circle;
}
-#saved, #failed, #loading {
+#saved, #failed, #loading, #exporting, #saving {
/*width: 330px;*/
padding-left: 5px;
/*height: 35px;*/
@@ -250,11 +250,11 @@ h3 {
#failed{
background-color: red;
}
-#saved .fa, #failed .fa, #loading .fa {
+#saved .fa, #failed .fa, #loading .fa, #exporting .fa, #saving .fa {
font-size: 22px;
}
-#saved p, #failed p, #loading p{
+#saved p, #failed p, #loading p, #exporting p, #saving p{
padding: 6px 6px 6px 6px;
}
.clear {
diff --git a/js/gpxedit.js b/js/gpxedit.js
index 617dd9e..c78d8bb 100644
--- a/js/gpxedit.js
+++ b/js/gpxedit.js
@@ -862,6 +862,23 @@ function hideLoadingAnimation(){
$('#loading').hide();
}
+function showExportingAnimation(){
+ $('#exporting').show();
+}
+
+function hideExportingAnimation(){
+ $('#exporting').hide();
+}
+
+function showSavingAnimation(){
+ $('#saving').show();
+}
+
+function hideSavingAnimation(){
+ $('#saving').hide();
+}
+
+
function loadAction(file){
if (!endsWith(file, '.gpx') &&
@@ -1101,14 +1118,18 @@ function addExtraSymbols(){
}
function saveAction(targetPath){
+ showExportingAnimation();
var saveFilePath = targetPath+'/'+$('input#saveName').val();
var gpxText = generateGpx();
+ hideExportingAnimation();
+ showSavingAnimation();
var req = {
path: saveFilePath,
content: gpxText
}
var url = OC.generateUrl('/apps/gpxedit/savegpx');
$.post(url, req).done(function (response) {
+ hideSavingAnimation();
if (response.status === 'fiw'){
showSaveFailAnimation(saveFilePath, t('gpxedit', 'Impossible to write file')+' : '+t('gpxedit', 'write access denied'));
}
diff --git a/templates/gpxcontent.php b/templates/gpxcontent.php
index 008d731..f65cbf9 100644
--- a/templates/gpxcontent.php
+++ b/templates/gpxcontent.php
@@ -51,6 +51,14 @@ p($_['gpxedit_version']);
t('loading file')); ?>
+
+
+ t('exporting file to gpx')); ?>
+
+
+
+ t('saving file')); ?>
+
';