[#50,backend,refactor][s]: complete backend split / rename refactor by removing Backend prefix from Backend classes - fixes #50.
* Backend prefix unnecessary now that everything in recline.Backend module.
This commit is contained in:
parent
519274113e
commit
df79583bde
@ -62,7 +62,7 @@ function demoDataset() {
|
||||
, {id: 5, x: 6, y: 12, z: 18}
|
||||
]
|
||||
};
|
||||
var backend = new recline.Backend.BackendMemory();
|
||||
var backend = new recline.Backend.Memory();
|
||||
backend.addDataset(inData);
|
||||
var dataset = new recline.Model.Dataset({id: datasetId}, backend);
|
||||
return dataset;
|
||||
|
||||
@ -2,7 +2,7 @@ this.recline = this.recline || {};
|
||||
this.recline.Backend = this.recline.Backend || {};
|
||||
|
||||
(function($, my) {
|
||||
// ## BackendDataProxy
|
||||
// ## DataProxy Backend
|
||||
//
|
||||
// For connecting to [DataProxy-s](http://github.com/okfn/dataproxy).
|
||||
//
|
||||
@ -16,7 +16,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
// * format: (optional) csv | xls (defaults to csv if not specified)
|
||||
//
|
||||
// Note that this is a **read-only** backend.
|
||||
my.BackendDataProxy = Backbone.Model.extend({
|
||||
my.DataProxy = Backbone.Model.extend({
|
||||
defaults: {
|
||||
dataproxy_url: 'http://jsonpdataproxy.appspot.com'
|
||||
},
|
||||
@ -79,7 +79,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
return dfd.promise();
|
||||
}
|
||||
});
|
||||
recline.Model.backends['dataproxy'] = new my.BackendDataProxy();
|
||||
recline.Model.backends['dataproxy'] = new my.DataProxy();
|
||||
|
||||
|
||||
}(jQuery, this.recline.Backend));
|
||||
|
||||
@ -16,7 +16,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
// 'gdocs'
|
||||
// );
|
||||
// </pre>
|
||||
my.BackendGDoc = Backbone.Model.extend({
|
||||
my.GDoc = Backbone.Model.extend({
|
||||
sync: function(method, model, options) {
|
||||
var self = this;
|
||||
if (method === "read") {
|
||||
@ -111,7 +111,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
return results;
|
||||
}
|
||||
});
|
||||
recline.Model.backends['gdocs'] = new my.BackendGDoc();
|
||||
recline.Model.backends['gdocs'] = new my.GDoc();
|
||||
|
||||
}(jQuery, this.recline.Backend));
|
||||
|
||||
|
||||
@ -1,15 +1,8 @@
|
||||
// # Recline Backends
|
||||
//
|
||||
// Backends are connectors to backend data sources and stores
|
||||
//
|
||||
// Backends are implemented as Backbone models but this is just a
|
||||
// convenience (they do not save or load themselves from any remote
|
||||
// source)
|
||||
this.recline = this.recline || {};
|
||||
this.recline.Backend = this.recline.Backend || {};
|
||||
|
||||
(function($, my) {
|
||||
// ## BackendMemory - uses in-memory data
|
||||
// ## Memory Backend - uses in-memory data
|
||||
//
|
||||
// This is very artificial and is really only designed for testing
|
||||
// purposes.
|
||||
@ -23,7 +16,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
//
|
||||
// <pre>
|
||||
// // Backend setup
|
||||
// var backend = Backend();
|
||||
// var backend = recline.Backend.Memory();
|
||||
// backend.addDataset({
|
||||
// metadata: {
|
||||
// id: 'my-id',
|
||||
@ -40,7 +33,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
// dataset.fetch();
|
||||
// etc ...
|
||||
// </pre>
|
||||
my.BackendMemory = Backbone.Model.extend({
|
||||
my.Memory = Backbone.Model.extend({
|
||||
initialize: function() {
|
||||
this.datasets = {};
|
||||
},
|
||||
@ -82,7 +75,7 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
}
|
||||
return dfd.promise();
|
||||
} else {
|
||||
alert('Not supported: sync on BackendMemory with method ' + method + ' and model ' + model);
|
||||
alert('Not supported: sync on Memory backend with method ' + method + ' and model ' + model);
|
||||
}
|
||||
},
|
||||
query: function(model, queryObj) {
|
||||
@ -102,6 +95,6 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
return dfd.promise();
|
||||
}
|
||||
});
|
||||
recline.Model.backends['memory'] = new my.BackendMemory();
|
||||
recline.Model.backends['memory'] = new my.Memory();
|
||||
|
||||
}(jQuery, this.recline.Backend));
|
||||
|
||||
@ -2,12 +2,12 @@ this.recline = this.recline || {};
|
||||
this.recline.Backend = this.recline.Backend || {};
|
||||
|
||||
(function($, my) {
|
||||
// ## BackendWebstore
|
||||
// ## Webstore Backend
|
||||
//
|
||||
// Connecting to [Webstores](http://github.com/okfn/webstore)
|
||||
//
|
||||
// To use this backend ensure your Dataset has a webstore_url in its attributes.
|
||||
my.BackendWebstore = Backbone.Model.extend({
|
||||
my.Webstore = Backbone.Model.extend({
|
||||
sync: function(method, model, options) {
|
||||
if (method === "read") {
|
||||
if (model.__type__ == 'Dataset') {
|
||||
@ -56,6 +56,6 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
return dfd.promise();
|
||||
}
|
||||
});
|
||||
recline.Model.backends['webstore'] = new my.BackendWebstore();
|
||||
recline.Model.backends['webstore'] = new my.Webstore();
|
||||
|
||||
}(jQuery, this.recline.Backend));
|
||||
|
||||
@ -19,7 +19,7 @@ var memoryData = {
|
||||
};
|
||||
|
||||
function makeBackendDataset() {
|
||||
var backend = new recline.Backend.BackendMemory();
|
||||
var backend = new recline.Backend.Memory();
|
||||
backend.addDataset(memoryData);
|
||||
var dataset = new recline.Model.Dataset({id: memoryData.metadata.id}, backend);
|
||||
return dataset;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user