Skip to content

Commit

Permalink
Refactor client collections - eliminated another class without a dist…
Browse files Browse the repository at this point in the history
…inction.
  • Loading branch information
jmchilton committed Nov 30, 2017
1 parent 4db301a commit a3cc810
Showing 1 changed file with 5 additions and 36 deletions.
41 changes: 5 additions & 36 deletions client/galaxy/scripts/mvc/collection/collection-model.js
Expand Up @@ -90,7 +90,10 @@ var DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin)
.extend({ _logNamespace: "collections" });

//==============================================================================
/** @class Base/Abstract Backbone collection for Generic DCEs. */
/** @class Base/Abstract Backbone collection for Generic DCEs -
current may be associated with a dataset (DatasetDCECollection)
or another collection (NestedDCDCECollection).
*/
var DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(
/** @lends DCECollection.prototype */ {
_logNamespace: "collections",
Expand Down Expand Up @@ -199,7 +202,7 @@ var DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin)
/** Which class to use for elements */
collectionClass: function() {
if (this.attributes.collection_type.indexOf(":") > 0) {
return NestedListDCDCECollection;
return NestedDCDCECollection;
} else {
return DatasetDCECollection;
}
Expand Down Expand Up @@ -355,40 +358,6 @@ var NestedDCDCECollection = DCECollection.extend(
);


//==============================================================================
/** @class Backbone model for a list dataset collection within a list:list dataset collection. */
var NestedListDCDCE = DatasetCollection.extend(
BASE_MVC.mixin(
DatasetCollectionElementMixin,
/** @lends NestedListDCDCE.prototype */ {
/** This is both a collection and a collection element - call the constructor */
constructor: function(attributes, options) {
this.debug("\t NestedListDCDCE.constructor:", attributes, options);
DatasetCollectionElementMixin.constructor.call(this, attributes, options);
},

/** String representation. */
toString: function() {
var objStr = this.object ? `${this.object}` : this.get("element_identifier");
return ["NestedListDCDCE(", objStr, ")"].join("");
}
}
)
);

//==============================================================================
/** @class Backbone collection containing list dataset collections. */
var NestedListDCDCECollection = NestedDCDCECollection.extend({
/** We know this collection is composed of only nested pair collections */
model: NestedListDCDCE,

/** String representation. */
toString: function() {
return ["NestedListDCDCECollection(", this.length, ")"].join("");
}
});


//==============================================================================
export default {
DatasetCollection: DatasetCollection,
Expand Down

0 comments on commit a3cc810

Please sign in to comment.