mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Move to new API format for Settings.
refs #2606 - Use new API format when updating settings from the client side - Add additional test to test new API format - Adjust functional tests to work with the new format
This commit is contained in:
parent
fc667832c3
commit
6647b57164
1 changed files with 14 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/*global Ghost, _ */
|
||||
/*global Backbone, Ghost, _ */
|
||||
(function () {
|
||||
'use strict';
|
||||
//id:0 is used to issue PUT requests
|
||||
|
@ -14,6 +14,19 @@
|
|||
}, {});
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
sync: function (method, model, options) {
|
||||
var settings = _.map(this.attributes, function (value, key) {
|
||||
return { key: key, value: value };
|
||||
});
|
||||
//wrap settings in {settings: [{...}]}
|
||||
if (method === 'update') {
|
||||
options.data = JSON.stringify({settings: settings});
|
||||
options.contentType = 'application/json';
|
||||
}
|
||||
|
||||
return Backbone.Model.prototype.sync.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue