diff --git a/core/client/models/settings.js b/core/client/models/settings.js index 66c63a7c71..bf4a98978e 100644 --- a/core/client/models/settings.js +++ b/core/client/models/settings.js @@ -1,9 +1,10 @@ /*global window, document, Ghost, $, _, Backbone */ (function () { "use strict"; - + //id:0 is used to issue PUT requests Ghost.Models.Settings = Backbone.Model.extend({ - url: Ghost.settings.apiRoot + '/settings' + url: Ghost.settings.apiRoot + '/settings', + id: "0" }); }()); \ No newline at end of file diff --git a/core/client/views/settings.js b/core/client/views/settings.js index 84e80ea574..406c71c4ed 100644 --- a/core/client/views/settings.js +++ b/core/client/views/settings.js @@ -160,7 +160,6 @@ var themes = this.model.get('availableThemes'); this.model.unset('availableThemes'); this.model.save({ - id: 0, //workaround to use put title: this.$('#blog-title').val(), description: $('#blog-description').val(), logo: this.$('#blog-logo').attr("src"), @@ -185,12 +184,16 @@ showUpload: function (id, key, src) { var self = this, upload = new Ghost.Models.uploadModal({'id': id, 'key': key, 'src': src, 'accept': { func: function () { // The function called on acceptance - var data = {}; + var data = {}, + themes; data[key] = this.$('.js-upload-target').attr('src'); + themes = self.model.get('availableThemes'); + self.model.unset('availableThemes'); self.model.save(data, { success: self.saveSuccess, error: self.saveError }); + self.model.set({availableThemes: themes}); self.render(); return true; },