|
|
|
@ -1,5 +1,5 @@ |
|
|
|
define(['backbone','./Components'], |
|
|
|
function (Backbone, Components) { |
|
|
|
define(['backbone','./Components', 'ClassManager/model/ClassTags'], |
|
|
|
function (Backbone, Components, ClassTags) { |
|
|
|
/** |
|
|
|
* @class Component |
|
|
|
* */ |
|
|
|
@ -25,8 +25,10 @@ define(['backbone','./Components'], |
|
|
|
initialize: function(o) { |
|
|
|
this.config = o || {}; |
|
|
|
this.defaultC = this.config.components || []; |
|
|
|
this.defaultCl = this.config.classes || []; |
|
|
|
this.components = new Components(this.defaultC); |
|
|
|
this.set('components', this.components); |
|
|
|
this.set('classes', new ClassTags(this.defaultCl)); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
@ -34,14 +36,21 @@ define(['backbone','./Components'], |
|
|
|
*/ |
|
|
|
clone: function() |
|
|
|
{ |
|
|
|
var attr = _.clone(this.attributes), |
|
|
|
comp = this.get('components'); |
|
|
|
attr.components = []; |
|
|
|
var attr = _.clone(this.attributes), |
|
|
|
comp = this.get('components'), |
|
|
|
cls = this.get('classes'); |
|
|
|
attr.components = []; |
|
|
|
attr.classes = []; |
|
|
|
if(comp.length){ |
|
|
|
comp.each(function(md,i){ |
|
|
|
attr.components[i] = md.clone(); |
|
|
|
}); |
|
|
|
} |
|
|
|
if(cls.length){ |
|
|
|
cls.each(function(md,i){ |
|
|
|
attr.classes[i] = md.clone(); |
|
|
|
}); |
|
|
|
} |
|
|
|
return new this.constructor(attr); |
|
|
|
}, |
|
|
|
|
|
|
|
|