integrate palette list with palette manager

This commit is contained in:
juliandescottes
2014-03-30 01:10:00 +01:00
parent 41e52a7a39
commit d2ec797496
11 changed files with 193 additions and 32 deletions

View File

@@ -36,7 +36,7 @@
};
ns.DialogsController.prototype.onDialogHideEvent_ = function () {
this.hideDialogWrapper_();
this.hideDialog();
};
ns.DialogsController.prototype.showDialogWrapper_ = function () {

View File

@@ -20,6 +20,7 @@
this.paletteBody = document.querySelector('.palette-manager-details-body');
this.paletteHead = document.querySelector('.palette-manager-details-head');
this.createButton = document.querySelector('.palette-manager-actions-button[data-action="create"]');
this.closeButton = document.querySelector('.palette-manager-close');
this.colorCardTemplate = pskl.utils.Template.get('palette-color-card-template');
this.newColorTemplate = pskl.utils.Template.get('palette-new-color-template');
@@ -31,6 +32,7 @@
this.paletteBody.addEventListener('click', this.delegatedPaletteBodyClick.bind(this));
this.paletteHead.addEventListener('click', this.delegatedPaletteHeadClick.bind(this));
this.createButton.addEventListener('click', this.createPalette.bind(this));
this.closeButton.addEventListener('click', this.closeDialog.bind(this));
// Init markup
this.createPaletteListMarkup();
@@ -41,6 +43,10 @@
}
};
ns.PaletteManagerController.prototype.closeDialog = function () {
$.publish(Events.DIALOG_HIDE);
};
ns.PaletteManagerController.prototype.createPalette = function () {
var name = window.prompt('Please enter a name for your palette', 'New palette');
if (name) {
@@ -316,6 +322,7 @@
ns.PaletteManagerController.prototype.persistToLocalStorage = function () {
window.localStorage.setItem('piskel.palettes', JSON.stringify(this.originalPalettes));
this.originalPalettes = this.retrieveUserPalettes();
$.publish(Events.PALETTE_LIST_UPDATED);
};
ns.PaletteManagerController.prototype.retrieveUserPalettes = function () {