mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
237af40f2e
This reverts commit611e6a49ef
, reversing changes made toa89dc1d123
.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
(function () {
|
|
"use strict";
|
|
|
|
var _ = require('underscore'),
|
|
when = require('when'),
|
|
util = require('util'),
|
|
models = require('./models'),
|
|
BaseProvider = require('./dataProvider.bookshelf.base'),
|
|
SettingsProvider;
|
|
|
|
/**
|
|
* The Posts data provider implementation for Bookshelf.
|
|
*/
|
|
SettingsProvider = function () {
|
|
BaseProvider.call(this, models.Setting, models.Settings);
|
|
};
|
|
|
|
util.inherits(SettingsProvider, BaseProvider);
|
|
|
|
SettingsProvider.prototype.read = function (_key) {
|
|
// Allow for just passing the key instead of attributes
|
|
if (_.isString(_key)) {
|
|
_key = { key: _key };
|
|
}
|
|
return BaseProvider.prototype.read.call(this, _key);
|
|
};
|
|
|
|
SettingsProvider.prototype.edit = function (_data) {
|
|
return when.all(_.map(_data, function (value, key) {
|
|
return this.model.forge({ key: key }).fetch().then(function (setting) {
|
|
return setting.set('value', value).save();
|
|
});
|
|
}, this));
|
|
};
|
|
|
|
module.exports = SettingsProvider;
|
|
}()); |