0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #706 from sebgie/fix-blog-logo

Fix for image upload with clean database
This commit is contained in:
Hannah Wolfe 2013-09-11 12:07:49 -07:00
commit 010d6c275b
2 changed files with 8 additions and 4 deletions

View file

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

View file

@ -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;
},