From f114676db7d9e5a175e00d055a5f216962cfd38d Mon Sep 17 00:00:00 2001 From: Lee Grey Date: Thu, 26 Mar 2015 20:32:27 +1300 Subject: [PATCH] Include save file path in "Successfully Saved" popup. Show full save path under the save button. Hide the "save to browser" portion of the save panel when running in desktop mode. --- src/css/settings.css | 9 ++++++++- src/js/controller/settings/SaveController.js | 17 ++++++++++++++--- src/js/service/DesktopStorageService.js | 5 +++-- src/templates/settings/save.html | 18 ++++++++++++------ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/css/settings.css b/src/css/settings.css index e62f72cc..ad563349 100644 --- a/src/css/settings.css +++ b/src/css/settings.css @@ -208,4 +208,11 @@ font-weight: bold; color: white; font-style: normal; -} \ No newline at end of file +} + +.save-desktop-file-name { + word-wrap: break-word; + font-weight: bold; + color: white; + font-style: normal; +} diff --git a/src/js/controller/settings/SaveController.js b/src/js/controller/settings/SaveController.js index 5b801f5d..c66616be 100644 --- a/src/js/controller/settings/SaveController.js +++ b/src/js/controller/settings/SaveController.js @@ -31,6 +31,8 @@ if (pskl.utils.Environment.detectNodeWebkit()) { // running in Node-Webkit... this.saveFileButton.click(this.saveFileDesktop_.bind(this)); + // hide the "save in browser" part of the gui + $('#save-in-browser').css('display', 'none'); } else { // running in browser... this.saveFileButton.click(this.saveFileBrowser_.bind(this)); @@ -61,9 +63,18 @@ }; ns.SaveController.prototype.updateLocalStatusFilename_ = function () { - this.saveFileStatus.html(pskl.utils.Template.getAndReplace('save-file-status-template', { - name : this.getLocalFilename_() - })); + if (pskl.utils.Environment.detectNodeWebkit()) { + var fileName = this.piskelController.getSavePath(); + if (fileName !== null) { + this.saveFileStatus.html(pskl.utils.Template.getAndReplace('save-file-status-desktop-template', { + name : this.piskelController.getSavePath() + })); + } + } else { + this.saveFileStatus.html(pskl.utils.Template.getAndReplace('save-file-status-template', { + name : this.getLocalFilename_() + })); + } }; ns.SaveController.prototype.getLocalFilename_ = function () { diff --git a/src/js/service/DesktopStorageService.js b/src/js/service/DesktopStorageService.js index 211ebdad..7aef36a7 100644 --- a/src/js/service/DesktopStorageService.js +++ b/src/js/service/DesktopStorageService.js @@ -58,13 +58,14 @@ }; ns.DesktopStorageService.prototype.onSaveSuccess_ = function () { + var savePath = this.piskelController.getSavePath(); $.publish(Events.CLOSE_SETTINGS_DRAWER); - $.publish(Events.SHOW_NOTIFICATION, [{"content": "Successfully saved !"}]); + $.publish(Events.SHOW_NOTIFICATION, [{"content": "Successfully saved: " + savePath}]); $.publish(Events.PISKEL_SAVED); // clear the old time out, if any. window.clearTimeout(this.hideNotificationTimeoutID); this.hideNotificationTimeoutID = - window.setTimeout($.publish.bind($, Events.HIDE_NOTIFICATION), 2000); + window.setTimeout($.publish.bind($, Events.HIDE_NOTIFICATION), 3000); }; })(); diff --git a/src/templates/settings/save.html b/src/templates/settings/save.html index 65ac903a..75f3e566 100644 --- a/src/templates/settings/save.html +++ b/src/templates/settings/save.html @@ -20,10 +20,12 @@
-
Save offline in Browser
-
- -
Your piskel will be saved locally and will only be accessible from this browser.
+
+
Save offline in Browser
+
+ +
Your piskel will be saved locally and will only be accessible from this browser.
+
Save offline as File
@@ -41,6 +43,10 @@ -
\ No newline at end of file + + +