select new palette after saving

This commit is contained in:
jdescottes
2014-09-16 00:37:24 +02:00
parent f7f9587520
commit fab9c6e836
4 changed files with 39 additions and 22 deletions

View File

@@ -120,16 +120,22 @@
};
ns.CreatePaletteController.prototype.onSubmitButtonClick_ = function (evt) {
this.paletteService.savePalette(this.palette);
this.saveAndSelectPalette_(this.palette);
this.closeDialog();
};
ns.CreatePaletteController.prototype.onCloneButtonClick_ = function (evt) {
var palette = new pskl.model.Palette(pskl.utils.Uuid.generate(), this.palette.name, this.palette.colors);
this.paletteService.savePalette(palette);
var uuid = pskl.utils.Uuid.generate();
var palette = new pskl.model.Palette(uuid, this.palette.name, this.palette.colors);
this.saveAndSelectPalette_(palette);
this.closeDialog();
};
ns.CreatePaletteController.prototype.saveAndSelectPalette_ = function (palette) {
this.paletteService.savePalette(palette);
pskl.UserSettings.set(pskl.UserSettings.SELECTED_PALETTE, palette.id);
};
ns.CreatePaletteController.prototype.onImportFileButtonClick_ = function () {
this.hiddenFileInput.click();
};