rename files to better names

This commit is contained in:
Max Ogden 2011-11-03 18:39:18 +00:00
parent f7e5a03174
commit 9674e10119
4 changed files with 39 additions and 46 deletions

View File

@ -1,43 +0,0 @@
this.RECLINE = this.RECLINE || {};
RECLINE.Model = function ($, _, Backbone) {
var my = {};
// A Dataset model.
my.Dataset = Backbone.Model.extend({
initialize: function(data, rawTabularData) {
this.tabularData = new my.TabularData(rawTabularData);
}
// get TabularData object associated with this Dataset
//
// async (as may involve getting data from the server) implementing standard promise API
, getTabularData: function() {
var dfd = $.Deferred();
dfd.resolve(this.tabularData);
return dfd.promise();
}
});
// TabularData model
my.TabularData = Backbone.Model.extend({
getLength: function() {
return this.get('rows').length;
}
, getRows: function(numRows, start) {
if (start === undefined) {
start = 0;
}
if (numRows === undefined) {
numRows = 10;
}
var dfd = $.Deferred();
var results = this.get('rows').slice(start, start+numRows);
dfd.resolve(results);
return dfd.promise();
}
});
return my;
}(this.jQuery, this._, this.Backbone);

36
src/model.js Normal file
View File

@ -0,0 +1,36 @@
this.recline = this.recline || {};
// A Dataset model.
recline.Dataset = Backbone.Model.extend({
initialize: function(data, rawTabularData) {
this.tabularData = new recline.TabularData(rawTabularData);
}
// get TabularData object associated with this Dataset
//
// async (as may involve getting data from the server) implementing standard promise API
, getTabularData: function() {
var dfd = $.Deferred();
dfd.resolve(this.tabularData);
return dfd.promise();
}
});
// TabularData model
recline.TabularData = Backbone.Model.extend({
getLength: function() {
return this.get('rows').length;
}
, getRows: function(numRows, start) {
if (start === undefined) {
start = 0;
}
if (numRows === undefined) {
numRows = 10;
}
var dfd = $.Deferred();
var results = this.get('rows').slice(start, start+numRows);
dfd.resolve(results);
return dfd.promise();
}
});

View File

@ -8,8 +8,8 @@
<script src="../src/deps-min.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="../src/dataset.js"></script>
<script type="text/javascript" src="dataset.test.js"></script>
<script type="text/javascript" src="../src/model.js"></script>
<script type="text/javascript" src="model.test.js"></script>
</head>
<body>
<h1 id="qunit-header">Qunit Tests</h1>

View File

@ -19,7 +19,7 @@ test('new Dataset', function () {
, {x: 6, y: 12, z: 18}
]
};
var dataset = new RECLINE.Model.Dataset(metadata, indata);
var dataset = new recline.Dataset(metadata, indata);
equal(dataset.get('name'), metadata.name);
expect(6);
setTimeout(2);