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.

This commit is contained in:
Lee Grey 2015-03-26 20:32:27 +13:00
parent 0ec3787fc4
commit f114676db7
4 changed files with 37 additions and 12 deletions

View File

@ -209,3 +209,10 @@
color: white;
font-style: normal;
}
.save-desktop-file-name {
word-wrap: break-word;
font-weight: bold;
color: white;
font-style: normal;
}

View File

@ -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 () {
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 () {

View File

@ -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);
};
})();

View File

@ -20,11 +20,13 @@
<input type="button" class="button button-primary" id="save-online-button" value="Save to your gallery" />
<div id="save-online-status" class="save-status"></div>
</div>
<div id="save-in-browser">
<div class="settings-title">Save offline in Browser</div>
<div class="settings-item">
<input type="button" class="button button-primary" id="save-browser-button" value="Save in Browser" />
<div id="save-browser-status" class="save-status">Your piskel will be saved locally and will only be accessible from this browser.</div>
</div>
</div>
<div class="settings-title">Save offline as File</div>
<div class="settings-item">
<input type="button" class="button button-primary" id="save-file-button" value="Save as File" />
@ -41,6 +43,10 @@
</script>
<script type="text/template" id="save-file-status-template">
<span>Your piskel will be downloaded as <span class="save-file-name">{{name}}<span></span>
<span>Your piskel will be downloaded as: <span class="save-file-name">{{name}}<span></span>
</script>
<script type="text/template" id="save-file-status-desktop-template">
<span>Saving as: <span class="save-desktop-file-name">{{name}}<span></span>
</script>
</div>