Skip to content

Commit

Permalink
[build][s]: usual build.
Browse files Browse the repository at this point in the history
  • Loading branch information
rufuspollock committed Jul 5, 2012
1 parent a58f5e5 commit 8fb4b27
Show file tree
Hide file tree
Showing 18 changed files with 1,285 additions and 123 deletions.
38 changes: 31 additions & 7 deletions dist/recline.dataset.js
Expand Up @@ -6,7 +6,9 @@ this.recline.Model = this.recline.Model || {};

// ## <a id="dataset">Dataset</a>
my.Dataset = Backbone.Model.extend({
__type__: 'Dataset',
constructor: function Dataset() {
Backbone.Model.prototype.constructor.apply(this, arguments);
},

// ### initialize
initialize: function() {
Expand All @@ -20,7 +22,7 @@ my.Dataset = Backbone.Model.extend({
}
}
this.fields = new my.FieldList();
this.currentRecords = new my.RecordList();
this.records = new my.RecordList();
this._changes = {
deletes: [],
updates: [],
Expand Down Expand Up @@ -170,7 +172,7 @@ my.Dataset = Backbone.Model.extend({
// It will query based on current query state (given by this.queryState)
// updated by queryObj (if provided).
//
// Resulting RecordList are used to reset this.currentRecords and are
// Resulting RecordList are used to reset this.records and are
// also returned.
query: function(queryObj) {
var self = this;
Expand All @@ -186,7 +188,7 @@ my.Dataset = Backbone.Model.extend({
.done(function(queryResult) {
self._handleQueryResult(queryResult);
self.trigger('query:done');
dfd.resolve(self.currentRecords);
dfd.resolve(self.records);
})
.fail(function(arguments) {
self.trigger('query:fail', arguments);
Expand All @@ -208,7 +210,7 @@ my.Dataset = Backbone.Model.extend({
});
return _doc;
});
self.currentRecords.reset(docs);
self.records.reset(docs);
if (queryResult.facets) {
var facets = _.map(queryResult.facets, function(facetResult, facetId) {
facetResult.id = facetId;
Expand Down Expand Up @@ -331,7 +333,10 @@ my.Dataset.restore = function(state) {
//
// A single entry or row in the dataset
my.Record = Backbone.Model.extend({
__type__: 'Record',
constructor: function Record() {
Backbone.Model.prototype.constructor.apply(this, arguments);
},

initialize: function() {
_.bindAll(this, 'getFieldValue');
},
Expand Down Expand Up @@ -369,14 +374,21 @@ my.Record = Backbone.Model.extend({
destroy: function() { this.trigger('destroy', this); }
});


// ## A Backbone collection of Records
my.RecordList = Backbone.Collection.extend({
__type__: 'RecordList',
constructor: function RecordList() {
Backbone.Collection.prototype.constructor.apply(this, arguments);
},
model: my.Record
});


// ## <a id="field">A Field (aka Column) on a Dataset</a>
my.Field = Backbone.Model.extend({
constructor: function Field() {
Backbone.Model.prototype.constructor.apply(this, arguments);
},
// ### defaults - define default values
defaults: {
label: null,
Expand Down Expand Up @@ -445,11 +457,17 @@ my.Field = Backbone.Model.extend({
});

my.FieldList = Backbone.Collection.extend({
constructor: function FieldList() {
Backbone.Collection.prototype.constructor.apply(this, arguments);
},
model: my.Field
});

// ## <a id="query">Query</a>
my.Query = Backbone.Model.extend({
constructor: function Query() {
Backbone.Model.prototype.constructor.apply(this, arguments);
},
defaults: function() {
return {
size: 100,
Expand Down Expand Up @@ -534,6 +552,9 @@ my.Query = Backbone.Model.extend({

// ## <a id="facet">A Facet (Result)</a>
my.Facet = Backbone.Model.extend({
constructor: function Facet() {
Backbone.Model.prototype.constructor.apply(this, arguments);
},
defaults: function() {
return {
_type: 'terms',
Expand All @@ -547,6 +568,9 @@ my.Facet = Backbone.Model.extend({

// ## A Collection/List of Facets
my.FacetList = Backbone.Collection.extend({
constructor: function FacetList() {
Backbone.Collection.prototype.constructor.apply(this, arguments);
},
model: my.Facet
});

Expand Down

0 comments on commit 8fb4b27

Please sign in to comment.