From 42fce1929cf71506a08f51b2c0edbd426cf87200 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 26 Nov 2013 12:50:40 +0000 Subject: [PATCH] Improve save notifications for TiddlySpot --- core/modules/savers/upload.js | 8 ++++++-- core/modules/wiki.js | 6 +++++- editions/tw5.com/tiddlers/Release 5.0.0alpha16.tid | 1 + editions/tw5.com/tiddlers/TiddlySpot.tid | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/modules/savers/upload.js b/core/modules/savers/upload.js index 2e1ff9c20..99127011a 100644 --- a/core/modules/savers/upload.js +++ b/core/modules/savers/upload.js @@ -21,7 +21,7 @@ var UploadSaver = function(wiki) { this.wiki = wiki; }; -UploadSaver.prototype.save = function(text) { +UploadSaver.prototype.save = function(text,callback) { // Get the various parameters we need var backupDir = ".", username = this.wiki.getTextReference("$:/UploadName"), @@ -56,7 +56,11 @@ UploadSaver.prototype.save = function(text) { http.setRequestHeader("Content-Type","multipart/form-data; ;charset=UTF-8; boundary=" + boundary); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { - window.alert(http.responseText); + if(http.responseText.trim() === "0 - Fileindex.html") { + callback(null); + } else { + callback(http.responseText); + } } }; http.send(data); diff --git a/core/modules/wiki.js b/core/modules/wiki.js index b5f4ed9b3..6f303e9a7 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -875,7 +875,11 @@ exports.saveWiki = function(options) { downloadType = options.downloadType || "text/plain"; var text = this.renderTiddler(downloadType,template); this.callSaver("save",text,function(err) { - $tw.notifier.display("$:/messages/Saved"); + if(err) { + alert("Error while saving:\n\n" + err); + } else { + $tw.notifier.display("$:/messages/Saved"); + } }); }; diff --git a/editions/tw5.com/tiddlers/Release 5.0.0alpha16.tid b/editions/tw5.com/tiddlers/Release 5.0.0alpha16.tid index 43a88e6a3..05529caa4 100644 --- a/editions/tw5.com/tiddlers/Release 5.0.0alpha16.tid +++ b/editions/tw5.com/tiddlers/Release 5.0.0alpha16.tid @@ -17,6 +17,7 @@ tags: releasenote ** [[$:/TopSideBar]] and [[$:/LeftSideBar]] are no longer specially treated; use the new tag instead * Fixed problem that prevented tag configured items from shadow tiddlers interleaving with items from ordinary tiddlers * Refactored control panel to add ''Saving'' tab that includes TiddlySpot options +* Improved notifications when saving to TiddlySpot * Added backup URL to TiddlySpot control panel tab !! Bug fixes diff --git a/editions/tw5.com/tiddlers/TiddlySpot.tid b/editions/tw5.com/tiddlers/TiddlySpot.tid index 970b1f21c..350162827 100644 --- a/editions/tw5.com/tiddlers/TiddlySpot.tid +++ b/editions/tw5.com/tiddlers/TiddlySpot.tid @@ -12,6 +12,6 @@ TiddlyWiki5 isn't yet built in to TiddlySpot but you can use it by following the # Sign up for a new wiki at http://tiddlyspot.com/, and remember the wiki name and password # Open TiddlyWiki5 in your browser from http://five.tiddlywiki.com/empty.html # Fill in the TiddlySpot wikiname and password in the control panel -# Click the "Save Changes" button. You should get a confirmation message `0 - Fileindex.html` +# Click the "Save Changes" button. You should get a confirmation notification at the top right saying ''Saved wiki''. Saving can take several seconds if you're on a slow connection or working with a large wiki. # Navigate to your TiddlySpot URL at http://{wikiname}.tiddlyspot.com/ # You should see a copy of TiddlyWiki5. You can edit and create tiddlers, and click "Save Changes" to save changes back up to TiddlySpot (you'll need to re-enter your password the first time you visit the wiki on TiddlySpot)