Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
merge AbstractContainer with Container
Browse files Browse the repository at this point in the history
  • Loading branch information
nttuyen committed Oct 29, 2013
1 parent 986a4dd commit b301096
Showing 1 changed file with 13 additions and 18 deletions.
Expand Up @@ -89,10 +89,10 @@
}
});

// The abstract model of a container
// The Container model presents a Zone in the layout which contains the Application
// In a container, we have special/reserved attributes following:
// - 'children' : is a Backbone.Collection which contains its children
var AbstractContainer = LayoutComponent.extend({
var Container = LayoutComponent.extend({
initialize : function(attributes, options) {
LayoutComponent.prototype.initialize.apply(this, arguments);

Expand All @@ -115,6 +115,16 @@
}, this);
},

isDroppable : function(dragObj) {
// Check for supported types
// TODO: Instead of hardcoding "Application". The type should be checked from children collection's model
if (dragObj && dragObj.constructor == Application) {
return this.get('droppable');
} else {
return false;
}
},

getDescendant : function(id) {
var child = this.getChild(id);
if (!child) {
Expand Down Expand Up @@ -187,22 +197,7 @@
},
at : function(idx) {
return this._children.at(idx);
}
});

// The Container model presents a Zone in the layout which contains the Application
var Container = AbstractContainer.extend({

isDroppable : function(dragObj) {
// Check for supported types
// TODO: Instead of hardcoding "Application". The type should be checked from children collection's model
if (dragObj && dragObj.constructor == Application) {
return this.get('droppable');
} else {
return false;
}
},

// Return the JSON object that contains metadata information
toJSON : function() {
var data = {
Expand All @@ -218,7 +213,7 @@
});

//
var PageLayout = AbstractContainer.extend({
var PageLayout = Container.extend({

isDroppable : function(dragObj) {
// Check for supported types
Expand Down

0 comments on commit b301096

Please sign in to comment.