Fixed Gruntfile for ghpages export

This commit is contained in:
jdescottes
2014-07-12 21:14:07 +02:00
parent ad3dd935e0
commit dfc3bfd181
15 changed files with 181 additions and 97 deletions

View File

@@ -108,7 +108,6 @@
this.fileDropperService = new pskl.service.FileDropperService(this.piskelController, $('#drawing-canvas-container').get(0));
this.fileDropperService.init();
if (this.isAppEngineVersion) {
this.storageService = new pskl.service.AppEngineStorageService(this.piskelController);
} else {

View File

@@ -28,6 +28,7 @@
$.subscribe(Events.DIALOG_HIDE, this.onDialogHideEvent_.bind(this));
pskl.app.shortcutService.addShortcut('alt+P', this.onDialogDisplayEvent_.bind(this, null, 'manage-palettes'));
this.dialogWrapper_.classList.add('animated');
};
ns.DialogsController.prototype.onDialogDisplayEvent_ = function (evt, args) {
@@ -42,6 +43,8 @@
var config = dialogs[dialogId];
if (config) {
this.dialogContainer_.innerHTML = pskl.utils.Template.get(config.template);
this.dialogContainer_.classList.add(dialogId);
var controller = new config.controller(this.piskelController);
controller.init(initArgs);
@@ -69,6 +72,10 @@
var currentDialog = this.currentDialog_;
if (currentDialog) {
currentDialog.controller.destroy();
var dialogId = this.currentDialog_.id;
window.setTimeout(function () {
this.dialogContainer_.classList.remove(dialogId);
}.bind(this), 800);
}
this.hideDialogWrapper_();

View File

@@ -21,6 +21,10 @@
this.hiddenOpenPiskelInput.change(this.onOpenPiskelChange_.bind(this));
this.openPiskelInputButton.click(this.onOpenPiskelClick_.bind(this));
this.prevSessionContainer = $('.previous-session');
this.previousSessionTemplate_ = pskl.utils.Template.get("previous-session-info-template");
this.fillRestoreSession_();
};
ns.ImportController.prototype.closeDrawer_ = function () {
@@ -94,4 +98,26 @@
return (/\.piskel$/).test(file.name);
};
ns.ImportController.prototype.fillRestoreSession_ = function () {
var previousInfo = pskl.app.backupService.getPreviousPiskelInfo();
if (previousInfo) {
var info = {
name : previousInfo.name,
date : pskl.utils.DateUtils.format(previousInfo.date, "{{H}}:{{m}} - {{Y}}/{{M}}/{{D}}")
};
this.prevSessionContainer.html(pskl.utils.Template.replace(this.previousSessionTemplate_, info));
$(".restore-session-button").click(this.onRestorePreviousSessionClick_.bind(this));
} else {
this.prevSessionContainer.html("No piskel backup was found on this browser.");
}
};
ns.ImportController.prototype.onRestorePreviousSessionClick_ = function () {
if (window.confirm('This will erase your current workspace. Continue ?')) {
pskl.app.backupService.load();
$.publish(Events.CLOSE_SETTINGS_DRAWER);
}
};
})();

View File

@@ -14,6 +14,7 @@
this.descriptionInput = $('#save-description');
this.isPublicCheckbox = $('input[name=save-public-checkbox]');
this.saveOnlineButton = $('#save-online-button');
this.saveLocalButton = $('#save-browser-button');
this.saveFileButton = $('#save-file-button');
// Only available in app-engine mode ...
@@ -30,17 +31,18 @@
this.isPublicCheckbox.prop('checked', descriptor.isPublic);
this.saveFileButton.click(this.onSaveLocalClick_.bind(this));
this.saveFileButton.click(this.saveFile_.bind(this));
this.saveLocalButton.click(this.saveLocal_.bind(this));
this.saveOnlineButton.click(this.saveOnline_.bind(this));
this.saveForm.submit(this.onSaveFormSubmit_.bind(this));
this.nameInput.keyup(this.updateLocalStatusFilename_.bind(this));
if (pskl.app.isLoggedIn()) {
this.saveForm.submit(this.onSaveFormSubmit_.bind(this));
} else {
if (!pskl.app.isLoggedIn()) {
this.saveOnlineButton.hide();
$('.save-public-section').hide();
this.saveOnlineStatus.html(pskl.utils.Template.get('save-please-login-partial'));
this.saveFileButton.get(0).classList.add('button-primary');
this.saveForm.submit(this.onSaveLocalClick_.bind(this));
}
this.updateLocalStatusFilename_();
@@ -62,6 +64,15 @@
evt.preventDefault();
evt.stopPropagation();
if (pskl.app.isLoggedIn()) {
this.saveOnline_();
} else {
this.saveLocal_();
}
};
ns.SaveController.prototype.saveOnline_ = function () {
var name = this.getName();
if (!name) {
@@ -84,9 +95,28 @@
}
};
ns.SaveController.prototype.onSaveLocalClick_ = function (evt) {
this.beforeSaving_();
ns.SaveController.prototype.saveLocal_ = function () {
var localStorageService = pskl.app.localStorageService;
var isOk = true;
var name = this.getName();
var description = this.getDescription();
if (localStorageService.getPiskel(name)) {
isOk = window.confirm('There is already a piskel saved as ' + name + '. Override ?');
}
if (isOk) {
this.beforeSaving_();
localStorageService.save(name, description, pskl.app.piskelController.serialize());
window.setTimeout(function () {
this.onSaveSuccess_();
this.afterSaving_();
}.bind(this), 500);
}
};
ns.SaveController.prototype.saveFile_ = function () {
this.beforeSaving_();
this.saveToFile_();
pskl.utils.BlobUtils.stringToBlob(pskl.app.piskelController.serialize(), function(blob) {
pskl.utils.FileUtils.downloadAsFile(blob, this.getLocalFilename_());
this.onSaveSuccess_();
@@ -134,7 +164,7 @@
ns.SaveController.prototype.afterSaving_ = function () {
this.saveOnlineButton.attr('disabled', false);
this.submitButton.html('');
this.saveOnlineStatus.html('');
if (this.piskelName) {
this.piskelName.classList.remove('piskel-name-saving');