2013-05-30 23:34:53 +01:00
|
|
|
/**
|
|
|
|
* Dummy dataProvider returns hardcoded JSON data until we finish migrating settings data to a datastore
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*globals module, require */
|
|
|
|
(function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var _ = require('underscore'),
|
|
|
|
when = require('when'),
|
|
|
|
DataProvider,
|
2013-05-29 23:49:49 +01:00
|
|
|
instance;
|
2013-05-30 23:34:53 +01:00
|
|
|
|
|
|
|
DataProvider = function () {
|
|
|
|
if (!instance) {
|
|
|
|
instance = this;
|
2013-05-29 23:49:49 +01:00
|
|
|
_.extend(instance, {
|
|
|
|
data: [],
|
|
|
|
findAll: function(callback) {
|
|
|
|
callback(null, instance.data);
|
|
|
|
},
|
|
|
|
save: function (globals) {
|
|
|
|
_.each(globals, function (global, key) {
|
|
|
|
instance.data[key] = global;
|
|
|
|
}, instance);
|
|
|
|
|
|
|
|
return when(globals);
|
|
|
|
}
|
|
|
|
});
|
2013-05-30 23:34:53 +01:00
|
|
|
}
|
|
|
|
return instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = DataProvider;
|
|
|
|
}());
|